Public Member Functions | Public Attributes | Private Attributes

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, int stype=ACE_Service_Type::STREAM)
 ~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 *module_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 175 of file Service_Types.h.


Constructor & Destructor Documentation

ACE_Stream_Type::ACE_Stream_Type ( void *  s,
const ACE_TCHAR identifier,
u_int  flags = 0,
int  stype = ACE_Service_Type::STREAM 
)

Definition at line 337 of file Service_Types.cpp.

  : ACE_Service_Type_Impl (s, s_name, f, 0, stype),
    head_ (0)
{
  ACE_TRACE ("ACE_Stream_Type::ACE_Stream_Type");
}

ACE_Stream_Type::~ACE_Stream_Type ( void   ) 

Definition at line 347 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Stream_Type::~ACE_Stream_Type");
}


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

{
#if defined (ACE_HAS_DUMP)
  ACE_TRACE ("ACE_Stream_Type::dump");
#endif /* ACE_HAS_DUMP */
}

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

Locate the ACE_Module with mod_name.

Definition at line 446 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Stream_Type::find");

  for (ACE_Module_Type *m = this->head_;
       m != 0;
       m = m->link ())
    if (ACE_OS::strcmp (m->name (), module_name) == 0)
      return m;

  return 0;
}

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

Reimplemented from ACE_Service_Type_Impl.

Definition at line 371 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Stream_Type::fini");
  void *obj = this->object ();
  MT_Stream *str = (MT_Stream *) obj;

  for (ACE_Module_Type *m = this->head_; m != 0;)
  {
    ACE_Module_Type *t = m->link ();

      // Final arg is an indication to *not* delete the Module.
      str->remove (m->name (),
                   MT_Module::M_DELETE_NONE);      
      m = t;
    }
  str->close ();

  return ACE_Service_Type_Impl::fini ();
}

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

Implements ACE_Service_Type_Impl.

Definition at line 353 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Stream_Type::info");
  ACE_TCHAR buf[BUFSIZ];

  ACE_OS::sprintf (buf,
                   ACE_TEXT ("%s\t %s"),
                   this->name (),
                   ACE_TEXT ("# STREAM\n"));

  if (*str == 0 && (*str = ACE_OS::strdup (buf)) == 0)
    return -1;
  else
    ACE_OS::strsncpy (*str, buf, len);
  return static_cast<int> (ACE_OS::strlen (buf));
}

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

Implements ACE_Service_Type_Impl.

Definition at line 305 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Stream_Type::init");
  return 0;
}

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

{
  ACE_TRACE ("ACE_Stream_Type::push");
  void *obj = this->object ();
  MT_Stream *str = (MT_Stream *) obj;

  new_module->link (this->head_);
  this->head_ = new_module;
  obj = new_module->object ();
  return str->push ((MT_Module *) obj);
}

int ACE_Stream_Type::remove ( ACE_Module_Type module  ) 

Search for module and remove it from the ACE_Stream.

Definition at line 394 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Stream_Type::remove");

  ACE_Module_Type *prev = 0;
  void *obj = this->object ();
  MT_Stream *str = (MT_Stream *) obj;
  int result = 0;

  for (ACE_Module_Type *m = this->head_; m != 0; )
    {
      // We need to do this first so we don't bomb out if we delete m!
      ACE_Module_Type *link = m->link ();

      if (m == mod)
        {
          if (prev == 0)
            this->head_ = link;
          else
            prev->link (link);

          // Final arg is an indication to *not* delete the Module.
          if (str->remove (m->name (),
                           MT_Module::M_DELETE_NONE) == -1)
            result = -1;

          // Do not call m->fini (); as this will result in a double delete
          // of the ACE_Module_type when ACE_Service_Repository::fini is called
        }
      else
        prev = m;

      m = link;
    }

  return result;
}

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

Implements ACE_Service_Type_Impl.

Definition at line 325 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Stream_Type::resume");

  for (ACE_Module_Type *m = this->head_;
       m != 0;
       m = m->link ())
    m->resume ();

  return 0;
}

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

Implements ACE_Service_Type_Impl.

Definition at line 312 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Stream_Type::suspend");

  for (ACE_Module_Type *m = this->head_;
       m != 0;
       m = m->link ())
    m->suspend ();

  return 0;
}


Member Data Documentation

Declare the dynamic allocation hooks.

Reimplemented from ACE_Service_Type_Impl.

Definition at line 206 of file Service_Types.h.

Pointer to the head of the ACE_Module list.

Definition at line 210 of file Service_Types.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines