ACE_Stream_Tail<> Class Template Reference

Standard module that acts as the head of a stream. More...

#include <Stream_Modules.h>

Inheritance diagram for ACE_Stream_Tail<>:

Inheritance graph
[legend]
Collaboration diagram for ACE_Stream_Tail<>:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_Stream_Tail (void)
 Construction.

 ~ACE_Stream_Tail (void)
 Destruction.

virtual int open (void *a=0)
virtual int close (u_long flags=0)
virtual int put (ACE_Message_Block *msg, ACE_Time_Value *=0)
virtual int svc (void)
 Run by a daemon thread to handle deferred processing.

virtual int init (int argc, ACE_TCHAR *argv[])
 Initializes object when dynamic linking occurs.

virtual int info (ACE_TCHAR **info_string, size_t length) const
 Returns information on a service object.

virtual int fini (void)
 Terminates object when dynamic unlinking occurs.

void dump (void) const
 Dump the state of an object.


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Private Member Functions

int control (ACE_Message_Block *)
 Performs canonical flushing at the ACE_Stream tail.

int canonical_flush (ACE_Message_Block *)

Detailed Description

template<ACE_SYNCH_DECL>
class ACE_Stream_Tail<>

Standard module that acts as the head of a stream.

Definition at line 89 of file Stream_Modules.h.


Constructor & Destructor Documentation

template<ACE_SYNCH_DECL >
ACE_Stream_Tail<>::ACE_Stream_Tail void   ) 
 

Construction.

Definition at line 159 of file Stream_Modules.cpp.

References ACE_TRACE.

00160 {
00161   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::ACE_Stream_Tail");
00162 }

template<ACE_SYNCH_DECL >
ACE_Stream_Tail<>::~ACE_Stream_Tail void   ) 
 

Destruction.

Definition at line 165 of file Stream_Modules.cpp.

References ACE_TRACE.

00166 {
00167   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::~ACE_Stream_Tail");
00168 }


Member Function Documentation

template<ACE_SYNCH_DECL >
int ACE_Stream_Tail<>::canonical_flush ACE_Message_Block  )  [private]
 

Definition at line 227 of file Stream_Modules.cpp.

References ACE_BIT_ENABLED, ACE_CLR_BITS, ACE_TRACE, ACE_Task< ACE_SYNCH_USE >::flush(), ACE_Message_Block::rd_ptr(), ACE_Message_Block::release(), ACE_Task< ACE_SYNCH_USE >::reply(), and ACE_Task< ACE_SYNCH_USE >::sibling().

00228 {
00229   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::canonical_flush");
00230   char *cp = mb->rd_ptr ();
00231 
00232   if (ACE_BIT_ENABLED (*cp, ACE_Task_Flags::ACE_FLUSHW))
00233     {
00234       this->flush (ACE_Task_Flags::ACE_FLUSHALL);
00235       ACE_CLR_BITS (*cp, ACE_Task_Flags::ACE_FLUSHW);
00236     }
00237 
00238   if (ACE_BIT_ENABLED (*cp, ACE_Task_Flags::ACE_FLUSHR))
00239     {
00240       this->sibling ()->flush (ACE_Task_Flags::ACE_FLUSHALL);
00241       return this->reply (mb);
00242     }
00243   else
00244     mb->release ();
00245 
00246   return 0;
00247 }

template<ACE_SYNCH_DECL >
int ACE_Stream_Tail<>::close u_long  flags = 0  )  [virtual]
 

Hook called from ACE_Thread_Exit when during thread exit and from the default implementation of . In general, this method shouldn't be called directly by an application, particularly if the is running as an Active Object. Instead, a special message should be passed into the via the method defined below, and the method should interpret this as a flag to shut down the .

Reimplemented from ACE_Task_Base.

Definition at line 186 of file Stream_Modules.cpp.

References ACE_TRACE.

00187 {
00188   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::close");
00189   return 0;
00190 }

template<ACE_SYNCH_DECL >
int ACE_Stream_Tail<>::control ACE_Message_Block  )  [private]
 

Performs canonical flushing at the ACE_Stream tail.

Definition at line 200 of file Stream_Modules.cpp.

References ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds, ACE_TRACE, ACE_IO_Cntl_Msg::cmd(), ACE_Message_Block::cont(), ACE_Message_Block::msg_type(), ACE_Message_Block::rd_ptr(), ACE_Task< ACE_SYNCH_USE >::reply(), ACE_IO_Cntl_Msg::rval(), ACE_Task< ACE_SYNCH_USE >::sibling(), and ACE_Task< ACE_SYNCH_USE >::water_marks().

Referenced by ACE_Stream_Tail<>::put().

