ACE_Service_Type Class Reference

Keeps track of information related to the various ACE_Service_Type_Impl subclasses. More...

#include <Service_Object.h>

Collaboration diagram for ACE_Service_Type:

Collaboration graph
[legend]
List of all members.

Public Types

enum  { DELETE_OBJ = 1, DELETE_THIS = 2 }
enum  { SERVICE_OBJECT = ACE_SVC_OBJ_T, MODULE = ACE_MODULE_T, STREAM = ACE_STREAM_T, INVALID_TYPE = -1 }

Public Member Functions

 ACE_Service_Type (const ACE_TCHAR *n, ACE_Service_Type_Impl *o, const ACE_DLL &dll, int active)
 ACE_Service_Type (const ACE_TCHAR *n, ACE_Service_Type_Impl *o, ACE_SHLIB_HANDLE handle, int active)
 ~ACE_Service_Type (void)
const ACE_TCHARname (void) const
void name (const ACE_TCHAR *)
const ACE_Service_Type_Impltype (void) const
void type (const ACE_Service_Type_Impl *, int active=1)
bool is_forward_declaration (void) const
int suspend (void) const
int resume (void) const
int active (void) const
void active (int)
int fini (void)
 Calls on .

int fini_called (void) const
 Check if the service has been fini'ed.

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

const ACE_DLLdll (void) const
 Get to the DLL's implentation.

void dll (const ACE_DLL &)
 Sets the DLL.


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Private Attributes

const ACE_TCHARname_
 Humanly readible name of svc.

const ACE_Service_Type_Impltype_
 Pointer to C++ object that implements the svc.

ACE_DLL dll_
int active_
 1 if svc is currently active, otherwise 0.

int fini_already_called_
 1 if on has already been called, otherwise 0.


Detailed Description

Keeps track of information related to the various ACE_Service_Type_Impl subclasses.

This class acts as the interface of the "Bridge" pattern.

Definition at line 74 of file Service_Object.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
DELETE_OBJ  Delete the payload object.
DELETE_THIS  Delete the enclosing object.

Definition at line 77 of file Service_Object.h.

00078   {
00079     /// Delete the payload object.
00080     DELETE_OBJ = 1,
00081 
00082     /// Delete the enclosing object.
00083     DELETE_THIS = 2
00084   };

anonymous enum
 

Enumeration values:
SERVICE_OBJECT 
MODULE 
STREAM 
INVALID_TYPE 

Definition at line 86 of file Service_Object.h.

00087     {
00088       SERVICE_OBJECT = ACE_SVC_OBJ_T,
00089       MODULE = ACE_MODULE_T,
00090       STREAM = ACE_STREAM_T,
00091       INVALID_TYPE = -1
00092     };


Constructor & Destructor Documentation

ACE_Service_Type::ACE_Service_Type const ACE_TCHAR n,
ACE_Service_Type_Impl o,
const ACE_DLL dll,
int  active
 

Definition at line 50 of file Service_Object.cpp.

References ACE_TCHAR, ACE_TRACE, and name().

00054   : name_ (0),
00055     type_ (t),
00056     dll_ (dll),
00057     active_ (active),
00058     fini_already_called_ (0)
00059 {
00060   ACE_TRACE ("ACE_Service_Type::ACE_Service_Type");
00061   this->name (n);
00062 }

ACE_Service_Type::ACE_Service_Type const ACE_TCHAR n,
ACE_Service_Type_Impl o,
ACE_SHLIB_HANDLE  handle,
int  active
 

Definition at line 64 of file Service_Object.cpp.

References ACE_SHLIB_HANDLE, ACE_TCHAR, ACE_TRACE, dll_, name(), and ACE_DLL::set_handle().

00068   : name_ (0),
00069     type_ (t),
00070     active_ (active),
00071     fini_already_called_ (0)
00072 {
00073   ACE_TRACE ("ACE_Service_Type::ACE_Service_Type");
00074   this->dll_.set_handle (handle);
00075   this->name (n);
00076 }

ACE_Service_Type::~ACE_Service_Type void   ) 
 

Definition at line 78 of file Service_Object.cpp.

References ACE_TRACE, and fini().

