Public Member Functions | Public Attributes | Private Attributes

ACE_Module_Type Class Reference

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

#include <Service_Types.h>

Inheritance diagram for ACE_Module_Type:
Inheritance graph
[legend]
Collaboration diagram for ACE_Module_Type:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ACE_Module_Type (void *m, const ACE_TCHAR *identifier, u_int flags=0, int stype=ACE_Service_Type::MODULE)
 ~ACE_Module_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
ACE_Module_Typelink (void) const
 Get the link pointer.
void link (ACE_Module_Type *)
 Set the link pointer.
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_Typelink_
 Pointer to the next ACE_Module_Type in an ACE_Stream_Type.

Detailed Description

Define the methods for handling the configuration of ACE_Modules.

Definition at line 134 of file Service_Types.h.


Constructor & Destructor Documentation

ACE_Module_Type::ACE_Module_Type ( void *  m,
const ACE_TCHAR identifier,
u_int  flags = 0,
int  stype = ACE_Service_Type::MODULE 
)

Definition at line 168 of file Service_Types.cpp.

  : ACE_Service_Type_Impl (m, m_name, f, 0, stype)
{
  ACE_TRACE ("ACE_Module_Type::ACE_Module_Type");
}

ACE_Module_Type::~ACE_Module_Type ( void   ) 

Definition at line 177 of file Service_Types.cpp.

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


Member Function Documentation

void ACE_Module_Type::dump ( void   )  const

Dump the state of an object.

Reimplemented from ACE_Service_Type_Impl.

Definition at line 161 of file Service_Types.cpp.

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

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

Reimplemented from ACE_Service_Type_Impl.

Definition at line 243 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Module_Type::fini");
  void *obj = this->object ();
  MT_Module *mod = (MT_Module *) obj;
  MT_Task *reader = mod->reader ();
  MT_Task *writer = mod->writer ();

  if (reader != 0)
    reader->fini ();

  if (writer != 0)
    writer->fini ();

  // Close the module and delete the memory.
  mod->close (MT_Module::M_DELETE);
  return ACE_Service_Type_Impl::fini ();
}

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

Implements ACE_Service_Type_Impl.

Definition at line 263 of file Service_Types.cpp.

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

  ACE_OS::sprintf (buf,
                   ACE_TEXT ("%s\t %s"),
                   this->name (),
                   ACE_TEXT ("# ACE_Module\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_Module_Type::init ( int  argc,
ACE_TCHAR argv[] 
) const [virtual]

Implements ACE_Service_Type_Impl.

Definition at line 183 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Module_Type::init");
  void *obj = this->object ();
  MT_Module *mod = (MT_Module *) obj;
  //
  // Change the Module's name to what's in the svc.conf file.
  // We must do this so the names match up so everything shuts
  // down properly during the call to ACE_Stream_Type::fini
  // which calls MT_Stream::remove([name]) for all the modules.
  // If the calls to remove fail, we end up with a double delete
  // during shutdown. Bugzilla #3847
  //
  mod->name (this->name_);
  MT_Task *reader = mod->reader ();
  MT_Task *writer = mod->writer ();

  if (reader->init (argc, argv) == -1
      || writer->init (argc, argv) == -1)
    return -1;
  else
    return 0;
}

void ACE_Module_Type::link ( ACE_Module_Type n  ) 

Set the link pointer.

Definition at line 281 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Module_Type::link");
  this->link_ = n;
}

ACE_Module_Type * ACE_Module_Type::link ( void   )  const

Get the link pointer.

Definition at line 288 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Module_Type::link");
  return this->link_;
}

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

Implements ACE_Service_Type_Impl.

Definition at line 224 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Module_Type::resume");
  void *obj = this->object ();
  MT_Module *mod = (MT_Module *) obj;
  MT_Task *reader = mod->reader ();
  MT_Task *writer = mod->writer ();

  if (reader->resume () == -1
      || writer->resume () == -1)
    return -1;
  else
    return 0;
}

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

Implements ACE_Service_Type_Impl.

Definition at line 208 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Module_Type::suspend");
  void *obj = this->object ();
  MT_Module *mod = (MT_Module *) obj;
  MT_Task *reader = mod->reader ();
  MT_Task *writer = mod->writer ();

  if (reader->suspend () == -1
      || writer->suspend () == -1)
    return -1;
  else
    return 0;
}


Member Data Documentation

Declare the dynamic allocation hooks.

Reimplemented from ACE_Service_Type_Impl.

Definition at line 162 of file Service_Types.h.

Pointer to the next ACE_Module_Type in an ACE_Stream_Type.

Definition at line 166 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