Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Stream_Head Class Template Reference

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

#include <Stream_Modules.h>

Inheritance diagram for ACE_Stream_Head:

Inheritance graph
[legend]
Collaboration diagram for ACE_Stream_Head:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Stream_Head (void)
 Construction. More...

 ~ACE_Stream_Head (void)
 Destruction. More...

virtual int open (void *a=0)
 Hook called to open a Task. <args> can be used to pass arbitrary information into <open>. More...

virtual int close (u_long flags=0)
virtual int put (ACE_Message_Block *msg, ACE_Time_Value *=0)
 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 <svc> hook method. More...

virtual int svc (void)
 Run by a daemon thread to handle deferred processing. More...

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

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

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

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


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Private Methods

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

int canonical_flush (ACE_Message_Block *)

Detailed Description

template<ACE_SYNCH_DECL>
class ACE_Stream_Head<>

Standard module that acts as the head of a ustream.

Definition at line 30 of file Stream_Modules.h.


Constructor & Destructor Documentation

template<ACE_SYNCH_DECL >
ACE_Stream_Head<>::ACE_Stream_Head void   
 

Construction.

Definition at line 19 of file Stream_Modules.cpp.

References ACE_TRACE.

00020 {
00021   ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::ACE_Stream_Head");
00022 }

template<ACE_SYNCH_DECL >
ACE_Stream_Head<>::~ACE_Stream_Head void   
 

Destruction.

Definition at line 25 of file Stream_Modules.cpp.

References ACE_TRACE.

00026 {
00027   ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::~ACE_Stream_Head");
00028 }


Member Function Documentation

template<ACE_SYNCH_DECL >
int ACE_Stream_Head<>::canonical_flush ACE_Message_Block   [private]
 

Definition at line 82 of file Stream_Modules.cpp.

References ACE_BIT_ENABLED, ACE_CLR_BITS, ACE_Task_Flags::ACE_FLUSHALL, ACE_Task_Flags::ACE_FLUSHR, ACE_Task_Flags::ACE_FLUSHW, ACE_TRACE, ACE_Task< ACE_SYNCH_USE >::flush, ACE_Message_Block::rd_ptr, ACE_Message_Block::release, and ACE_Task< ACE_SYNCH_USE >::reply.

Referenced by put.

00083 {
00084   ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::canonical_flush");
00085   char *cp = mb->rd_ptr ();
00086 
00087   if (ACE_BIT_ENABLED (*cp, ACE_Task_Flags::ACE_FLUSHR))
00088     {
00089       this->flush (ACE_Task_Flags::ACE_FLUSHALL);
00090       ACE_CLR_BITS (*cp, ACE_Task_Flags::ACE_FLUSHR);
00091     }
00092 
00093   if (ACE_BIT_ENABLED (*cp, ACE_Task_Flags::ACE_FLUSHW))
00094     return this->reply (mb);
00095   else
00096     mb->release ();
00097   return 0;
00098 }

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

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

Reimplemented from ACE_Task_Base.

Definition at line 46 of file Stream_Modules.cpp.

References ACE_TRACE.

00047 {
00048   ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::close");
00049   return 0;
00050 }

template<ACE_SYNCH_DECL >
int ACE_Stream_Head<>::control ACE_Message_Block   [private]
 

Performs canonical flushing at the ACE_Stream Head.

Definition at line 60 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::rd_ptr, ACE_IO_Cntl_Msg::rval, ACE_IO_Cntl_Msg::SET_HWM, ACE_IO_Cntl_Msg::SET_LWM, and ACE_Task< ACE_SYNCH_USE >::water_marks.

Referenced by put.

00061 {
00062   ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::control");
00063   ACE_IO_Cntl_Msg *ioc = (ACE_IO_Cntl_Msg *) mb->rd_ptr ();
00064   ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd;
00065 
00066   switch (cmd = ioc->cmd ())
00067     {
00068     case ACE_IO_Cntl_Msg::SET_LWM:
00069     case ACE_IO_Cntl_Msg::SET_HWM:
00070       this->water_marks (cmd, *(size_t *) mb->cont ()->rd_ptr ());
00071       ioc->rval (0);
00072       break;
00073     default:
00074       return 0;
00075     }
00076   return ioc->rval ();
00077 }

