Defines the interface for specifying a creation strategy for a SVC_HANDLER that always returns the same SVC_HANDLER (i.e., it's a Singleton). More...
#include <Strategies_T.h>
Public Types | |
typedef ACE_Creation_Strategy < SVC_HANDLER > | base_type |
Public Member Functions | |
ACE_Singleton_Strategy (SVC_HANDLER *=0, ACE_Thread_Manager *=0) | |
int | open (SVC_HANDLER *, ACE_Thread_Manager *=0) |
virtual | ~ACE_Singleton_Strategy (void) |
virtual int | make_svc_handler (SVC_HANDLER *&) |
void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Protected Attributes | |
SVC_HANDLER * | svc_handler_ |
Pointer to the Singleton svc_handler. | |
bool | delete_svc_handler_ |
Keep track of whether we need to delete the SVC_HANDLER. |
Defines the interface for specifying a creation strategy for a SVC_HANDLER that always returns the same SVC_HANDLER (i.e., it's a Singleton).
Note that this class takes over the ownership of the SVC_HANDLER passed into it as a parameter and it becomes responsible for deleting this object.
Definition at line 141 of file Strategies_T.h.
typedef ACE_Creation_Strategy<SVC_HANDLER> ACE_Singleton_Strategy< SVC_HANDLER >::base_type |
Definition at line 146 of file Strategies_T.h.
ACE_Singleton_Strategy< SVC_HANDLER >::ACE_Singleton_Strategy | ( | SVC_HANDLER * | sh = 0 , |
|
ACE_Thread_Manager * | tm = 0 | |||
) |
Definition at line 8 of file Strategies_T.inl.
: svc_handler_ (0), delete_svc_handler_ (1) { ACE_TRACE ("ACE_Singleton_Strategy<SVC_HANDLER>::ACE_Singleton_Strategy"); if (this->open (sh, tm) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_Singleton_Strategy"))); }
ACE_Singleton_Strategy< SVC_HANDLER >::~ACE_Singleton_Strategy | ( | void | ) | [virtual] |
Definition at line 52 of file Strategies_T.cpp.
{ ACE_TRACE ("ACE_Singleton_Strategy<SVC_HANDLER>::~ACE_Singleton_Strategy"); if (this->delete_svc_handler_) delete this->svc_handler_; }
void ACE_Singleton_Strategy< SVC_HANDLER >::dump | ( | void | ) | const |
Dump the state of an object.
Reimplemented from ACE_Creation_Strategy< SVC_HANDLER >.
Definition at line 1439 of file Strategies_T.cpp.
{ #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_Singleton_Strategy<SVC_HANDLER>::dump"); #endif /* ACE_HAS_DUMP */ }
int ACE_Singleton_Strategy< SVC_HANDLER >::make_svc_handler | ( | SVC_HANDLER *& | sh | ) | [virtual] |
Create a Singleton SVC_HANDLER by always returning the same SVC_HANDLER. Returns -1 on failure, else 0.
Reimplemented from ACE_Creation_Strategy< SVC_HANDLER >.
Definition at line 63 of file Strategies_T.cpp.
{ ACE_TRACE ("ACE_Singleton_Strategy<SVC_HANDLER>::make_svc_handler"); sh = this->svc_handler_; return 0; }
int ACE_Singleton_Strategy< SVC_HANDLER >::open | ( | SVC_HANDLER * | sh, | |
ACE_Thread_Manager * | = 0 | |||
) |
Definition at line 71 of file Strategies_T.cpp.
{ ACE_TRACE ("ACE_Singleton_Strategy<SVC_HANDLER>::open"); if (this->delete_svc_handler_) delete this->svc_handler_; // If <sh> is NULL then create a new <SVC_HANDLER>. if (sh == 0) { ACE_NEW_RETURN (this->svc_handler_, SVC_HANDLER, -1); this->delete_svc_handler_ = true; } else { this->svc_handler_ = sh; this->delete_svc_handler_ = false; } return 0; }
ACE_Singleton_Strategy< SVC_HANDLER >::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
Reimplemented from ACE_Creation_Strategy< SVC_HANDLER >.
Definition at line 164 of file Strategies_T.h.
bool ACE_Singleton_Strategy< SVC_HANDLER >::delete_svc_handler_ [protected] |
Keep track of whether we need to delete the SVC_HANDLER.
Definition at line 171 of file Strategies_T.h.
SVC_HANDLER* ACE_Singleton_Strategy< SVC_HANDLER >::svc_handler_ [protected] |
Pointer to the Singleton svc_handler.
Definition at line 168 of file Strategies_T.h.