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

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 Methods

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

int remove (ACE_Module_Type *module)
 Search for <module> and remove it from the <ACE_Stream>. More...

ACE_Module_Typefind (const ACE_TCHAR *mod_name) const
 Locate the <ACE_Module> with <mod_name>. 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 Attributes

ACE_Module_Typehead_
 Pointer to the head of the <ACE_Module> list. More...


Detailed Description

Define the methods for handling the configuration of <ACE_Streams>.

Definition at line 158 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 262 of file Service_Types.cpp.

References ACE_TCHAR, and ACE_TRACE.

00265   : ACE_Service_Type_Impl (s, s_name, f),
00266     head_ (0)
00267 {
00268   ACE_TRACE ("ACE_Stream_Type::ACE_Stream_Type");
00269 }

ACE_INLINE ACE_Stream_Type::~ACE_Stream_Type void   
 

Definition at line 61 of file Service_Types.i.

References ACE_TRACE.

00062 {
00063   ACE_TRACE ("ACE_Stream_Type::~ACE_Stream_Type");
00064 }


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

References ACE_TRACE.

00225 {
00226   ACE_TRACE ("ACE_Stream_Type::dump");
00227 }

ACE_Module_Type * ACE_Stream_Type::find const ACE_TCHAR   mod_name const
 

Locate the <ACE_Module> with <mod_name>.

Definition at line 370 of file Service_Types.cpp.

References ACE_TCHAR, ACE_TRACE, head_, ACE_Module_Type::link, ACE_Service_Type_Impl::name, and ACE_OS_String::strcmp.

00371 {
00372   ACE_TRACE ("ACE_Stream_Type::find");
00373 
00374   for (ACE_Module_Type *m = this->head_;
00375        m != 0;
00376        m = m->link ())
00377     if (ACE_OS::strcmp (m->name (), mod_name) == 0)
00378       return m;
00379 
00380   return 0;
00381 }

int ACE_Stream_Type::fini void    const [virtual]
 

Reimplemented from ACE_Service_Type_Impl.

Definition at line 290 of file Service_Types.cpp.

References ACE_TRACE, ACE_Stream< ACE_SYNCH >::close, ACE_Service_Type_Impl::fini, ACE_Module_Type::fini, head_, ACE_Module_Type::link, ACE_Service_Type_Impl::name, ACE_Service_Type_Impl::object, and ACE_Stream< ACE_SYNCH >::remove.

00291 {
00292   ACE_TRACE ("ACE_Stream_Type::fini");
00293   void *obj = this->object ();
00294   MT_Stream *str = (MT_Stream *) obj;
00295 
00296   for (ACE_Module_Type *m = this->head_; m != 0; )
00297     {
00298       ACE_Module_Type *t = m->link ();
00299 
00300       // Final arg is an indication to *not* delete the Module.
00301       str->remove (m->name (),
00302                    MT_Module::M_DELETE_NONE);
00303 
00304       // Finalize the Module (this may delete it, but we don't really
00305       // care since we don't access it again).
00306       m->fini ();
00307       m = t;
00308     }
00309 
00310   str->close ();
00311   return ACE_Service_Type_Impl::fini ();
00312 }

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

Implements ACE_Service_Type_Impl.

Definition at line 272 of file Service_Types.cpp.

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

00273 {
00274   ACE_TRACE ("ACE_Stream_Type::info");
00275   ACE_TCHAR buf[BUFSIZ];
00276 
00277   ACE_OS::sprintf (buf,
00278                    ACE_LIB_TEXT ("%s\t %s"),
00279                    this->name (),
00280                    ACE_LIB_TEXT ("# STREAM\n"));
00281 
00282   if (*str == 0 && (*str = ACE_OS::strdup (buf)) == 0)
00283     return -1;
00284   else
00285     ACE_OS::strsncpy (*str, buf, len);
00286   return ACE_static_cast (int, ACE_OS_String::strlen (buf));
00287 }

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

Implements ACE_Service_Type_Impl.

Definition at line 230 of file Service_Types.cpp.

References ACE_TCHAR, and ACE_TRACE.

00231 {
00232   ACE_TRACE ("ACE_Stream_Type::init");
00233   return 0;
00234 }

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

References ACE_TRACE, head_, ACE_Module_Type::link, ACE_Service_Type_Impl::object, and ACE_Stream< ACE_SYNCH >::push.

Referenced by ace_yyparse.

00358 {
00359   ACE_TRACE ("ACE_Stream_Type::push");
00360   void *obj = this->object ();
00361   MT_Stream *str = (MT_Stream *) obj;
00362 
00363   new_module->link (this->head_);
00364   this->head_ = new_module;
00365   obj = new_module->object ();
00366   return str->push ((MT_Module *) obj);
00367 }

int ACE_Stream_Type::remove ACE_Module_Type   module
 

Search for <module> and remove it from the <ACE_Stream>.

Definition at line 317 of file Service_Types.cpp.

References ACE_TRACE, ACE_Module_Type::fini, head_, ACE_Module_Type::link, ACE_Service_Type_Impl::name, ACE_Service_Type_Impl::object, and ACE_Stream< ACE_SYNCH >::remove.

Referenced by ace_yyparse.

00318 {
00319   ACE_TRACE ("ACE_Stream_Type::remove");
00320 
00321   ACE_Module_Type *prev = 0;
00322   void *obj = this->object ();
00323   MT_Stream *str = (MT_Stream *) obj;
00324   int result = 0;
00325 
00326   for (ACE_Module_Type *m = this->head_; m != 0; )
00327     {
00328       // We need to do this first so we don't bomb out if we delete m!
00329       ACE_Module_Type *link = m->link ();
00330 
00331       if (m == mod)
00332         {
00333           if (prev == 0)
00334             this->head_ = link;
00335           else
00336             prev->link (link);
00337 
00338           // Final arg is an indication to *not* delete the Module.
00339           if (str->remove (m->name (),
00340                            MT_Module::M_DELETE_NONE) == -1)
00341             result = -1;
00342 
00343           // This call may end up deleting m, which is ok since we
00344           // don't access it again!
00345           m->fini ();
00346         }
00347       else
00348         prev = m;
00349 
00350       m = link;
00351     }
00352 
00353   return result;
00354 }

int ACE_Stream_Type::resume void    const [virtual]
 

Implements ACE_Service_Type_Impl.

Definition at line 250 of file Service_Types.cpp.

References ACE_TRACE, head_, ACE_Module_Type::link, and ACE_Module_Type::resume.

00251 {
00252   ACE_TRACE ("ACE_Stream_Type::resume");
00253 
00254   for (ACE_Module_Type *m = this->head_;
00255        m != 0;
00256        m = m->link ())
00257     m->resume ();
00258 
00259   return 0;
00260 }

int ACE_Stream_Type::suspend void    const [virtual]
 

Implements ACE_Service_Type_Impl.

Definition at line 237 of file Service_Types.cpp.

References ACE_TRACE, head_, ACE_Module_Type::link, and ACE_Module_Type::suspend.

00238 {
00239   ACE_TRACE ("ACE_Stream_Type::suspend");
00240 
00241   for (ACE_Module_Type *m = this->head_;
00242        m != 0;
00243        m = m->link ())
00244     m->suspend ();
00245 
00246   return 0;
00247 }


Member Data Documentation

ACE_Stream_Type::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_Service_Type_Impl.

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

Referenced by find, fini, push, remove, resume, and suspend.


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