#include <Service_Object.h>
Collaboration diagram for ACE_Service_Type:
Public Types | |
DELETE_OBJ = 1 | |
Delete the payload object. | |
DELETE_THIS = 2 | |
Delete the enclosing object. | |
SERVICE_OBJECT = ACE_SVC_OBJ_T | |
MODULE = ACE_MODULE_T | |
STREAM = ACE_STREAM_T | |
INVALID_TYPE = -1 | |
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. |
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.
00078 { 00079 /// Delete the payload object. 00080 DELETE_OBJ = 1, 00081 00082 /// Delete the enclosing object. 00083 DELETE_THIS = 2 00084 };
anonymous enum |
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 };
ACE_Service_Type::ACE_Service_Type | ( | const ACE_TCHAR * | n, | |
ACE_Service_Type_Impl * | o, | |||
const ACE_DLL & | dll, | |||
bool | active | |||
) |
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.
References ACE_TRACE, dll_, name(), and ACE_DLL::set_handle().
00069 : name_ (0), 00070 type_ (t), 00071 active_ (active), 00072 fini_already_called_ (false) 00073 { 00074 ACE_TRACE ("ACE_Service_Type::ACE_Service_Type"); 00075 this->dll_.set_handle (handle); 00076 this->name (n); 00077 }
ACE_Service_Type::~ACE_Service_Type | ( | void | ) |
ACE_INLINE void ACE_Service_Type::active | ( | bool | turnon | ) |
ACE_INLINE bool ACE_Service_Type::active | ( | void | ) | const |
Definition at line 46 of file Service_Object.inl.
References ACE_TRACE, and active_.
Referenced by ACE_Service_Repository::fini(), ACE_Service_Repository::insert(), and ACE_Service_Type_Dynamic_Guard::~ACE_Service_Type_Dynamic_Guard().
ACE_INLINE void ACE_Service_Type::dll | ( | const ACE_DLL & | ) |
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_TRACE, and dll_.
Referenced by ACE_Dynamic_Service_Dependency::init(), and ACE_Service_Type_Dynamic_Guard::~ACE_Service_Type_Dynamic_Guard().
ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_Service_Type::dump | ( | void | ) | const |
Dump the state of an object.
Definition at line 30 of file Service_Object.cpp.
References ACE_TRACE, and ACE_OS::fprintf().
Referenced by ACE_Dynamic_Service_Dependency::init().
00031 { 00032 #if defined (ACE_HAS_DUMP) 00033 ACE_TRACE ("ACE_Service_Type::dump"); 00034 #endif /* ACE_HAS_DUMP */ 00035 00036 00037 // Using printf, since the log facility may not have been 00038 // initialized yet. Using a "//" prefix, in case the executable 00039 // happens to be a code generator and the output gets embedded in 00040 // the generated C++ code. 00041 ACE_OS::fprintf(stderr, 00042 "// [ST] dump, this=%p, name=%s, type=%p, so=%p, active=%d\n", 00043 this, 00044 this->name_, 00045 this->type_, 00046 (this->type_ != 0) ? this->type_->object () : 0, 00047 this->active_); 00048 00049 }
int ACE_Service_Type::fini | ( | void | ) |
Calls <fini> on <type_>.
Definition at line 88 of file Service_Object.cpp.
References ACE_DEBUG, ACE_TEXT, ACE::debug(), ACE_Service_Type_Impl::fini(), fini_already_called_, LM_DEBUG, and type_.
Referenced by ACE_Service_Repository::fini(), and ~ACE_Service_Type().
00089 { 00090 if (ACE::debug ()) 00091 ACE_DEBUG ((LM_DEBUG, 00092 ACE_TEXT ("ACE (%P|%t) ST::fini - destroying name=%s, dll=%s\n"), 00093 this->name_, 00094 this->dll_.dll_name_)); 00095 00096 if (this->fini_already_called_) 00097 return 0; 00098 00099 this->fini_already_called_ = true; 00100 00101 if (this->type_ == 0) 00102 { 00103 // Returning 1 currently only makes sense for dummy instances, used 00104 // to "reserve" a spot (kind of like forward-declarations) for a 00105 // dynamic service. This is necessary to help enforce the correct 00106 // finalization order, when such service also has any (dependent) 00107 // static services 00108 00109 return 1; // No implementation was found. 00110 } 00111 00112 int ret = this->type_->fini (); 00113 00114 // Ensure that closing the DLL is done after type_->fini() as it may 00115 // require access to the code for the service object destructor, 00116 // which resides in the DLL 00117 return (ret | this->dll_.close()); 00118 00119 }
ACE_INLINE 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.
References ACE_TRACE, and fini_already_called_.
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 |
Is this just a stub for the real thing?
void ACE_Service_Type::name | ( | const ACE_TCHAR * | ) |
Definition at line 163 of file Service_Object.cpp.
References ACE_TRACE, name_, and ACE::strnew().
00164 { 00165 ACE_TRACE ("ACE_Service_Type::name"); 00166 00167 delete [] const_cast <ACE_TCHAR *> (this->name_); 00168 this->name_ = ACE::strnew (n); 00169 }
ACE_INLINE const ACE_TCHAR * ACE_Service_Type::name | ( | void | ) | const |
Definition at line 24 of file Service_Object.inl.
References ACE_TRACE, and name_.
Referenced by ACE_Service_Type(), ACE_Service_Repository::close(), ACE_Service_Repository::fini(), ACE_Service_Gestalt::initialize(), ACE_Service_Gestalt::initialize_i(), and ACE_Service_Repository::insert().
int ACE_Service_Type::resume | ( | void | ) | const |
Definition at line 130 of file Service_Object.cpp.
References ACE_TRACE, ACE_Service_Type_Impl::resume(), and type_.
Referenced by ACE_Service_Repository::resume().
00131 { 00132 ACE_TRACE ("ACE_Service_Type::resume"); 00133 (const_cast<ACE_Service_Type *> (this))->active_ = true; 00134 return this->type_->resume (); 00135 }
int ACE_Service_Type::suspend | ( | void | ) | const |
Definition at line 122 of file Service_Object.cpp.
References ACE_TRACE, ACE_Service_Type_Impl::suspend(), and type_.
Referenced by ACE_Service_Repository::suspend().
00123 { 00124 ACE_TRACE ("ACE_Service_Type::suspend"); 00125 (const_cast<ACE_Service_Type *> (this))->active_ = false; 00126 return this->type_->suspend (); 00127 }
ACE_INLINE void ACE_Service_Type::type | ( | const ACE_Service_Type_Impl * | , | |
bool | active = true | |||
) |
Definition at line 38 of file Service_Object.inl.
References ACE_TRACE, and type_.
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, and type_.
Referenced by ACE_Service_Repository::fini(), ACE_Service_Gestalt::initialize(), ACE_Service_Gestalt::initialize_i(), ACE_Service_Repository::insert(), ACE_Dynamic_Service_Base::instance(), and ACE_Service_Type_Dynamic_Guard::~ACE_Service_Type_Dynamic_Guard().
bool ACE_Service_Type::active_ [private] |
true if svc is currently active, otherwise false.
Definition at line 149 of file Service_Object.h.
Referenced by active().
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(), and dll().
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.
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.
Referenced by name(), and ~ACE_Service_Type().
const ACE_Service_Type_Impl* ACE_Service_Type::type_ [private] |