Go to the source code of this file.
Defines | |
#define | DECLARE_SINGLETON_CLASS(className) |
Declares a singleton. | |
#define | DECLARE_SINGLETON_CLASS_WITH_ARGS(className, createArgs) |
Declares a singleton. | |
#define | DECLARE_SINGLETON_CLASS_WITH_ARGS2(className, createArgs1, createArgs2) |
Declares a singleton. | |
#define | IMPLEMENT_SINGLETON(className) |
Implements the singleton. | |
#define | IMPLEMENT_SINGLETON_WITH_ARGS(className, createArg1) |
Implements the singleton. | |
#define | IMPLEMENT_SINGLETON_WITH_ARGS2(className, createArg1, createArg2) |
Implements the singleton. | |
#define | IMPLEMENT_CREATE_SINGLETON(className) |
Implements the construction of a singleton. | |
#define | IMPLEMENT_CREATE_SINGLETON_WITH_ARGS(className, createArg1) |
Implements the construction of a singleton. | |
#define | IMPLEMENT_CREATE_SINGLETON_WITH_ARGS2(className, createArg1, createArg2) |
Implements the construction of a singleton. | |
#define | IMPLEMENT_DESTROY_SINGLETON(className) |
Implements the destruction of a singleton. |
A singleton is a class which has only one object of this class. The advantage of a singleton over a static class is that the application controls when and how the singleton is created and destroyed. The disadvantage of a singleton is that you have one extra memory lookup to do.
|
Value: private: \ static className* m_pSingleton; \ public: \ static bool CreateSingleton(); \ static void DestroySingleton(); \ friend className* Get##className(); Use this macros within the class declaration.
|
|
Value: private: \ static className* m_pSingleton; \ public: \ static bool CreateSingleton(createArgs); \ static void DestroySingleton(); \ friend className* Get##className(); Use this macros within the class declaration.
|
|
Value: private: \ static className* m_pSingleton; \ public: \ static bool CreateSingleton(createArgs1, createArgs2); \ static void DestroySingleton(); \ friend className* Get##className(); Use this macros within the class declaration.
|
|
Value: className* className::m_pSingleton; \ className* Get##className() { return className::m_pSingleton; } \ bool className::CreateSingleton() { \ m_pSingleton = new className(); \ return true; } Use this macros within the class implementation.
|
|
Value: className* className::m_pSingleton; \ className* Get##className() { return className::m_pSingleton; } \ bool className::CreateSingleton(createArg1 argument1) { \ m_pSingleton = new className(argument1); } Use this macros within the class implementation.
|
|
Value: className* className::m_pSingleton; \ className* Get##className() { return className::m_pSingleton; } \ bool className::CreateSingleton(createArg1 argument1, createArg2 argument2) { \ m_pSingleton = new className(argument1, argument2); } Use this macros within the class implementation.
|
|
Value: void className::DestroySingleton() \ { SAFE_DELETE(m_pSingleton); } Use this macros within the class implementation.
|
|
Value: IMPLEMENT_CREATE_SINGLETON(className) \ IMPLEMENT_DESTROY_SINGLETON(className) Use this macros within the class implementation.
|
|
Value: IMPLEMENT_CREATE_SINGLETON_WITH_ARGS(className, createArg1) \ IMPLEMENT_DESTROY_SINGLETON(className) Use this macros within the class implementation.
|
|
Value: IMPLEMENT_CREATE_SINGLETON_WITH_ARGS2(className, createArg1, createArg2) \ IMPLEMENT_DESTROY_SINGLETON(className) Use this macros within the class implementation.
|