8 #ifndef _INC_cSingleton_H
9 #define _INC_cSingleton_H
10 #ifndef NO_PRAGMA_ONCE
25 #pragma warning(disable:4355)
85 template <
class TYPE2>
91 static inline TYPE&
I() noexcept
108 friend class cSingletonManager;
119 void RegisterSingleton();
121 static void GRAYCALL ReleaseModule(HMODULE hMod);
125 template <
class TYPE>
176 template <
class TYPE2>
189 ASSERT(!TYPE2::isSingleCreated());
190 TYPE2* p =
new TYPE2();
192 ASSERT(TYPE2::isSingleCreated());
#define GRAYCORE_LINK
Definition: GrayCore.h:47
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define CHECKPTR_CAST(t, p)
Definition: PtrCast.h:50
#define TYPE
Definition: StrT.cpp:38
#define ASSERT(exp)
Definition: cDebugAssert.h:87
#define DEBUG_CHECK(exp)
Definition: cDebugAssert.h:90
#define DEBUG_ASSERT(exp, sDesc)
Definition: cDebugAssert.h:93
#define NonCopyable_IMPL(_TYPE)
Definition: cNonCopyable.h:34
#define UNITTEST_FRIEND(n)
Define this in the class body to be unit tested. Allow the unit test to access private/protected stuf...
Definition: cUnitTestDecl.h:17
Definition: cHeapObject.h:38
Definition: cSingleton.h:101
static cThreadLockFast sm_LockSingle
common lock for all cSingleton.
Definition: cSingleton.h:115
cSingletonRegister(const TYPEINFO_t &rAddrCode) noexcept
Definition: cSingleton.cpp:103
HMODULE m_hModuleLoaded
What modules loaded this ? So singletons can be destroyed if DLL/SO unloads.
Definition: cSingleton.h:112
Definition: cSingleton.h:30
static TYPE * sm_pThe
pointer to the one and only object of this TYPE. ASSUME automatically init to = nullptr.
Definition: cSingleton.h:39
cSingletonStatic(TYPE *pObject) noexcept
Definition: cSingleton.h:44
static bool isSingleCreated() noexcept
Definition: cSingleton.h:70
static TYPE * get_SingleU() noexcept
Definition: cSingleton.h:74
static TYPE * get_Single()
Definition: cSingleton.h:79
static TYPE2 *__stdcall get_SingleCast()
Definition: cSingleton.h:86
virtual ~cSingletonStatic() noexcept
Definition: cSingleton.h:58
static TYPE & I() noexcept
Definition: cSingleton.h:91
Definition: cSingleton.h:127
virtual ~cSingleton()
Definition: cSingleton.h:148
static TYPE &__stdcall I()
Definition: cSingleton.h:199
static TYPE2 *__stdcall get_SingleT()
Definition: cSingleton.h:177
cSingleton(TYPE *pObject, const TYPEINFO_t &rAddrCode=typeid(TYPE)) noexcept
Definition: cSingleton.h:141
static TYPE *__stdcall get_Single()
Definition: cSingleton.h:155
Definition: cThreadLock.h:205
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
std::type_info TYPEINFO_t
Definition: cTypeInfo.h:29