Document return values
[ACE_TAO.git] / ACE / ace / Stream_Modules.h
blobf3812e0fa86722a2ad06f8e483cda7ce44ece143
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Stream_Modules.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 */
9 //=============================================================================
11 // This needs to go outside of the #if !defined() block. Don't ask...
12 #include "ace/Task.h"
14 #if !defined (ACE_LACKS_PRAGMA_ONCE)
15 # 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
24 /**
25 * @class ACE_Stream_Head
27 * @brief Standard task that acts as reader or writer at the head of
28 * an ACE_Stream.
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
45 * stream.
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>
51 public:
52 /// Construction
53 ACE_Stream_Head ();
55 /// Destruction
56 virtual ~ACE_Stream_Head ();
58 // = ACE_Task hooks
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);
62 virtual int svc ();
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;
67 virtual int fini ();
69 /// Dump the state of an object.
70 void dump () const;
72 /// Declare the dynamic allocation hooks.
73 ACE_ALLOC_HOOK_DECLARE;
75 private:
76 /// Performs canonical flushing at the ACE_Stream Head.
77 int control (ACE_Message_Block *);
78 int canonical_flush (ACE_Message_Block *);
81 /**
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>
89 public:
90 /// Construction
91 ACE_Stream_Tail ();
93 /// Destruction
94 virtual ~ACE_Stream_Tail ();
96 // = ACE_Task hooks
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);
100 virtual int svc ();
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;
105 virtual int fini ();
107 /// Dump the state of an object.
108 void dump () const;
110 /// Declare the dynamic allocation hooks.
111 ACE_ALLOC_HOOK_DECLARE;
113 private:
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>
128 public:
129 /// Construction
130 ACE_Thru_Task ();
132 /// Destruction
133 virtual ~ACE_Thru_Task ();
135 // = ACE_Task hooks
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);
139 virtual int svc ();
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;
144 virtual int fini ();
146 /// Dump the state of an object.
147 void dump () const;
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 */