00079 {
00080   ACE_TRACE ("ACE_Service_Type::~ACE_Service_Type");
00081   this->fini ();
00082 
00083   delete [] const_cast <ACE_TCHAR *> (this->name_);
00084 }


Member Function Documentation

ACE_INLINE void ACE_Service_Type::active int   ) 
 

Definition at line 53 of file Service_Object.inl.

References ACE_TRACE.

00054 {
00055   ACE_TRACE ("ACE_Service_Type::active");
00056   this->active_ = turnon;
00057 }

ACE_INLINE int ACE_Service_Type::active void   )  const
 

Definition at line 46 of file Service_Object.inl.

References ACE_TRACE.

Referenced by ACE_Service_Repository::fini(), ACE_Service_Repository::insert(), ACE_Service_Manager::list_services(), and ACE_Service_Type_Dynamic_Guard::~ACE_Service_Type_Dynamic_Guard().

00047 {
00048   ACE_TRACE ("ACE_Service_Type::active");
00049   return this->active_ != 0;
00050 }

ACE_INLINE void ACE_Service_Type::dll const ACE_DLL  ) 
 

Sets the DLL.

Definition at line 72 of file Service_Object.inl.

References ACE_INLINE, ACE_TRACE, and dll_.

00073 {
00074   ACE_TRACE ("ACE_Service_Type::dll");
00075   this->dll_ = adll;
00076 }

ACE_INLINE const ACE_DLL & ACE_Service_Type::dll void   )  const
 

Get to the DLL's implentation.

Definition at line 66 of file Service_Object.inl.

References ACE_INLINE, ACE_TRACE, and dll_.

Referenced by ACE_Dynamic_Service_Dependency::init(), ACE_Service_Repository::relocate_i(), and ACE_Service_Type_Dynamic_Guard::~ACE_Service_Type_Dynamic_Guard().

00067 {
00068   ACE_TRACE ("ACE_Service_Type::dll");
00069   return this->dll_;
00070 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_Service_Type::dump void   )  const
 

Dump the state of an object.

Definition at line 29 of file Service_Object.cpp.

References ACE_TRACE, and ACE_OS::fprintf().

Referenced by ACE_Dynamic_Service_Dependency::init().

00030 {
00031 #if defined (ACE_HAS_DUMP)
00032   ACE_TRACE ("ACE_Service_Type::dump");
00033 #endif /* ACE_HAS_DUMP */
00034 
00035 
00036   // Using printf, since the log facility may not have been
00037   // initialized yet. Using a "//" prefix, in case the executable
00038   // happens to be a code generator and the output gets embedded in
00039   // the generated C++ code.
00040   ACE_OS::fprintf(stderr,
00041                   "// [ST] dump, this=%p, name=%s, type=%p, so=%p, active=%d\n",
00042                   this,
00043                   this->name_,
00044                   this->type_,
00045                   (this->type_ != 0) ? this->type_->object () : 0,
00046                   this->active_);
00047 
00048 }

int ACE_Service_Type::fini void   ) 
 

Calls on .

Definition at line 87 of file Service_Object.cpp.

References ACE_DLL::close(), dll_, ACE_Service_Type_Impl::fini(), and fini_already_called_.

Referenced by ACE_Service_Repository::fini(), and ~ACE_Service_Type().

00088 {
00089   if (this->fini_already_called_)
00090     return 0;
00091 
00092   this->fini_already_called_ = 1;
00093 
00094   if (this->type_ == 0)
00095     {
00096       // Returning 1 currently only makes sense for dummy instances, used
00097       // to "reserve" a spot (kind of like forward-declarations) for a
00098       // dynamic service. This is necessary to help enforce the correct
00099       // finalization order, when such service also has any (dependent)
00100       // static services
00101 
00102       return 1; // No implementation was found.
00103     }
00104 
00105   int ret = this->type_->fini ();
00106 
00107   // Ensure that closing the DLL is done after type_->fini() as it may
00108   // require access to the code for the service object destructor,
00109   // which resides in the DLL
00110   return (ret | this->dll_.close());
00111 
00112 }

ACE_INLINE int ACE_Service_Type::fini_called void   )  const
 

Check if the service has been fini'ed.

Definition at line 60 of file Service_Object.inl.

References ACE_TRACE, and fini_already_called_.

Referenced by ACE_Service_Repository::find_i().

