8 #include "Arp/System/Core/Singleton.hxx"
9 #include "Arp/System/Core/AppDomain.hpp"
23 template <
class Derived>
31 typedef Derived Instance;
45 template <
class T = Instance,
class ...Args>
72 template <
class Derived>
73 template <
class T,
class ...Args>
76 Derived* pInstance = GetInstancePtr();
78 if(pInstance !=
nullptr)
83 pInstance =
new T(std::forward<Args>(args)...);
90 template <
class Derived>
101 template <
class Derived>
104 Derived* pResult = GetInstancePtr();
105 if (pResult ==
nullptr)
112 template <
class Derived>
118 template <
class Derived>
122 delete GetInstancePtr();
This class implements the singleton pattern for singletons with process wide scope.
Definition: AppDomainSingleton.hxx:25
static Derived & GetInstance(void)
Gets a reference of the singleton instance.
Definition: AppDomainSingleton.hxx:102
static bool IsCreated(void)
Determines if this singleton instance is created yet.
Definition: AppDomainSingleton.hxx:91
static Derived & CreateInstance(Args &&... args)
Creates this singleton instance.
Definition: AppDomainSingleton.hxx:74
static Derived * GetInstancePtr(void)
Gets a pointer to the singleton instance.
Definition: AppDomainSingleton.hxx:113
AppDomainSingleton(void)=default
The protected default constructor.
static void DisposeInstance(void)
Disposes this singleton instance.
Definition: AppDomainSingleton.hxx:119
~AppDomainSingleton(void)=default
The protected default destructor.
AppDomainSingleton< Derived > SingletonBase
Defines this type to be used from derived classes.
Definition: AppDomainSingleton.hxx:28
void AddSingleton(TSingleton *pSingleton)
Adds a singleton instance to this AppDomain.
Definition: AppDomain.hpp:291
static bool IsCreated(void)
Determines if the appdomain was created yet.
Definition: AppDomain.hpp:228
TSingleton * GetSingletonPtr(void)
Gets the singleton pointer of the specified type.
Definition: AppDomain.hpp:318
static AppDomain & GetCurrent(void)
Gets the current AppDomain instance.
Definition: AppDomain.hpp:233
bool RemoveSingleton(void)
Removes the singleton pointer of the specified type from this AppDomain.
Definition: AppDomain.hpp:336
This is the base class of all Arp exception classes.
Definition: Exception.hpp:16
This (meta programming) class provides the C++ typename of the as template argument passed type.
Definition: TypeName.hxx:56
Root namespace for the PLCnext API