#include <ace/Stream.h>
template<ACE_SYNCH_DECL> class ACE_Stream {
public:
friend class ACE_Stream_Iterator<ACE_SYNCH_USE>;
enum{ M_DELETE = 3 };
ACE_Stream ( void *arg = 0, ACE_Module<ACE_SYNCH_USE> *head = 0, ACE_Module<ACE_SYNCH_USE> *tail = 0 );
int open ( void *arg, ACE_Module<ACE_SYNCH_USE> *head = 0, ACE_Module<ACE_SYNCH_USE> *tail = 0 );
int close (int flags = M_DELETE);
~ACE_Stream (void);
int push (ACE_Module<ACE_SYNCH_USE> *mod);
int pop (int flags = M_DELETE);
int top (ACE_Module<ACE_SYNCH_USE> *&mod);
int remove (const ASYS_TCHAR *mod, int flags = M_DELETE);
ACE_Module<ACE_SYNCH_USE> *head (void);
ACE_Module<ACE_SYNCH_USE> *tail (void);
ACE_Module<ACE_SYNCH_USE> *find (const ASYS_TCHAR *mod);
int link (ACE_Stream<ACE_SYNCH_USE> &);
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_USE> &);
int push_module ( ACE_Module<ACE_SYNCH_USE> *, ACE_Module<ACE_SYNCH_USE> * = 0, ACE_Module<ACE_SYNCH_USE> * = 0 );
ACE_Module<ACE_SYNCH_USE> *stream_head_;
ACE_Module<ACE_SYNCH_USE> *stream_tail_;
ACE_Stream<ACE_SYNCH_USE> *linked_us_;
ACE_SYNCH_MUTEX_T lock_;
ACE_SYNCH_CONDITION_T final_close_;
};
ACE_Modules
, each of which
contains two ACE_Tasks
.
ACE_Stream (
void *arg = 0,
ACE_Module<ACE_SYNCH_USE> *head = 0,
ACE_Module<ACE_SYNCH_USE> *tail = 0
);
head
and tail
as the Stream
head and Stream tail, respectively. If these are 0 then the
ACE_Stream_Head
and ACE_Stream_Tail
are used, respectively.
arg
is the value past in to the open() methods of the tasks.
int open (
void *arg,
ACE_Module<ACE_SYNCH_USE> *head = 0,
ACE_Module<ACE_SYNCH_USE> *tail = 0
);
head
and tail
as the Stream
head and Stream tail, respectively. If these are 0 then the
ACE_Stream_Head
and ACE_Stream_Tail
are used, respectively.
arg
is the value past in to the open() methods of the tasks.
int close (int flags = M_DELETE);
~ACE_Stream (void);
int push (ACE_Module<ACE_SYNCH_USE> *mod);
mod
right below the Stream head.
int pop (int flags = M_DELETE);
mod
right below the Stream head and close it down.
int top (ACE_Module<ACE_SYNCH_USE> *&mod);
int remove (const ASYS_TCHAR *mod, int flags = M_DELETE);
mod
from the stream. This bypasses the
strict LIFO ordering of push() and pop().
ACE_Module<ACE_SYNCH_USE> *head (void);
ACE_Module<ACE_SYNCH_USE> *tail (void);
ACE_Module<ACE_SYNCH_USE> *find (const ASYS_TCHAR *mod);
int link (ACE_Stream<ACE_SYNCH_USE> &);
int unlink (void);
int put (ACE_Message_Block *mb, ACE_Time_Value *timeout);
mb
down the stream, starting at the Module
below the Stream head. Wait for upto timeout
amount of time
for the operation to complete (or block forever if timeout
==
0).
int get (ACE_Message_Block *&mb, ACE_Time_Value *timeout);
mb
that is stored in the the stream head.
Wait for upto timeout
amount of time for the operation to
complete (or block forever if timeout
== 0).
int control (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, void *args);
int wait (void);
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
ACE_SYNCH_MUTEX_T lock_;
ACE_SYNCH_CONDITION_T final_close_;