8#include "Arp/System/Core/TypeName.hxx"
9#include "Arp/System/Core/Exception.hpp"
23template <
class Derived>
31 typedef Derived Instance;
46 template <
class T = Instance,
class ...Args>
95template <class Derived>
96template <class T, class ...Args>
99 if(pInstance !=
nullptr)
103 printf(
"ERROR: Singleton instance of type '%s' was created yet!",
TypeName<Derived>().GetFullName().CStr());
105 pInstance =
new T(std::forward<Args>(args)...);
110template <
class Derived>
113 return pInstance !=
nullptr;
116template <
class Derived>
119 if (pInstance ==
nullptr)
127template <
class Derived>
133template <
class Derived>
136 if (pInstance !=
nullptr)
143template <
class Derived>
149template <
class Derived>
157template <
typename Derived>
This class represents a single application domain for each process and is implemented as singleton.
Definition: AppDomain.hpp:119
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:134
static bool IsCreated(void)
Determines if this singleton instance is create yet.
Definition: Singleton.hxx:111
static Instance & CreateInstance(Args &&... args)
Creates this singleton instance.
Definition: Singleton.hxx:97
~Singleton(void)=default
The protected default destructor.
static void SetInstance(Instance *pOther)
Depreacated! Sets the singleton instance.
Definition: Singleton.hxx:144
static Instance & GetInstance(void)
Gets a reference of the singleton instance.
Definition: Singleton.hxx:117
Singleton(void)=default
The protected default constructor.
static Instance * GetInstancePtr(void)
Deprecated! Gets a pointer to the singleton instance.
Definition: Singleton.hxx:128
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:150
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