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

ACE_Stream_Tail Class Template Reference

Standard module that acts as the head of a ustream. 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 Methods

 ACE_Stream_Tail (void)
 Construction. More...

 ~ACE_Stream_Tail (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 tail. More...

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 ustream.

Definition at line 68 of file Stream_Modules.h.


Constructor & Destructor Documentation

template<ACE_SYNCH_DECL >
ACE_Stream_Tail<>::ACE_Stream_Tail void   
 

Construction.

Definition at line 157 of file Stream_Modules.cpp.

References ACE_TRACE.

00158 {
00159   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::ACE_Stream_Tail");
00160 }

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

Destruction.

Definition at line 163 of file Stream_Modules.cpp.

References ACE_TRACE.

00164 {
00165   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::~ACE_Stream_Tail");
00166 }


Member Function Documentation

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

Definition at line 223 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, ACE_Task< ACE_SYNCH_USE >::reply, and ACE_Task< ACE_SYNCH_USE >::sibling.

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

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 <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 182 of file Stream_Modules.cpp.

References ACE_TRACE.

00183 {
00184   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::close");
00185   return 0;
00186 }

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

Performs canonical flushing at the ACE_Stream tail.

Definition at line 196 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::MB_IOCNAK, ACE_Message_Block::msg_type, ACE_Message_Block::rd_ptr, ACE_Task< ACE_SYNCH_USE >::reply, ACE_IO_Cntl_Msg::rval, ACE_IO_Cntl_Msg::SET_HWM, ACE_IO_Cntl_Msg::SET_LWM, ACE_Task< ACE_SYNCH_USE >::sibling, and ACE_Task< ACE_SYNCH_USE >::water_marks.

Referenced by put.

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

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 169 of file Stream_Modules.cpp.

References ACE_TRACE.

00170 {
00171   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::dump");
00172 }

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 289 of file Stream_Modules.cpp.

References ACE_TRACE.

00290 {
00291   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::fini");
00292   return 0;
00293 }

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 276 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.

00277 {
00278   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::info");
00279   const ACE_TCHAR *name = this->name ();
00280 
00281   if (*strp == 0 && (*strp = ACE_OS::strdup (name)) == 0)
00282     return -1;
00283   else
00284     ACE_OS::strsncpy (*strp, name, length);
00285   return ACE_static_cast (int, ACE_OS_String::strlen (name));
00286 }

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 269 of file Stream_Modules.cpp.

References ACE_TCHAR, and ACE_TRACE.

00270 {
00271   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::init");
00272   return 0;
00273 }

template<ACE_SYNCH_DECL >
int ACE_Stream_Tail<>::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 175 of file Stream_Modules.cpp.

References ACE_TRACE.

00176 {
00177   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::open");
00178   return 0;
00179 }

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 <svc> hook method.

Reimplemented from ACE_Task_Base.

Definition at line 246 of file Stream_Modules.cpp.

References ACE_TRACE, control, ACE_Task_Base::is_writer, ACE_Message_Block::MB_IOCTL, ACE_Message_Block::msg_type, and ACE_Message_Block::release.

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

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 189 of file Stream_Modules.cpp.

References ACE_TRACE.

00190 {
00191   ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::svc");
00192   return -1;
00193 }


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 92 of file Stream_Modules.h.


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