00201 {
00202   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::control");
00203   ACE_IO_Cntl_Msg *ioc = (ACE_IO_Cntl_Msg *) mb->rd_ptr ();
00204   ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd;
00205 
00206   switch (cmd = ioc->cmd ())
00207     {
00208     case ACE_IO_Cntl_Msg::SET_LWM:
00209     case ACE_IO_Cntl_Msg::SET_HWM:
00210       {
00211         size_t wm_size = *(size_t *) mb->cont ()->rd_ptr ();
00212 
00213         this->water_marks (cmd, wm_size);
00214         this->sibling ()->water_marks (cmd, wm_size);
00215         ioc->rval (0);
00216         break;
00217       }
00218     default:
00219       mb->msg_type (ACE_Message_Block::MB_IOCNAK);
00220     }
00221   return this->reply (mb);
00222 }

template<ACE_SYNCH_DECL >
void ACE_Stream_Tail<>::dump void   )  const
 

Dump the state of an object.

Reimplemented from ACE_Task< ACE_SYNCH_USE >.

Definition at line 171 of file Stream_Modules.cpp.

References ACE_TRACE.

00172 {
00173 #if defined (ACE_HAS_DUMP)
00174   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::dump");
00175 #endif /* ACE_HAS_DUMP */
00176 }

template<ACE_SYNCH_DECL >
int ACE_Stream_Tail<>::fini void   )  [virtual]
 

Terminates object when dynamic unlinking occurs.

Reimplemented from ACE_Shared_Object.

Definition at line 293 of file Stream_Modules.cpp.

References ACE_TRACE.

00294 {
00295   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::fini");
00296   return 0;
00297 }

template<ACE_SYNCH_DECL >
int ACE_Stream_Tail<>::info ACE_TCHAR **  info_string,
size_t  length
const [virtual]
 

Returns information on a service object.

Reimplemented from ACE_Shared_Object.

Definition at line 280 of file Stream_Modules.cpp.

References ACE_TCHAR, ACE_TRACE, ACE_Task< ACE_SYNCH_USE >::name(), ACE_OS::strdup(), ACE_OS::strlen(), and ACE_OS::strsncpy().

00281 {
00282   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::info");
00283   const ACE_TCHAR *name = this->name ();
00284 
00285   if (*strp == 0 && (*strp = ACE_OS::strdup (name)) == 0)
00286     return -1;
00287   else
00288     ACE_OS::strsncpy (*strp, name, length);
00289   return static_cast<int> (ACE_OS::strlen (name));
00290 }

template<ACE_SYNCH_DECL >
int ACE_Stream_Tail<>::init int  argc,
ACE_TCHAR argv[]
[virtual]
 

Initializes object when dynamic linking occurs.

Reimplemented from ACE_Shared_Object.

Definition at line 273 of file Stream_Modules.cpp.

References ACE_TCHAR, and ACE_TRACE.

00274 {
00275   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::init");
00276   return 0;
00277 }

template<ACE_SYNCH_DECL >
int ACE_Stream_Tail<>::open void *  a = 0  )  [virtual]
 

Hook called to initialize a task and prepare it for execution. args can be used to pass arbitrary information into .

Reimplemented from ACE_Task_Base.

Definition at line 179 of file Stream_Modules.cpp.

References ACE_TRACE.

00180 {
00181   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::open");
00182   return 0;
00183 }

template<ACE_SYNCH_DECL >
int ACE_Stream_Tail<>::put ACE_Message_Block msg,
ACE_Time_Value = 0
[virtual]
 

A hook method that can be used to pass a message to a task, where it can be processed immediately or queued for subsequent processing in the hook method.

Reimplemented from ACE_Task_Base.

Definition at line 250 of file Stream_Modules.cpp.

References ACE_TRACE, ACE_Stream_Tail<>::control(), ACE_Task_Base::is_writer(), ACE_Message_Block::msg_type(), and ACE_Message_Block::release().

00252 {
00253   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::put");
00254 
00255   if (this->is_writer ())
00256     {
00257       switch (mb->msg_type ())
00258         {
00259         case ACE_Message_Block::MB_IOCTL:
00260           return this->control (mb);
00261           /* NOTREACHED */
00262         default:
00263           mb->release ();
00264           return 0;
00265           /* NOTREACHED */
00266         }
00267     }
00268 
00269   return -1;
00270 }

template<ACE_SYNCH_DECL >
int ACE_Stream_Tail<>::svc void   )  [virtual]
 

Run by a daemon thread to handle deferred processing.

Reimplemented from ACE_Task_Base.

Definition at line 193 of file Stream_Modules.cpp.

References ACE_TRACE.

00194 {
00195   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::svc");
00196   return -1;
00197 }


Member Data Documentation

template<ACE_SYNCH_DECL >
ACE_Stream_Tail<>::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_Task< ACE_SYNCH_USE >.

Definition at line 113 of file Stream_Modules.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:30:21 2006 for ACE by doxygen 1.3.6