Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray::cSingletonStatic< TYPE > Class Template Reference

#include <cSingleton.h>

Inheritance diagram for Gray::cSingletonStatic< TYPE >:
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 bool isSingleCreated () noexcept
 
static TYPEget_SingleU () noexcept
 
static TYPEget_Single ()
 
template<class TYPE2 >
static TYPE2 *__stdcall get_SingleCast ()
 
static TYPEI () noexcept
 

Protected Member Functions

 cSingletonStatic (TYPE *pObject) noexcept
 
virtual ~cSingletonStatic () noexcept
 

Static Protected Attributes

static TYPEsm_pThe = nullptr
 pointer to the one and only object of this TYPE. ASSUME automatically init to = nullptr. More...
 

Detailed Description

template<class TYPE>
class Gray::cSingletonStatic< TYPE >

base class for a type that we want to make sure only one of these can exist at a time.

Note
TYPE = cSingletonStatic based class = this Externally created singleton. might be stack based, or abstract (e.g.cNTServiceImpl) but usually static allocated.
Assume 1. gets constructed/destructed by the C Runtime, 2. Is inherently thread safe since its not created on demand. The BIG problem with this is that we cannot guarantee order of creation/destruction. So singletons that rely/construct on each other may be corrupt/uninitialized.

Constructor & Destructor Documentation

◆ cSingletonStatic()

template<class TYPE >
Gray::cSingletonStatic< TYPE >::cSingletonStatic ( TYPE pObject)
inlineprotectednoexcept

the singleton must be constructed with a reference to the controlled object typically this == pObject == sm_pThe

◆ ~cSingletonStatic()

template<class TYPE >
virtual Gray::cSingletonStatic< TYPE >::~cSingletonStatic ( )
inlineprotectedvirtualnoexcept

the singleton accessor

Member Function Documentation

◆ get_Single()

template<class TYPE >
static TYPE* Gray::cSingletonStatic< TYPE >::get_Single ( )
inlinestatic

This is a complex or abstract or assumed static type that we cannot just create automatically on first usage.

◆ get_SingleCast()

template<class TYPE >
template<class TYPE2 >
static TYPE2* __stdcall Gray::cSingletonStatic< TYPE >::get_SingleCast ( )
inlinestatic

◆ get_SingleU()

template<class TYPE >
static TYPE* Gray::cSingletonStatic< TYPE >::get_SingleU ( )
inlinestaticnoexcept
Returns
sm_pThe but allow that it might be nullptr. Weird.

◆ I()

template<class TYPE >
static TYPE& Gray::cSingletonStatic< TYPE >::I ( )
inlinestaticnoexcept

The singleton by reference.

◆ isSingleCreated()

template<class TYPE >
static bool Gray::cSingletonStatic< TYPE >::isSingleCreated ( )
inlinestaticnoexcept

Member Data Documentation

◆ sm_pThe

template<class TYPE >
TYPE * Gray::cSingletonStatic< TYPE >::sm_pThe = nullptr
staticprotected

pointer to the one and only object of this TYPE. ASSUME automatically init to = nullptr.


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