ACE_Stream_Type Class Reference

Define the methods for handling the configuration of ACE_Streams. More...

#include <Service_Types.h>

Inheritance diagram for ACE_Stream_Type:

Inheritance graph
[legend]
Collaboration diagram for ACE_Stream_Type:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_Stream_Type (void *s, const ACE_TCHAR *identifier, u_int flags=0)
 ~ACE_Stream_Type (void)
virtual int suspend (void) const
virtual int resume (void) const
virtual int init (int argc, ACE_TCHAR *argv[]) const
virtual int fini (void) const
virtual int info (ACE_TCHAR **str, size_t len) const
int push (ACE_Module_Type *new_module)
 Add a new ACE_Module to the top of the ACE_Stream.
int remove (ACE_Module_Type *module)
 Search for module and remove it from the ACE_Stream.
ACE_Module_Typefind (const ACE_TCHAR *mod_name) const
 Locate the ACE_Module with mod_name.
void dump (void) const
 Dump the state of an object.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Private Attributes

ACE_Module_Typehead_
 Pointer to the head of the ACE_Module list.

Detailed Description

Define the methods for handling the configuration of ACE_Streams.

Definition at line 161 of file Service_Types.h.


Constructor & Destructor Documentation

ACE_Stream_Type::ACE_Stream_Type ( void *  s,
const ACE_TCHAR identifier,
u_int  flags = 0 
)

Definition at line 325 of file Service_Types.cpp.

References ACE_TRACE.

00328   : ACE_Service_Type_Impl (s, s_name, f),
00329     head_ (0)
00330 {
00331   ACE_TRACE ("ACE_Stream_Type::ACE_Stream_Type");
00332 }

ACE_Stream_Type::~ACE_Stream_Type ( void   ) 

Definition at line 334 of file Service_Types.cpp.

References ACE_TRACE.

00335 {
00336   ACE_TRACE ("ACE_Stream_Type::~ACE_Stream_Type");
00337 }


Member Function Documentation

void ACE_Stream_Type::dump ( void   )  const

Dump the state of an object.

Reimplemented from ACE_Service_Type_Impl.

Definition at line 285 of file Service_Types.cpp.

References ACE_TRACE.

00286 {
00287 #if defined (ACE_HAS_DUMP)
00288   ACE_TRACE ("ACE_Stream_Type::dump");
00289 #endif /* ACE_HAS_DUMP */
00290 }

ACE_Module_Type * ACE_Stream_Type::find ( const ACE_TCHAR mod_name  )  const

Locate the ACE_Module with mod_name.

Definition at line 438 of file Service_Types.cpp.

References ACE_TRACE, and ACE_OS::strcmp().

00439 {
00440   ACE_TRACE ("ACE_Stream_Type::find");
00441 
00442   for (ACE_Module_Type *m = this->head_;
00443        m != 0;
00444        m = m->link ())
00445     if (ACE_OS::strcmp (m->name (), mod_name) == 0)
00446       return m;
00447 
00448   return 0;
00449 }

int ACE_Stream_Type::fini ( void   )  const [virtual]

Reimplemented from ACE_Service_Type_Impl.

Definition at line 358 of file Service_Types.cpp.

References ACE_TRACE, ACE_Service_Type_Impl::fini(), ACE_Module_Base::M_DELETE_NONE, MT_Stream, and ACE_Service_Type_Impl::object().

00359 {
00360   ACE_TRACE ("ACE_Stream_Type::fini");
00361   void *obj = this->object ();
00362   MT_Stream *str = (MT_Stream *) obj;
00363 
00364   for (ACE_Module_Type *m = this->head_; m != 0; )
00365     {
00366       ACE_Module_Type *t = m->link ();
00367 
00368       // Final arg is an indication to *not* delete the Module.
00369       str->remove (m->name (),
00370                    MT_Module::M_DELETE_NONE);
00371 
00372       // Finalize the Module (this may delete it, but we don't really
00373       // care since we don't access it again).
00374       m->fini ();
00375       m = t;
00376     }
00377 
00378   str->close ();
00379   return ACE_Service_Type_Impl::fini ();
00380 }

int ACE_Stream_Type::info ( ACE_TCHAR **  str,
size_t  len 
) const [virtual]

Implements ACE_Service_Type_Impl.

Definition at line 340 of file Service_Types.cpp.

References ACE_TEXT, ACE_TRACE, ACE_OS::sprintf(), ACE_OS::strdup(), ACE_OS::strlen(), and ACE_OS::strsncpy().

