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

ACE_Service_Type_Impl Class Reference

The abstract base class of the hierarchy that defines the contents of the <ACE_Service_Repository>. The subclasses of this class allow the configuration of <ACE_Service_Objects>, <ACE_Modules>, and <ACE_Streams>. More...

#include <Service_Types.h>

Inheritance diagram for ACE_Service_Type_Impl:

Inheritance graph
[legend]
List of all members.

Public Methods

 ACE_Service_Type_Impl (void *object, const ACE_TCHAR *s_name, u_int flags=0, ACE_Service_Object_Exterminator gobbler=0)
virtual ~ACE_Service_Type_Impl (void)
virtual int suspend (void) const=0
virtual int resume (void) const=0
virtual int init (int argc, ACE_TCHAR *argv[]) const=0
virtual int fini (void) const
virtual int info (ACE_TCHAR **str, size_t len) const=0
void * object (void) const
 The pointer to the service. More...

const ACE_TCHARname (void) const
 Get the name of the service. More...

void name (const ACE_TCHAR *)
 Set the name of the service. More...

void dump (void) const
 Dump the state of an object. More...


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Protected Attributes

const ACE_TCHARname_
 Name of the service. More...

void * obj_
 Pointer to object that implements the service. This actually points to an <ACE_Service_Object>, <ACE_Module>, or <ACE_Stream>. More...

ACE_Service_Object_Exterminator gobbler_
 Destroy function to deallocate obj_. More...

u_int flags_
 Flags that control serivce behavior (particularly deletion). More...


Detailed Description

The abstract base class of the hierarchy that defines the contents of the <ACE_Service_Repository>. The subclasses of this class allow the configuration of <ACE_Service_Objects>, <ACE_Modules>, and <ACE_Streams>.

This class provides the root of the implementation hierarchy of the "Bridge" pattern. It maintains a pointer to the appropriate type of service implementation, i.e., <ACE_Service_Object>, <ACE_Module>, or <ACE_Stream>.

Definition at line 40 of file Service_Types.h.


Constructor & Destructor Documentation

ACE_Service_Type_Impl::ACE_Service_Type_Impl void *    object,
const ACE_TCHAR   s_name,
u_int    flags = 0,
ACE_Service_Object_Exterminator    gobbler = 0
 

Definition at line 26 of file Service_Types.cpp.

References ACE_Service_Object_Exterminator, ACE_TCHAR, ACE_TRACE, and name.

00030   : name_ (0),
00031     obj_ (so),
00032     gobbler_ (gobbler),
00033     flags_ (f)
00034 {
00035   ACE_TRACE ("ACE_Service_Type_Impl::ACE_Service_Type_Impl");
00036   this->name (s_name);
00037 }

ACE_Service_Type_Impl::~ACE_Service_Type_Impl void    [virtual]
 

Definition at line 39 of file Service_Types.cpp.

References ACE_TCHAR, ACE_TRACE, and name_.

00040 {
00041   ACE_TRACE ("ACE_Service_Type_Impl::~ACE_Service_Type_Impl");
00042 
00043   // It's ok to call this, even though we may have already deleted it
00044   // in the fini() method since it would then be NULL.
00045   delete [] (ACE_TCHAR *) this->name_;
00046 }


Member Function Documentation

void ACE_Service_Type_Impl::dump void    const
 

Dump the state of an object.

Reimplemented in ACE_Module_Type.

Definition at line 21 of file Service_Types.cpp.

References ACE_TRACE.

00022 {
00023   ACE_TRACE ("ACE_Service_Type_Impl::dump");
00024 }

int ACE_Service_Type_Impl::fini void    const [virtual]
 

Reimplemented in ACE_Service_Object_Type.

Definition at line 49 of file Service_Types.cpp.

References ACE_BIT_ENABLED, ACE_DEBUG, ACE_LIB_TEXT, ACE_TCHAR, ACE_TRACE, ACE::debug, ACE_Service_Type::DELETE_OBJ, ACE_Service_Type::DELETE_THIS, gobbler_, LM_DEBUG, and name_.

Referenced by ACE_Service_Object_Type::fini, ACE_Stream_Type::fini, ACE_Module_Type::fini, and ACE_Service_Type::fini.

