ACE_Singleton3
A singleton adapter uses the adapter pattern to turn ordinary classes into singletons optimized with the double-checked locking optimization pattern.
Usage
#include <ace/Singleton.h>
template<class TYPE, class ACE_LOCK>
class ACE_Singleton : public ACE_Cleanup
{
public:
static TYPE *instance (void);
virtual void cleanup (void *param = 0);
static void dump (void);
protected:
ACE_Singleton (void);
TYPE instance_;
static ACE_Singleton<TYPE, ACE_LOCK> *singleton_;
static ACE_Singleton<TYPE, ACE_LOCK> *&instance_i (void);
};
Overview
Public members
static TYPE *instance (void);
Global access point to the Singleton.
virtual void cleanup (void *param = 0);
Cleanup method, used by ace_cleanup_destroyer to destroy the ACE_Singleton.
static void dump (void);
Dump the state of the object.
Protected members
ACE_Singleton (void);
Default constructor.
TYPE instance_;
Contained instance.
static ACE_Singleton<TYPE, ACE_LOCK> *singleton_;
Pointer to the Singleton (ACE_Cleanup) instance.
static ACE_Singleton<TYPE, ACE_LOCK> *&instance_i (void);
Get pointer to the Singleton instance.
Library
ace