template<ACE_SYNCH_DECL >
void ACE_Stream_Head<>::dump void    const
 

Dump the state of an object.

Reimplemented from ACE_Task< ACE_SYNCH_USE >.

Definition at line 31 of file Stream_Modules.cpp.

References ACE_TRACE.

00032 {
00033   ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::dump");
00034 }

template<ACE_SYNCH_DECL >
int ACE_Stream_Head<>::fini void    [virtual]
 

Terminates object when dynamic unlinking occurs.

Reimplemented from ACE_Shared_Object.

Definition at line 148 of file Stream_Modules.cpp.

References ACE_TRACE.

00149 {
00150   ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::fini");
00151   return 0;
00152 }

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

Returns information on a service object.

Reimplemented from ACE_Shared_Object.

Definition at line 135 of file Stream_Modules.cpp.

References ACE_TCHAR, ACE_TRACE, ACE_Task< ACE_SYNCH_USE >::name, ACE_OS_String::strdup, ACE_OS_String::strlen, and ACE_OS_String::strsncpy.

00136 {
00137   ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::info");
00138   const ACE_TCHAR *name = this->name ();
00139 
00140   if (*strp == 0 && (*strp = ACE_OS::strdup (name)) == 0)
00141     return -1;
00142   else
00143     ACE_OS::strsncpy (*strp, name, length);
00144   return ACE_static_cast (int, ACE_OS_String::strlen (name));
00145 }

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

Initializes object when dynamic linking occurs.

Reimplemented from ACE_Shared_Object.

Definition at line 128 of file Stream_Modules.cpp.

References ACE_TCHAR, and ACE_TRACE.

00129 {
00130   ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::init");
00131   return 0;
00132 }

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

Hook called to open a Task. <args> can be used to pass arbitrary information into <open>.

Reimplemented from ACE_Task_Base.

Definition at line 39 of file Stream_Modules.cpp.

References ACE_TRACE.

00040 {
00041   ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::open");
00042   return 0;
00043 }

template<ACE_SYNCH_DECL >
int ACE_Stream_Head<>::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 <svc> hook method.

Reimplemented from ACE_Task_Base.

Definition at line 101 of file Stream_Modules.cpp.

References ACE_TRACE, canonical_flush, control, ACE_Task_Base::is_writer, ACE_Message_Block::MB_FLUSH, ACE_Message_Block::MB_IOCTL, ACE_Message_Block::msg_type, ACE_Task< ACE_SYNCH_USE >::put_next, and ACE_Task< ACE_SYNCH_USE >::putq.

00103 {
00104   ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::put");
00105   int res = 0;
00106 
00107   if (mb->msg_type () == ACE_Message_Block::MB_IOCTL
00108       && (res = this->control (mb)) == -1)
00109     return res;
00110 
00111   if (this->is_writer ())
00112     return this->put_next (mb, tv);
00113   else // this->is_reader ()
00114     {
00115       switch (mb->msg_type ())
00116         {
00117         case ACE_Message_Block::MB_FLUSH:
00118           return this->canonical_flush (mb);
00119         default:
00120           break;
00121         }
00122 
00123       return this->putq (mb, tv);
00124     }
00125 }

template<ACE_SYNCH_DECL >
int ACE_Stream_Head<>::svc void    [virtual]
 

Run by a daemon thread to handle deferred processing.

Reimplemented from ACE_Task_Base.

Definition at line 53 of file Stream_Modules.cpp.

References ACE_TRACE.

00054 {
00055   ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::svc");
00056   return -1;
00057 }


Member Data Documentation

template<ACE_SYNCH_DECL >
ACE_Stream_Head::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_Task< ACE_SYNCH_USE >.

Definition at line 54 of file Stream_Modules.h.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:56:50 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002