8#include "Arp/System/Core/Singleton.hxx"
9#include "Arp/System/Core/AppDomain.hpp"
23template <
class Derived>
31 typedef Derived Instance;
45 template <
class T = Instance,
class ...Args>
68 static Derived* GetInstancePtrInternal(
void);
77template <class Derived>
78template <class T, class ...Args>
81 Derived* pInstance = GetInstancePtrInternal();
83 if(pInstance !=
nullptr)
88 pInstance =
new T(std::forward<Args>(args)...);
95template <
class Derived>
103 return AppDomainSingleton::GetInstancePtrInternal() !=
nullptr;
106template <
class Derived>
109 Derived* pResult = GetInstancePtrInternal();
117template <
class Derived>
120 return GetInstancePtrInternal();
123template <
class Derived>
129template <
class Derived>
133 delete GetInstancePtrInternal();
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:107
static bool IsCreated(void)
Determines if this singleton instance is created yet.
Definition: AppDomainSingleton.hxx:96
static Derived & CreateInstance(Args &&... args)
Creates this singleton instance.
Definition: AppDomainSingleton.hxx:79
static Derived * GetInstancePtr(void)
Depreacated! Gets a pointer to the singleton instance.
Definition: AppDomainSingleton.hxx:118
AppDomainSingleton(void)=default
The protected default constructor.
static void DisposeInstance(void)
Disposes this singleton instance.
Definition: AppDomainSingleton.hxx:130
~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:305
static bool IsCreated(void)
Determines if the appdomain was created yet.
Definition: AppDomain.hpp:237
TSingleton * GetSingletonPtr(void)
Gets the singleton pointer of the specified type.
Definition: AppDomain.hpp:332
static AppDomain & GetCurrent(void)
Gets the current AppDomain instance.
Definition: AppDomain.hpp:242
bool RemoveSingleton(void)
Removes the singleton pointer of the specified type from this AppDomain.
Definition: AppDomain.hpp:350
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:67
Root namespace for the PLCnext API
class ARP_DEPRECATED("Use Arp::Enum<T> instead.") EnumStrings
Deprecated! The class implements an adapter for enums to define the string literals of the enum entri...
Definition: EnumStrings.hxx:38