00061 {
00062   ACE_TRACE ("ACE_Service_Type::fini_called");
00063   return this->fini_already_called_;
00064 }

bool ACE_Service_Type::is_forward_declaration void   )  const
 

void ACE_Service_Type::name const ACE_TCHAR  ) 
 

Definition at line 156 of file Service_Object.cpp.

References ACE_TCHAR, ACE_TRACE, and ACE::strnew().

00157 {
00158   ACE_TRACE ("ACE_Service_Type::name");
00159 
00160   delete [] const_cast <ACE_TCHAR *> (this->name_);
00161   this->name_ = ACE::strnew (n);
00162 }

ACE_INLINE const ACE_TCHAR * ACE_Service_Type::name void   )  const
 

Definition at line 24 of file Service_Object.inl.

References ACE_TRACE.

Referenced by ACE_Service_Type(), ACE_Service_Repository::fini(), ACE_Service_Gestalt::initialize(), ACE_Service_Gestalt::initialize_i(), ACE_Service_Repository::insert(), ACE_Service_Manager::list_services(), and ACE_Service_Repository::relocate_i().

00025 {
00026   ACE_TRACE ("ACE_Service_Type::name");
00027   return this->name_;
00028 }

int ACE_Service_Type::resume void   )  const
 

Definition at line 123 of file Service_Object.cpp.

References ACE_TRACE, and ACE_Service_Type_Impl::resume().

Referenced by ACE_Service_Repository::resume().

00124 {
00125   ACE_TRACE ("ACE_Service_Type::resume");
00126   (const_cast<ACE_Service_Type *> (this))->active_ = 1;
00127   return this->type_->resume ();
00128 }

int ACE_Service_Type::suspend void   )  const
 

Definition at line 115 of file Service_Object.cpp.

References ACE_TRACE, and ACE_Service_Type_Impl::suspend().

Referenced by ACE_Service_Repository::suspend().

00116 {
00117   ACE_TRACE ("ACE_Service_Type::suspend");
00118   (const_cast<ACE_Service_Type *> (this))->active_ = 0;
00119   return this->type_->suspend ();
00120 }

ACE_INLINE void ACE_Service_Type::type const ACE_Service_Type_Impl ,
int  active = 1
 

Definition at line 38 of file Service_Object.inl.

References ACE_TRACE.

00039 {
00040   ACE_TRACE ("ACE_Service_Type::type");
00041   this->type_ = o;
00042   ((ACE_Service_Type *) this)->active_ = enabled;
00043 }

ACE_INLINE const ACE_Service_Type_Impl * ACE_Service_Type::type void   )  const
 

Definition at line 31 of file Service_Object.inl.

References ACE_TRACE.

Referenced by ace_get_module(), ACE_Service_Repository::fini(), ACE_Service_Gestalt::initialize(), ACE_Service_Gestalt::initialize_i(), ACE_Service_Repository::insert(), ACE_Dynamic_Service_Base::instance(), ACE_Service_Manager::list_services(), and ACE_Service_Type_Dynamic_Guard::~ACE_Service_Type_Dynamic_Guard().

00032 {
00033   ACE_TRACE ("ACE_Service_Type::type");
00034   return this->type_;
00035 }


Member Data Documentation

ACE_Service_Type::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Definition at line 135 of file Service_Object.h.

int ACE_Service_Type::active_ [private]
 

1 if svc is currently active, otherwise 0.

Definition at line 149 of file Service_Object.h.

ACE_DLL ACE_Service_Type::dll_ [mutable, private]
 

ACE_DLL representing the shared object file (non-zero if dynamically linked).

Definition at line 146 of file Service_Object.h.

Referenced by ACE_Service_Type(), dll(), and fini().

int ACE_Service_Type::fini_already_called_ [private]
 

1 if on has already been called, otherwise 0.

Definition at line 152 of file Service_Object.h.

Referenced by fini(), and fini_called().

const ACE_TCHAR* ACE_Service_Type::name_ [private]
 

Humanly readible name of svc.

Definition at line 139 of file Service_Object.h.

const ACE_Service_Type_Impl* ACE_Service_Type::type_ [private]
 

Pointer to C++ object that implements the svc.

Definition at line 142 of file Service_Object.h.


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 12:57:26 2008 for ACE by doxygen 1.3.6