NAME

ACE_Stream - This class is the primary abstraction for the ASX framework. It is moduled after System V Stream.

SYNOPSIS


#include <ace/Stream.h>


template<ACE_SYNCH_1>
class ACE_Stream
{
  public:
    friend class ACE_Stream_Iterator<ACE_SYNCH_2>;
    enum{ M_DELETE = 1 };
    ACE_Stream (
        void *arg = 0,
        ACE_Module<ACE_SYNCH_2> *head = 0,
        ACE_Module<ACE_SYNCH_2> *tail = 0
        );
    int open (
        void *arg,
        ACE_Module<ACE_SYNCH_2> *head = 0,
        ACE_Module<ACE_SYNCH_2> *tail = 0
        );
    int close (u_long flags = M_DELETE);
    ~ACE_Stream (void);
    int push (ACE_Module<ACE_SYNCH_2> *mod);
    int pop (u_long flags = M_DELETE);
    int top (ACE_Module<ACE_SYNCH_2> *&mod);
    int remove (const char *mod, u_long flags = M_DELETE);
    ACE_Module<ACE_SYNCH_2> *head (void);
    ACE_Module<ACE_SYNCH_2> *tail (void);
    ACE_Module<ACE_SYNCH_2> *find (const char *mod);
    int link (ACE_Stream<ACE_SYNCH_2> &);
    int unlink (void);
    int put (ACE_Message_Block *mb, ACE_Time_Value *timeout);
    int get (ACE_Message_Block *&mb, ACE_Time_Value *timeout);
    int control (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, void *args);
    int wait (void);
    void dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
  private:
    int unlink_i (void);
    int link_i (ACE_Stream<ACE_SYNCH_2> &);
    int push_module (
        ACE_Module<ACE_SYNCH_2> *,
        ACE_Module<ACE_SYNCH_2> * = 0,
        ACE_Module<ACE_SYNCH_2> * = 0
        );
    ACE_Module<ACE_SYNCH_2> *stream_head_;
    ACE_Module<ACE_SYNCH_2> *stream_tail_;
    ACE_Stream<ACE_SYNCH_2> *linked_us_;
    ACE_SYNCH_MUTEX lock_;
    ACE_SYNCH_CONDITION final_close_;
};

DESCRIPTION

A Stream consists of a stack of ACE_Modules, each of which contains two ACE_Tasks.

Initializatation and termination methods.

ACE_Stream (
    void *arg = 0,
    ACE_Module<ACE_SYNCH_2> *head = 0,
    ACE_Module<ACE_SYNCH_2> *tail = 0
    );
int open (
    void *arg,
    ACE_Module<ACE_SYNCH_2> *head = 0,
    ACE_Module<ACE_SYNCH_2> *tail = 0
    );
int close (u_long flags = M_DELETE);
~ACE_Stream (void);

ACE_Stream plumbing operations

int push (ACE_Module<ACE_SYNCH_2> *mod);
int pop (u_long flags = M_DELETE);
int top (ACE_Module<ACE_SYNCH_2> *&mod);
int remove (const char *mod, u_long flags = M_DELETE);
ACE_Module<ACE_SYNCH_2> *head (void);
ACE_Module<ACE_SYNCH_2> *tail (void);
ACE_Module<ACE_SYNCH_2> *find (const char *mod);
int link (ACE_Stream<ACE_SYNCH_2> &);
int unlink (void);

Blocking data transfer operations

int put (ACE_Message_Block *mb, ACE_Time_Value *timeout);
int get (ACE_Message_Block *&mb, ACE_Time_Value *timeout);
int control (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, void *args);
int wait (void);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;

Synchronization objects used for thread-safe streams.

ACE_SYNCH_MUTEX lock_;
ACE_SYNCH_CONDITION final_close_;

AUTHOR

Doug Schmidt

LIBRARY

ace