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>
    86     static Instance* pInstance;
    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 (meta programming) class provides the C++ typename of the as template argument passed type...
Definition: TypeName.hxx:55
 
static void SetInstance(Instance *pOther)
Sets the singleton instance.
Definition: Singleton.hxx:140
 
static Instance * GetInstancePtr(void)
Gets a pointer to the singleton instance.
Definition: Singleton.hxx:124
 
~Singleton(void)=default
The protected default destructor.
 
This class implements the singleton pattern.
Definition: Singleton.hxx:24
 
static void AssignInstanceFrom(Instance &other)
Assigns the singleton instance from another singleton instance of the same type.
Definition: Singleton.hxx:146
 
static Instance & GetInstance(void)
Gets a reference of the singleton instance.
Definition: Singleton.hxx:113
 
Root namespace for the PLCnext API
 
static bool IsCreated(void)
Determines if this singleton instance is create yet.
Definition: Singleton.hxx:107
 
Singleton(void)=default
The protected default constructor.
 
Singleton< Derived > SingletonBase
Defines this type to be used from derived classes.
Definition: Singleton.hxx:28
 
This is the base class of all Arp exception classes.
Definition: Exception.hpp:15
 
static void DisposeInstance(void)
Disposes this singleton instance.
Definition: Singleton.hxx:130
 
static Instance & CreateInstance(Args &&... args)
Creates this singleton instance.
Definition: Singleton.hxx:93