00341 {
00342   ACE_TRACE ("ACE_Stream_Type::info");
00343   ACE_TCHAR buf[BUFSIZ];
00344 
00345   ACE_OS::sprintf (buf,
00346                    ACE_TEXT ("%s\t %s"),
00347                    this->name (),
00348                    ACE_TEXT ("# STREAM\n"));
00349 
00350   if (*str == 0 && (*str = ACE_OS::strdup (buf)) == 0)
00351     return -1;
00352   else
00353     ACE_OS::strsncpy (*str, buf, len);
00354   return static_cast<int> (ACE_OS::strlen (buf));
00355 }

int ACE_Stream_Type::init ( int  argc,
ACE_TCHAR argv[] 
) const [virtual]

Implements ACE_Service_Type_Impl.

Definition at line 293 of file Service_Types.cpp.

References ACE_TRACE.

00294 {
00295   ACE_TRACE ("ACE_Stream_Type::init");
00296   return 0;
00297 }

int ACE_Stream_Type::push ( ACE_Module_Type new_module  ) 

Add a new ACE_Module to the top of the ACE_Stream.

Definition at line 425 of file Service_Types.cpp.

References ACE_TRACE, head_, ACE_Module_Type::link(), MT_Stream, and ACE_Service_Type_Impl::object().

00426 {
00427   ACE_TRACE ("ACE_Stream_Type::push");
00428   void *obj = this->object ();
00429   MT_Stream *str = (MT_Stream *) obj;
00430 
00431   new_module->link (this->head_);
00432   this->head_ = new_module;
00433   obj = new_module->object ();
00434   return str->push ((MT_Module *) obj);
00435 }

int ACE_Stream_Type::remove ( ACE_Module_Type module  ) 

Search for module and remove it from the ACE_Stream.

Definition at line 385 of file Service_Types.cpp.

References ACE_TRACE, ACE_Module_Type::fini(), head_, ACE_Module_Type::link(), ACE_Module_Base::M_DELETE_NONE, MT_Stream, and ACE_Service_Type_Impl::object().

00386 {
00387   ACE_TRACE ("ACE_Stream_Type::remove");
00388 
00389   ACE_Module_Type *prev = 0;
00390   void *obj = this->object ();
00391   MT_Stream *str = (MT_Stream *) obj;
00392   int result = 0;
00393 
00394   for (ACE_Module_Type *m = this->head_; m != 0; )
00395     {
00396       // We need to do this first so we don't bomb out if we delete m!
00397       ACE_Module_Type *link = m->link ();
00398 
00399       if (m == mod)
00400         {
00401           if (prev == 0)
00402             this->head_ = link;
00403           else
00404             prev->link (link);
00405 
00406           // Final arg is an indication to *not* delete the Module.
00407           if (str->remove (m->name (),
00408                            MT_Module::M_DELETE_NONE) == -1)
00409             result = -1;
00410 
00411           // This call may end up deleting m, which is ok since we
00412           // don't access it again!
00413           m->fini ();
00414         }
00415       else
00416         prev = m;
00417 
00418       m = link;
00419     }
00420 
00421   return result;
00422 }

int ACE_Stream_Type::resume ( void   )  const [virtual]

Implements ACE_Service_Type_Impl.

Definition at line 313 of file Service_Types.cpp.

References ACE_TRACE.

00314 {
00315   ACE_TRACE ("ACE_Stream_Type::resume");
00316 
00317   for (ACE_Module_Type *m = this->head_;
00318        m != 0;
00319        m = m->link ())
00320     m->resume ();
00321 
00322   return 0;
00323 }

int ACE_Stream_Type::suspend ( void   )  const [virtual]

Implements ACE_Service_Type_Impl.

Definition at line 300 of file Service_Types.cpp.

References ACE_TRACE.

00301 {
00302   ACE_TRACE ("ACE_Stream_Type::suspend");
00303 
00304   for (ACE_Module_Type *m = this->head_;
00305        m != 0;
00306        m = m->link ())
00307     m->suspend ();
00308 
00309   return 0;
00310 }


Member Data Documentation

ACE_Stream_Type::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

Reimplemented from ACE_Service_Type_Impl.

Definition at line 191 of file Service_Types.h.

ACE_Module_Type* ACE_Stream_Type::head_ [private]

Pointer to the head of the ACE_Module list.

Definition at line 195 of file Service_Types.h.

Referenced by push(), and remove().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:35:42 2010 for ACE by  doxygen 1.4.7