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 157 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 351 of file Service_Types.cpp.

References ACE_TCHAR, and ACE_TRACE.

00354   : ACE_Service_Type_Impl (s, s_name, f),
00355     head_ (0)
00356 {
00357   ACE_TRACE ("ACE_Stream_Type::ACE_Stream_Type");
00358 }

ACE_Stream_Type::~ACE_Stream_Type void   ) 
 

Definition at line 360 of file Service_Types.cpp.

References ACE_TRACE.

00361 {
00362   ACE_TRACE ("ACE_Stream_Type::~ACE_Stream_Type");
00363 }


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 311 of file Service_Types.cpp.

References ACE_TRACE.

00312 {
00313 #if defined (ACE_HAS_DUMP)
00314   ACE_TRACE ("ACE_Stream_Type::dump");
00315 #endif /* ACE_HAS_DUMP */
00316 }

ACE_Module_Type * ACE_Stream_Type::find const ACE_TCHAR mod_name  )  const
 

Locate the ACE_Module with mod_name.

Definition at line 464 of file Service_Types.cpp.

References ACE_TCHAR, ACE_TRACE, ACE_Module_Type::link(), ACE_Service_Type_Impl::name(), and ACE_OS::strcmp().

00465 {
00466   ACE_TRACE ("ACE_Stream_Type::find");
00467 
00468   for (ACE_Module_Type *m = this->head_;
00469        m != 0;
00470        m = m->link ())
00471     if (ACE_OS::strcmp (m->name (), mod_name) == 0)
00472       return m;
00473 
00474   return 0;
00475 }

int ACE_Stream_Type::fini void   )  const [virtual]
 

Reimplemented from ACE_Service_Type_Impl.

Definition at line 384 of file Service_Types.cpp.

References ACE_TRACE, ACE_Stream<>::close(), ACE_Service_Type_Impl::fini(), ACE_Module_Type::fini(), ACE_Module_Type::link(), MT_Stream, ACE_Service_Type_Impl::name(), ACE_Service_Type_Impl::object(), and ACE_Stream<>::remove().

00385 {
00386   ACE_TRACE ("ACE_Stream_Type::fini");
00387   void *obj = this->object ();
00388   MT_Stream *str = (MT_Stream *) obj;
00389 
00390   for (ACE_Module_Type *m = this->head_; m != 0; )
00391     {
00392       ACE_Module_Type *t = m->link ();
00393 
00394       // Final arg is an indication to *not* delete the Module.
00395       str->remove (m->name (),
00396                    MT_Module::M_DELETE_NONE);
00397 
00398       // Finalize the Module (this may delete it, but we don't really
00399       // care since we don't access it again).
00400       m->fini ();
00401       m = t;
00402     }
00403 
00404   str->close ();
00405   return ACE_Service_Type_Impl::fini ();
00406 }

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

Implements ACE_Service_Type_Impl.

Definition at line 366 of file Service_Types.cpp.

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

00367 {
00368   ACE_TRACE ("ACE_Stream_Type::info");
00369   ACE_TCHAR buf[BUFSIZ];
00370 
00371   ACE_OS::sprintf (buf,
00372                    ACE_LIB_TEXT ("%s\t %s"),
00373                    this->name (),
00374                    ACE_LIB_TEXT ("# STREAM\n"));
00375 
00376   if (*str == 0 && (*str = ACE_OS::strdup (buf)) == 0)
00377     return -1;
00378   else
00379     ACE_OS::strsncpy (*str, buf, len);
00380   return static_cast<int> (ACE_OS::strlen (buf));
00381 }

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

Implements ACE_Service_Type_Impl.

Definition at line 319 of file Service_Types.cpp.

References ACE_TCHAR, and ACE_TRACE.

00320 {
00321   ACE_TRACE ("ACE_Stream_Type::init");
00322   return 0;
00323 }

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 451 of file Service_Types.cpp.

References ACE_TRACE, ACE_Module_Type::link(), MT_Module, MT_Stream, ACE_Service_Type_Impl::object(), and ACE_Stream<>::push().

Referenced by ace_yyparse().

00452 {
00453   ACE_TRACE ("ACE_Stream_Type::push");
00454   void *obj = this->object ();
00455   MT_Stream *str = (MT_Stream *) obj;
00456 
00457   new_module->link (this->head_);
00458   this->head_ = new_module;
00459   obj = new_module->object ();
00460   return str->push ((MT_Module *) obj);
00461 }

int ACE_Stream_Type::remove ACE_Module_Type module  ) 
 

Search for module and remove it from the ACE_Stream.

Definition at line 411 of file Service_Types.cpp.

References ACE_TRACE, ACE_Module_Type::fini(), ACE_Module_Type::link(), MT_Stream, ACE_Service_Type_Impl::name(), ACE_Service_Type_Impl::object(), and ACE_Stream<>::remove().

Referenced by ace_yyparse().

00412 {
00413   ACE_TRACE ("ACE_Stream_Type::remove");
00414 
00415   ACE_Module_Type *prev = 0;
00416   void *obj = this->object ();
00417   MT_Stream *str = (MT_Stream *) obj;
00418   int result = 0;
00419 
00420   for (ACE_Module_Type *m = this->head_; m != 0; )
00421     {
00422       // We need to do this first so we don't bomb out if we delete m!
00423       ACE_Module_Type *link = m->link ();
00424 
00425       if (m == mod)
00426         {
00427           if (prev == 0)
00428             this->head_ = link;
00429           else
00430             prev->link (link);
00431 
00432           // Final arg is an indication to *not* delete the Module.
00433           if (str->remove (m->name (),
00434                            MT_Module::M_DELETE_NONE) == -1)
00435             result = -1;
00436 
00437           // This call may end up deleting m, which is ok since we
00438           // don't access it again!
00439           m->fini ();
00440         }
00441       else
00442         prev = m;
00443 
00444       m = link;
00445     }
00446 
00447   return result;
00448 }

int ACE_Stream_Type::resume void   )  const [virtual]
 

Implements ACE_Service_Type_Impl.

Definition at line 339 of file Service_Types.cpp.

References ACE_TRACE, ACE_Module_Type::link(), and ACE_Module_Type::resume().

00340 {
00341   ACE_TRACE ("ACE_Stream_Type::resume");
00342 
00343   for (ACE_Module_Type *m = this->head_;
00344        m != 0;
00345        m = m->link ())
00346     m->resume ();
00347 
00348   return 0;
00349 }

int ACE_Stream_Type::suspend void   )  const [virtual]
 

Implements ACE_Service_Type_Impl.

Definition at line 326 of file Service_Types.cpp.

References ACE_TRACE, ACE_Module_Type::link(), and ACE_Module_Type::suspend().

00327 {
00328   ACE_TRACE ("ACE_Stream_Type::suspend");
00329 
00330   for (ACE_Module_Type *m = this->head_;
00331        m != 0;
00332        m = m->link ())
00333     m->suspend ();
00334 
00335   return 0;
00336 }


Member Data Documentation

ACE_Stream_Type::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_Service_Type_Impl.

Definition at line 187 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 191 of file Service_Types.h.


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