Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray::cSingletonRegister Class Reference

#include <cSingleton.h>

Inheritance diagram for Gray::cSingletonRegister:
Gray::CObject Gray::cHeapObject Gray::IHeapObject Gray::cSingleton< cSQLiteDriver > Gray::cSingleton< cImageLoader > Gray::cSingleton< cImageDDSType > Gray::cSingleton< cImagePNGType > Gray::cSingleton< cSSLCipherSuites > Gray::cSingleton< cMemPageMgr > Gray::cSingleton< cAppRes > Gray::cSingleton< cImageJPGType > Gray::cSingleton< cPtrTraceMgr > Gray::cSingleton< cCodeProfilerControl > Gray::cSingleton< cAppConsole > Gray::cSingleton< cSSLDebug > Gray::cSingleton< cXObjScriptFactory > Gray::cSingleton< cScriptableInterfaceMgr > Gray::cSingleton< cNetAddrMgr > Gray::cSingleton< cImageBMPType > Gray::cSingleton< cHashTypeMgr > Gray::cSingleton< cECPGroupMgr > Gray::cSingleton< cRandomPerf > Gray::cSingleton< cRandomOS > Gray::cSingleton< cStreamBitTree > Gray::cSingleton< cODBCDriver > Gray::cSingleton< cSystemHelper > Gray::cSingleton< cAtomManager > Gray::cSingleton< cTimeScheduleMgr > Gray::cSingleton< cJobThreadPool< T > > Gray::cSingleton< cImageGIFType > Gray::cSingleton< cUnitTestSing > Gray::cSingleton< cSystemInfo > Gray::cSingleton< cXObjModuleFactory > Gray::cSingleton< cCipherAlgMgr > Gray::cSingleton< cExpressionContextMgr > Gray::cSingleton< cLogMgr > Gray::cSingleton< cSharedContext > Gray::cSingleton< cODBCEnv > Gray::cSingleton< cKeyTypeMgr > Gray::cSingleton< cCertMgr > Gray::cSingleton< cImageTGAType > Gray::cSingleton< cImageJP2Type > Gray::cSingleton< cThreadMgr > Gray::cSingleton< cAppState > Gray::cSingleton< cPoolClass< TYPE > > Gray::cSingleton< cOctreeNodePool > Gray::cSingleton< cUnitTests > Gray::cSingleton< TYPE >

Static Public Member Functions

static void __stdcall ReleaseModule (HMODULE hMod)
 

Static Public Attributes

static cThreadLockFast sm_LockSingle
 common lock for all cSingleton. More...
 

Protected Member Functions

 cSingletonRegister (const TYPEINFO_t &rAddrCode) noexcept
 
virtual ~cSingletonRegister ()
 
void RegisterSingleton ()
 
- Protected Member Functions inherited from Gray::cHeapObject
const void * get_HeapPtr () const noexcept override
 Get the top level (outermost, freeable) class pointer. I can delete get_HeapPtr(). More...
 

Protected Attributes

HMODULE m_hModuleLoaded
 What modules loaded this ? So singletons can be destroyed if DLL/SO unloads. More...
 

Friends

class cSingletonManager
 
class cSingletonTests
 

Additional Inherited Members

- Public Member Functions inherited from Gray::CObject
virtual ~CObject ()
 
virtual bool isValidCheck () const noexcept
 < memory allocation and structure definitions are valid. More...
 
virtual void AssertValid () const
 < memory allocation and structure definitions are valid. More...
 
virtual void Serialize (cArchive &a)
 
- Public Member Functions inherited from Gray::cHeapObject
 cHeapObject ()
 
virtual ~cHeapObject ()
 
bool IsValidInsideN (INT_PTR index) const
 
bool IsValidInsidePtr (void const *pTest) const
 
virtual size_t GetHeapStatsThis (OUT ITERATE_t &iAllocCount) const
 
virtual bool isValidCheck () const noexcept
 

Detailed Description

NON template base for cSingleton. MUST be IHeapObject Register this to allow for proper order of virtual destruction at C runtime destruct. Allows for ordered destruction of singletons if modules unload.

Note
Static singletons are not multi threaded anyhow. so don't worry about static init order for sm_LockSingle.

Constructor & Destructor Documentation

◆ cSingletonRegister()

Gray::cSingletonRegister::cSingletonRegister ( const TYPEINFO_t rAddrCode)
protectednoexcept

◆ ~cSingletonRegister()

Gray::cSingletonRegister::~cSingletonRegister ( )
protectedvirtual

Allow Early removal of a singleton! This is sort of weird but i should allow it for DLL unload.

Member Function Documentation

◆ RegisterSingleton()

void Gray::cSingletonRegister::RegisterSingleton ( )
protected

register with cSingletonManager Only register this if we know its NOT static. We called new.

◆ ReleaseModule()

void GRAYCALL Gray::cSingletonRegister::ReleaseModule ( HMODULE  hMod)
static

Friends And Related Function Documentation

◆ cSingletonManager

friend class cSingletonManager
friend

◆ cSingletonTests

friend class cSingletonTests
friend

Member Data Documentation

◆ m_hModuleLoaded

HMODULE Gray::cSingletonRegister::m_hModuleLoaded
protected

What modules loaded this ? So singletons can be destroyed if DLL/SO unloads.

◆ sm_LockSingle

cThreadLockFast Gray::cSingletonRegister::sm_LockSingle
static

common lock for all cSingleton.


The documentation for this class was generated from the following files: