3 //=============================================================================
5 * @file Stream_Modules.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
9 //=============================================================================
11 // This needs to go outside of the #if !defined() block. Don't ask...
14 #if !defined (ACE_LACKS_PRAGMA_ONCE)
16 #endif /* ACE_LACKS_PRAGMA_ONCE */
18 #ifndef ACE_STREAM_MODULES
19 #define ACE_STREAM_MODULES
20 #include /**/ "ace/pre.h"
22 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
25 * @class ACE_Stream_Head
27 * @brief Standard task that acts as reader or writer at the head of
30 * A ACE_Message_Block sent to this task (via its put() hook) triggers
31 * actions depending on the block type and whether the task is acting as
32 * a reader or a writer. If the block is of type ACE_Message_Block::MB_IOCTL,
33 * the block's is assumed to contain (beginning at its rd_ptr()) an
34 * ACE_IO_Cntl_Msg object and is processed accordingly. This is usually
35 * used to set the task's message queue high water and/or low water marks.
37 * When the block is not ACE_Message_Block::MB_IOCTL, processing depends on
38 * the ACE_Stream_Head's role in the module:
40 * - Reader: If the block is of type ACE_Message_Block::MB_FLUSH, the
41 * canonical_flush() method is called.
42 * (@see ACE_Stream::canonical_flush().) If the block is any other
43 * type, it is queued on this task's message queue. It would thus
44 * be available to caller's reading blocks from the containing
46 * - Writer: The block is passed to the next module in the stream.
48 template <ACE_SYNCH_DECL
, class TIME_POLICY
= ACE_System_Time_Policy
>
49 class ACE_Stream_Head
: public ACE_Task
<ACE_SYNCH_USE
, TIME_POLICY
>
56 virtual ~ACE_Stream_Head ();
59 virtual int open (void *a
= 0);
60 virtual int close (u_long flags
= 0);
61 virtual int put (ACE_Message_Block
*msg
, ACE_Time_Value
* = 0);
64 // = Dynamic linking hooks
65 virtual int init (int argc
, ACE_TCHAR
*argv
[]);
66 virtual int info (ACE_TCHAR
**info_string
, size_t length
) const;
69 /// Dump the state of an object.
72 /// Declare the dynamic allocation hooks.
73 ACE_ALLOC_HOOK_DECLARE
;
76 /// Performs canonical flushing at the ACE_Stream Head.
77 int control (ACE_Message_Block
*);
78 int canonical_flush (ACE_Message_Block
*);
82 * @class ACE_Stream_Tail
84 * @brief Standard module that acts as the head of a stream.
86 template <ACE_SYNCH_DECL
, class TIME_POLICY
= ACE_System_Time_Policy
>
87 class ACE_Stream_Tail
: public ACE_Task
<ACE_SYNCH_USE
, TIME_POLICY
>
94 virtual ~ACE_Stream_Tail ();
97 virtual int open (void *a
= 0);
98 virtual int close (u_long flags
= 0);
99 virtual int put (ACE_Message_Block
*msg
, ACE_Time_Value
* = 0);
102 // = Dynamic linking hooks
103 virtual int init (int argc
, ACE_TCHAR
*argv
[]);
104 virtual int info (ACE_TCHAR
**info_string
, size_t length
) const;
107 /// Dump the state of an object.
110 /// Declare the dynamic allocation hooks.
111 ACE_ALLOC_HOOK_DECLARE
;
114 /// Performs canonical flushing at the ACE_Stream tail.
115 int control (ACE_Message_Block
*);
116 int canonical_flush (ACE_Message_Block
*);
120 * @class ACE_Thru_Task
122 * @brief Standard module that acts as a "no op", simply passing on all
123 * data to its adjacent neighbor.
125 template <ACE_SYNCH_DECL
, class TIME_POLICY
= ACE_System_Time_Policy
>
126 class ACE_Thru_Task
: public ACE_Task
<ACE_SYNCH_USE
, TIME_POLICY
>
133 virtual ~ACE_Thru_Task ();
136 virtual int open (void *a
= 0);
137 virtual int close (u_long flags
= 0);
138 virtual int put (ACE_Message_Block
*msg
, ACE_Time_Value
* = 0);
141 // = Dynamic linking hooks
142 virtual int init (int argc
, ACE_TCHAR
*argv
[]);
143 virtual int info (ACE_TCHAR
**info_string
, size_t length
) const;
146 /// Dump the state of an object.
149 /// Declare the dynamic allocation hooks.
150 ACE_ALLOC_HOOK_DECLARE
;
153 ACE_END_VERSIONED_NAMESPACE_DECL
155 #include "ace/Stream_Modules.cpp"
157 #include /**/ "ace/post.h"
158 #endif /* ACE_STREAM_MODULES */