8 #include "Arp/System/Core/TypeName.hxx"
9 #include "Arp/System/Core/Exception.hpp"
23 template <
class Derived>
31 typedef Derived Instance;
46 template <
class T = Instance,
class ...Args>
91 template <
class Derived>
92 template <
class T,
class ...Args>
95 if(pInstance !=
nullptr)
99 printf(
"ERROR: Singleton instance of type '%s' was created yet!",
TypeName<Derived>().Value.CStr());
101 pInstance =
new T(std::forward<Args>(args)...);
106 template <
class Derived>
109 return pInstance !=
nullptr;
112 template <
class Derived>
115 if (pInstance ==
nullptr)
123 template <
class Derived>
129 template <
class Derived>
132 if (pInstance !=
nullptr)
139 template <
class Derived>
145 template <
class Derived>
153 template <
typename Derived>
This class represents a single application domain for each process and is implemented as singleton.
Definition: AppDomain.hpp:122
This is the base class of all Arp exception classes.
Definition: Exception.hpp:16
This class implements the singleton pattern.
Definition: Singleton.hxx:25
static void DisposeInstance(void)
Disposes this singleton instance.
Definition: Singleton.hxx:130
static bool IsCreated(void)
Determines if this singleton instance is create yet.
Definition: Singleton.hxx:107
static Instance & CreateInstance(Args &&... args)
Creates this singleton instance.
Definition: Singleton.hxx:93
~Singleton(void)=default
The protected default destructor.
static void SetInstance(Instance *pOther)
Sets the singleton instance.
Definition: Singleton.hxx:140
static Instance & GetInstance(void)
Gets a reference of the singleton instance.
Definition: Singleton.hxx:113
Singleton(void)=default
The protected default constructor.
static Instance * GetInstancePtr(void)
Gets a pointer to the singleton instance.
Definition: Singleton.hxx:124
Singleton< Derived > SingletonBase
Defines this type to be used from derived classes.
Definition: Singleton.hxx:28
static void AssignInstanceFrom(Instance &other)
Assigns the singleton instance from another singleton instance of the same type.
Definition: Singleton.hxx:146
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