Public Member Functions | Public Attributes | Protected Attributes

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 Member Functions

 ACE_Service_Type_Impl (void *object, const ACE_TCHAR *s_name, u_int flags=0, ACE_Service_Object_Exterminator gobbler=0, int stype=ACE_Service_Type::INVALID_TYPE)
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.
const ACE_TCHARname (void) const
 Get the name of the service.
void name (const ACE_TCHAR *)
 Set the name of the service.
void dump (void) const
 Dump the state of an object.
int service_type (void) const
 get the service_type of this service
void service_type (int stype)
 set the service_type of this service

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Protected Attributes

const ACE_TCHARname_
 Name of the service.
void * obj_
ACE_Service_Object_Exterminator gobbler_
 Destroy function to deallocate obj_.
u_int flags_
 Flags that control serivce behavior (particularly deletion).
int service_type_

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 39 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,
int  stype = ACE_Service_Type::INVALID_TYPE 
)

Definition at line 35 of file Service_Types.cpp.

  : name_ (0),
    obj_ (so),
    gobbler_ (gobbler),
    flags_ (f),
  service_type_ (stype)
{
  ACE_TRACE ("ACE_Service_Type_Impl::ACE_Service_Type_Impl");
  this->name (s_name);
}

ACE_Service_Type_Impl::~ACE_Service_Type_Impl ( void   )  [virtual]

Definition at line 50 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Service_Type_Impl::~ACE_Service_Type_Impl");

  // It's ok to call this, even though we may have already deleted it
  // in the fini() method since it would then be NULL.
  delete [] const_cast <ACE_TCHAR *> (this->name_);
}


Member Function Documentation

void ACE_Service_Type_Impl::dump ( void   )  const

Dump the state of an object.

Reimplemented in ACE_Module_Type, and ACE_Stream_Type.

Definition at line 28 of file Service_Types.cpp.

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

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

Reimplemented in ACE_Service_Object_Type, ACE_Module_Type, and ACE_Stream_Type.

Definition at line 60 of file Service_Types.cpp.

{
  ACE_TRACE ("ACE_Service_Type_Impl::fini");

  delete [] const_cast <ACE_TCHAR *> (this->name_);
  (const_cast <ACE_Service_Type_Impl *> (this))->name_ = 0;

  if (ACE_BIT_ENABLED (this->flags_,
                       ACE_Service_Type::DELETE_OBJ))
    {
      if (gobbler_ != 0)
        gobbler_ (this->object ());
      else
        // Cast to remove const-ness.
        operator delete ((void *) this->object ());
    }

  if (ACE_BIT_ENABLED (this->flags_,
                       ACE_Service_Type::DELETE_THIS))
    delete const_cast <ACE_Service_Type_Impl *> (this);

  return 0;
}

virtual int ACE_Service_Type_Impl::info ( ACE_TCHAR **  str,
size_t  len 
) const [pure virtual]
virtual int ACE_Service_Type_Impl::init ( int  argc,
ACE_TCHAR argv[] 
) const [pure virtual]
void ACE_Service_Type_Impl::name ( const ACE_TCHAR n  ) 

Set the name of the service.

Definition at line 24 of file Service_Types.inl.

{
  ACE_TRACE ("ACE_Service_Type_Impl::name");

  ACE::strdelete (const_cast<ACE_TCHAR*> (this->name_));
  this->name_ = ACE::strnew (n);
}

const ACE_TCHAR * ACE_Service_Type_Impl::name ( void   )  const

Get the name of the service.

Definition at line 17 of file Service_Types.inl.

{
  ACE_TRACE ("ACE_Service_Type_Impl::name");
  return this->name_;
}

void * ACE_Service_Type_Impl::object ( void   )  const

The pointer to the service.

Definition at line 10 of file Service_Types.inl.

{
  ACE_TRACE ("ACE_Service_Type_Impl::object");
  return this->obj_;
}

virtual int ACE_Service_Type_Impl::resume ( void   )  const [pure virtual]
void ACE_Service_Type_Impl::service_type ( int  stype  ) 

set the service_type of this service

Definition at line 39 of file Service_Types.inl.

{
  service_type_ = stype;
}

int ACE_Service_Type_Impl::service_type ( void   )  const

get the service_type of this service

Definition at line 33 of file Service_Types.inl.

{
  return service_type_;
}

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

Member Data Documentation

Declare the dynamic allocation hooks.

Reimplemented in ACE_Module_Type, and ACE_Stream_Type.

Definition at line 76 of file Service_Types.h.

u_int ACE_Service_Type_Impl::flags_ [protected]

Flags that control serivce behavior (particularly deletion).

Definition at line 90 of file Service_Types.h.

Destroy function to deallocate obj_.

Definition at line 87 of file Service_Types.h.

Name of the service.

Definition at line 80 of file Service_Types.h.

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 84 of file Service_Types.h.

type of this service Used to properly manage the lifecycle of ACE_Modules and ACE_Streams during shutdown

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