00001 /* -*- C++ -*- */ 00002 00003 //============================================================================= 00004 /** 00005 * @file Stream_Modules.h 00006 * 00007 * $Id: Stream_Modules.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $ 00008 * 00009 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> 00010 */ 00011 //============================================================================= 00012 00013 // This needs to go outside of the #if !defined() block. Don't ask... 00014 #include "ace/Task.h" 00015 00016 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00017 # pragma once 00018 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00019 00020 #ifndef ACE_STREAM_MODULES 00021 #define ACE_STREAM_MODULES 00022 #include "ace/pre.h" 00023 00024 /** 00025 * @class ACE_Stream_Head 00026 * 00027 * @brief Standard module that acts as the head of a ustream. 00028 */ 00029 template <ACE_SYNCH_DECL> 00030 class ACE_Stream_Head : public ACE_Task<ACE_SYNCH_USE> 00031 { 00032 public: 00033 /// Construction 00034 ACE_Stream_Head (void); 00035 00036 /// Destruction 00037 ~ACE_Stream_Head (void); 00038 00039 // = ACE_Task hooks 00040 virtual int open (void *a = 0); 00041 virtual int close (u_long flags = 0); 00042 virtual int put (ACE_Message_Block *msg, ACE_Time_Value * = 0); 00043 virtual int svc (void); 00044 00045 // = Dynamic linking hooks 00046 virtual int init (int argc, ACE_TCHAR *argv[]); 00047 virtual int info (ACE_TCHAR **info_string, size_t length) const; 00048 virtual int fini (void); 00049 00050 /// Dump the state of an object. 00051 void dump (void) const; 00052 00053 /// Declare the dynamic allocation hooks. 00054 ACE_ALLOC_HOOK_DECLARE; 00055 00056 private: 00057 /// Performs canonical flushing at the ACE_Stream Head. 00058 int control (ACE_Message_Block *); 00059 int canonical_flush (ACE_Message_Block *); 00060 }; 00061 00062 /** 00063 * @class ACE_Stream_Tail 00064 * 00065 * @brief Standard module that acts as the head of a ustream. 00066 */ 00067 template <ACE_SYNCH_DECL> 00068 class ACE_Stream_Tail : public ACE_Task<ACE_SYNCH_USE> 00069 { 00070 public: 00071 /// Construction 00072 ACE_Stream_Tail (void); 00073 00074 /// Destruction 00075 ~ACE_Stream_Tail (void); 00076 00077 // = ACE_Task hooks 00078 virtual int open (void *a = 0); 00079 virtual int close (u_long flags = 0); 00080 virtual int put (ACE_Message_Block *msg, ACE_Time_Value * = 0); 00081 virtual int svc (void); 00082 00083 // = Dynamic linking hooks 00084 virtual int init (int argc, ACE_TCHAR *argv[]); 00085 virtual int info (ACE_TCHAR **info_string, size_t length) const; 00086 virtual int fini (void); 00087 00088 /// Dump the state of an object. 00089 void dump (void) const; 00090 00091 /// Declare the dynamic allocation hooks. 00092 ACE_ALLOC_HOOK_DECLARE; 00093 00094 private: 00095 /// Performs canonical flushing at the ACE_Stream tail. 00096 int control (ACE_Message_Block *); 00097 int canonical_flush (ACE_Message_Block *); 00098 }; 00099 00100 /** 00101 * @class ACE_Thru_Task 00102 * 00103 * @brief Standard module that acts as a "no op", simply passing on all 00104 * data to its adjacent neighbor. 00105 */ 00106 template <ACE_SYNCH_DECL> 00107 class ACE_Thru_Task : public ACE_Task<ACE_SYNCH_USE> 00108 { 00109 public: 00110 /// Construction 00111 ACE_Thru_Task (void); 00112 00113 /// Destruction 00114 ~ACE_Thru_Task (void); 00115 00116 // = ACE_Task hooks 00117 virtual int open (void *a = 0); 00118 virtual int close (u_long flags = 0); 00119 virtual int put (ACE_Message_Block *msg, ACE_Time_Value * = 0); 00120 virtual int svc (void); 00121 00122 // = Dynamic linking hooks 00123 virtual int init (int argc, ACE_TCHAR *argv[]); 00124 virtual int info (ACE_TCHAR **info_string, size_t length) const; 00125 virtual int fini (void); 00126 00127 /// Dump the state of an object. 00128 void dump (void) const; 00129 00130 /// Declare the dynamic allocation hooks. 00131 ACE_ALLOC_HOOK_DECLARE; 00132 }; 00133 00134 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00135 #include "ace/Stream_Modules.cpp" 00136 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00137 00138 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00139 #pragma implementation ("Stream_Modules.cpp") 00140 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00141 00142 #include "ace/post.h" 00143 #endif /* ACE_STREAM_MODULES */
1.2.14 written by Dimitri van Heesch,
© 1997-2002