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)
 ~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 121 of file Service_Types.h.


Constructor & Destructor Documentation

ACE_Module_Type::ACE_Module_Type ( void *  m,
const ACE_TCHAR identifier,
u_int  flags = 0 
)

Definition at line 165 of file Service_Types.cpp.

References ACE_TRACE.

00168   : ACE_Service_Type_Impl (m, m_name, f)
00169 {
00170   ACE_TRACE ("ACE_Module_Type::ACE_Module_Type");
00171 }

ACE_Module_Type::~ACE_Module_Type ( void   ) 

Definition at line 173 of file Service_Types.cpp.

References ACE_TRACE.

00174 {
00175   ACE_TRACE ("ACE_Module_Type::~ACE_Module_Type");
00176 }


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

References ACE_TRACE.

00159 {
00160 #if defined (ACE_HAS_DUMP)
00161   ACE_TRACE ("ACE_Module_Type::dump");
00162 #endif /* ACE_HAS_DUMP */
00163 }

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

Reimplemented from ACE_Service_Type_Impl.

Definition at line 230 of file Service_Types.cpp.

References ACE_TRACE, ACE_Module<>::close(), ACE_Service_Type_Impl::fini(), ACE_Shared_Object::fini(), ACE_Module_Base::M_DELETE, ACE_Service_Type_Impl::object(), ACE_Module<>::reader(), and ACE_Module<>::writer().

Referenced by ACE_Stream_Type::remove().

00231 {
00232   ACE_TRACE ("ACE_Module_Type::fini");
00233 
00234   void *obj = this->object ();
00235   MT_Module *mod = (MT_Module *) obj;
00236   MT_Task *reader = mod->reader ();
00237   MT_Task *writer = mod->writer ();
00238 
00239   if (reader != 0)
00240     reader->fini ();
00241 
00242   if (writer != 0)
00243     writer->fini ();
00244 
00245   // Close the module and delete the memory.
00246   mod->close (MT_Module::M_DELETE);
00247   return ACE_Service_Type_Impl::fini ();
00248 }

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

Implements ACE_Service_Type_Impl.

Definition at line 251 of file Service_Types.cpp.

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

00252 {
00253   ACE_TRACE ("ACE_Module_Type::info");
00254   ACE_TCHAR buf[BUFSIZ];
00255 
00256   ACE_OS::sprintf (buf,
00257                    ACE_TEXT ("%s\t %s"),
00258                    this->name (),
00259                    ACE_TEXT ("# ACE_Module\n"));
00260 
00261   if (*str == 0 && (*str = ACE_OS::strdup (buf)) == 0)
00262     return -1;
00263   else
00264     ACE_OS::strsncpy (*str, buf, len);
00265   return static_cast<int> (ACE_OS::strlen (buf));
00266 }

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

Implements ACE_Service_Type_Impl.

Definition at line 179 of file Service_Types.cpp.

References ACE_TRACE, ACE_Shared_Object::init(), ACE_Service_Type_Impl::object(), ACE_Module<>::reader(), and ACE_Module<>::writer().

00180 {
00181   ACE_TRACE ("ACE_Module_Type::init");
00182   void *obj = this->object ();
00183   MT_Module *mod = (MT_Module *) obj;
00184   MT_Task *reader = mod->reader ();
00185   MT_Task *writer = mod->writer ();
00186 
00187   if (reader->init (argc, argv) == -1
00188       || writer->init (argc, argv) == -1)
00189     return -1;
00190   else
00191     return 0;
00192 }

void ACE_Module_Type::link ( ACE_Module_Type  ) 

Set the link pointer.

Definition at line 269 of file Service_Types.cpp.

References ACE_TRACE, and link_.

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

ACE_Module_Type * ACE_Module_Type::link ( void   )  const

Get the link pointer.

Definition at line 276 of file Service_Types.cpp.

References ACE_TRACE, and link_.

Referenced by ACE_Stream_Type::push(), and ACE_Stream_Type::remove().

00277 {
00278   ACE_TRACE ("ACE_Module_Type::link");
00279   return this->link_;
00280 }

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

Implements ACE_Service_Type_Impl.

Definition at line 211 of file Service_Types.cpp.

References ACE_TRACE, ACE_Service_Type_Impl::object(), ACE_Module<>::reader(), ACE_Task_Base::resume(), and ACE_Module<>::writer().

00212 {
00213   ACE_TRACE ("ACE_Module_Type::resume");
00214   void *obj = this->object ();
00215   MT_Module *mod = (MT_Module *) obj;
00216   MT_Task *reader = mod->reader ();
00217   MT_Task *writer = mod->writer ();
00218 
00219   if (reader->resume () == -1
00220       || writer->resume () == -1)
00221     return -1;
00222   else
00223     return 0;
00224 }

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

Implements ACE_Service_Type_Impl.

Definition at line 195 of file Service_Types.cpp.

References ACE_TRACE, ACE_Service_Type_Impl::object(), ACE_Module<>::reader(), ACE_Task_Base::suspend(), and ACE_Module<>::writer().

00196 {
00197   ACE_TRACE ("ACE_Module_Type::suspend");
00198   void *obj = this->object ();
00199   MT_Module *mod = (MT_Module *) obj;
00200   MT_Task *reader = mod->reader ();
00201   MT_Task *writer = mod->writer ();
00202 
00203   if (reader->suspend () == -1
00204       || writer->suspend () == -1)
00205     return -1;
00206   else
00207     return 0;
00208 }


Member Data Documentation

ACE_Module_Type::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

Reimplemented from ACE_Service_Type_Impl.

Definition at line 148 of file Service_Types.h.

ACE_Module_Type* ACE_Module_Type::link_ [private]

Pointer to the next ACE_Module_Type in an ACE_Stream_Type.

Definition at line 152 of file Service_Types.h.

Referenced by link().


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