Keeps track of information related to the various ACE_Service_Type_Impl subclasses. More...
#include <Service_Object.h>
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, bool active) | |
ACE_Service_Type (const ACE_TCHAR *n, ACE_Service_Type_Impl *o, ACE_SHLIB_HANDLE handle, bool active) | |
~ACE_Service_Type (void) | |
const ACE_TCHAR * | name (void) const |
void | name (const ACE_TCHAR *) |
const ACE_Service_Type_Impl * | type (void) const |
void | type (const ACE_Service_Type_Impl *, bool active=true) |
bool | is_forward_declaration (void) const |
Is this just a stub for the real thing? | |
int | suspend (void) const |
int | resume (void) const |
bool | active (void) const |
void | active (bool turnon) |
int | fini (void) |
Calls fini on type_ . | |
bool | fini_called (void) const |
Check if the service has been fini'ed. | |
void | dump (void) const |
Dump the state of an object. | |
const ACE_DLL & | dll (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_TCHAR * | name_ |
Humanly readible name of svc. | |
const ACE_Service_Type_Impl * | type_ |
Pointer to C++ object that implements the svc. | |
ACE_DLL | dll_ |
bool | active_ |
true if svc is currently active, otherwise false. | |
bool | fini_already_called_ |
true if fini on type_ has already been called, otherwise false. |
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.
anonymous enum |
Definition at line 77 of file Service_Object.h.
{ /// Delete the payload object. DELETE_OBJ = 1, /// Delete the enclosing object. DELETE_THIS = 2 };
anonymous enum |
Definition at line 86 of file Service_Object.h.
{ SERVICE_OBJECT = ACE_SVC_OBJ_T, MODULE = ACE_MODULE_T, STREAM = ACE_STREAM_T, INVALID_TYPE = -1 };
ACE_Service_Type::ACE_Service_Type | ( | const ACE_TCHAR * | n, | |
ACE_Service_Type_Impl * | o, | |||
const ACE_DLL & | dll, | |||
bool | active | |||
) |
Definition at line 51 of file Service_Object.cpp.
ACE_Service_Type::ACE_Service_Type | ( | const ACE_TCHAR * | n, | |
ACE_Service_Type_Impl * | o, | |||
ACE_SHLIB_HANDLE | handle, | |||
bool | active | |||
) |
Definition at line 65 of file Service_Object.cpp.
: name_ (0), type_ (t), active_ (active), fini_already_called_ (false) { ACE_TRACE ("ACE_Service_Type::ACE_Service_Type"); this->dll_.set_handle (handle); this->name (n); }
ACE_Service_Type::~ACE_Service_Type | ( | void | ) |
bool ACE_Service_Type::active | ( | void | ) | const |
Definition at line 46 of file Service_Object.inl.
void ACE_Service_Type::active | ( | bool | turnon | ) |
Definition at line 53 of file Service_Object.inl.
const ACE_DLL & ACE_Service_Type::dll | ( | void | ) | const |
Get to the DLL's implentation.
Definition at line 66 of file Service_Object.inl.
void ACE_Service_Type::dll | ( | const ACE_DLL & | adll | ) |
Sets the DLL.
Definition at line 72 of file Service_Object.inl.
void ACE_Service_Type::dump | ( | void | ) | const |
Dump the state of an object.
int ACE_Service_Type::fini | ( | void | ) |
Calls fini
on type_
.
Definition at line 88 of file Service_Object.cpp.
{ if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE (%P|%t) ST::fini - destroying name=%s, dll=%s\n"), this->name_, this->dll_.dll_name_)); if (this->fini_already_called_) return 0; this->fini_already_called_ = true; if (this->type_ == 0) { // Returning 1 currently only makes sense for dummy instances, used // to "reserve" a spot (kind of like forward-declarations) for a // dynamic service. This is necessary to help enforce the correct // finalization order, when such service also has any (dependent) // static services return 1; // No implementation was found. } int ret = this->type_->fini (); // Ensure type is 0 to prevent invalid access after call to fini. this->type_ = 0; // Ensure that closing the DLL is done after type_->fini() as it may // require access to the code for the service object destructor, // which resides in the DLL return (ret | this->dll_.close ()); }
bool ACE_Service_Type::fini_called | ( | void | ) | const |
Check if the service has been fini'ed.
Definition at line 60 of file Service_Object.inl.
{ ACE_TRACE ("ACE_Service_Type::fini_called"); return this->fini_already_called_; }
bool ACE_Service_Type::is_forward_declaration | ( | void | ) | const |
Is this just a stub for the real thing?
const ACE_TCHAR * ACE_Service_Type::name | ( | void | ) | const |
Definition at line 24 of file Service_Object.inl.
void ACE_Service_Type::name | ( | const ACE_TCHAR * | n | ) |
Definition at line 166 of file Service_Object.cpp.
{ ACE_TRACE ("ACE_Service_Type::name"); delete [] const_cast <ACE_TCHAR *> (this->name_); this->name_ = ACE::strnew (n); }
int ACE_Service_Type::resume | ( | void | ) | const |
Definition at line 133 of file Service_Object.cpp.
{ ACE_TRACE ("ACE_Service_Type::resume"); (const_cast<ACE_Service_Type *> (this))->active_ = true; return this->type_->resume (); }
int ACE_Service_Type::suspend | ( | void | ) | const |
Definition at line 125 of file Service_Object.cpp.
{ ACE_TRACE ("ACE_Service_Type::suspend"); (const_cast<ACE_Service_Type *> (this))->active_ = false; return this->type_->suspend (); }
const ACE_Service_Type_Impl * ACE_Service_Type::type | ( | void | ) | const |
Definition at line 31 of file Service_Object.inl.
void ACE_Service_Type::type | ( | const ACE_Service_Type_Impl * | o, | |
bool | active = true | |||
) |
Definition at line 38 of file Service_Object.inl.
{ ACE_TRACE ("ACE_Service_Type::type"); this->type_ = o; ((ACE_Service_Type *) this)->active_ = enabled; }
Declare the dynamic allocation hooks.
Definition at line 135 of file Service_Object.h.
bool ACE_Service_Type::active_ [private] |
true if svc is currently active, otherwise false.
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.
bool ACE_Service_Type::fini_already_called_ [private] |
true if fini
on type_
has already been called, otherwise false.
Definition at line 152 of file Service_Object.h.
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.