00050 {
00051   ACE_TRACE ("ACE_Service_Type_Impl::fini");
00052   if (ACE::debug ())
00053     ACE_DEBUG ((LM_DEBUG,
00054                 ACE_LIB_TEXT ("destroying %s, flags = %d\n"),
00055                 this->name_,
00056                 this->flags_));
00057 
00058   delete [] (ACE_TCHAR *) this->name_;
00059   ((ACE_Service_Type_Impl *) this)->name_ = 0;
00060 
00061   if (ACE_BIT_ENABLED (this->flags_,
00062                        ACE_Service_Type::DELETE_OBJ))
00063     {
00064       if (gobbler_ != 0)
00065         gobbler_ (this->object ());
00066       else
00067         // Cast to remove const-ness.
00068         operator delete ((void *) this->object ());
00069     }
00070 
00071   if (ACE_BIT_ENABLED (this->flags_,
00072                        ACE_Service_Type::DELETE_THIS))
00073     delete (ACE_Service_Type_Impl *) this;
00074 
00075   return 0;
00076 }

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

Implemented in ACE_Service_Object_Type.

Referenced by ACE_Service_Manager::list_services.

virtual int ACE_Service_Type_Impl::init int    argc,
ACE_TCHAR   argv[]
const [pure virtual]
 

Implemented in ACE_Service_Object_Type.

Referenced by ACE_Service_Config::initialize.

ACE_INLINE void ACE_Service_Type_Impl::name const ACE_TCHAR  
 

Set the name of the service.

Definition at line 19 of file Service_Types.i.

References ACE_TCHAR, ACE_TRACE, name_, and ACE::strnew.

00020 {
00021   ACE_TRACE ("ACE_Service_Type_Impl::name");
00022 
00023   delete [] (ACE_TCHAR *) this->name_;
00024   this->name_ = ACE::strnew (n);
00025 }

ACE_INLINE const ACE_TCHAR * ACE_Service_Type_Impl::name void    const
 

Get the name of the service.

Definition at line 12 of file Service_Types.i.

References ACE_TRACE, and name_.

Referenced by ACE_Service_Type_Impl, ACE_Stream_Type::find, ACE_Stream_Type::fini, and ACE_Stream_Type::remove.

00013 {
00014   ACE_TRACE ("ACE_Service_Type_Impl::name");
00015   return this->name_;
00016 }

ACE_INLINE void * ACE_Service_Type_Impl::object void    const
 

The pointer to the service.

Definition at line 5 of file Service_Types.i.

References ACE_TRACE, and obj_.

Referenced by ace_get_module, ACE_Service_Object_Type::fini, ACE_Stream_Type::fini, ACE_Module_Type::fini, ACE_Service_Object_Type::info, ACE_Module_Type::init, ACE_Service_Object_Type::init, ACE_Dynamic_Service_Base::instance, ACE_Stream_Type::push, ACE_Stream_Type::remove, ACE_Service_Object_Type::resume, ACE_Module_Type::resume, ACE_Service_Object_Type::suspend, and ACE_Module_Type::suspend.

00006 {
00007   ACE_TRACE ("ACE_Service_Type_Impl::object");
00008   return this->obj_;
00009 }

virtual int ACE_Service_Type_Impl::resume void    const [pure virtual]
 

Implemented in ACE_Service_Object_Type.

Referenced by ACE_Service_Type::resume.

virtual int ACE_Service_Type_Impl::suspend void    const [pure virtual]
 

Implemented in ACE_Service_Object_Type.

Referenced by ACE_Service_Type::suspend.


Member Data Documentation

ACE_Service_Type_Impl::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented in ACE_Module_Type.

Definition at line 70 of file Service_Types.h.

u_int ACE_Service_Type_Impl::flags_ [protected]
 

Flags that control serivce behavior (particularly deletion).

Definition at line 84 of file Service_Types.h.

ACE_Service_Object_Exterminator ACE_Service_Type_Impl::gobbler_ [protected]
 

Destroy function to deallocate obj_.

Definition at line 81 of file Service_Types.h.

Referenced by fini.

const ACE_TCHAR* ACE_Service_Type_Impl::name_ [protected]
 

Name of the service.

Definition at line 74 of file Service_Types.h.

Referenced by fini, name, and ~ACE_Service_Type_Impl.

void* ACE_Service_Type_Impl::obj_ [protected]
 

Pointer to object that implements the service. This actually points to an <ACE_Service_Object>, <ACE_Module>, or <ACE_Stream>.

Definition at line 78 of file Service_Types.h.

Referenced by object.


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