8#ifndef ARP_USE_ARP_SYSTEM_CORE 
   10#include "Arp/Base/Core/Singleton.hxx" 
   15#include "Arp/System/Core/TypeName.hxx" 
   16#include "Arp/System/Core/Exception.hpp" 
   30template <
class Derived>
 
   53    template <
class T = 
Instance, 
class ...Args>
 
   68    ARP_DEPRECATED(
"Use &GetInstance() instead.")
 
   69    static Instance*    GetInstancePtr(
void);
 
   80    ARP_DEPRECATED("Do not use this operation any more.")
 
   90    static 
void         AssignInstanceFrom(Instance& other);
 
   97    static Instance* pInstance;
 
  102template <class Derived>
 
  103template <class T, class ...Args>
 
  106    if(pInstance != 
nullptr)
 
  109        printf(
"ERROR: Singleton instance of type '%s' was created yet!", TypeName<Derived>().GetFullName().CStr()); 
 
  111    pInstance = 
new T(std::forward<Args>(args)...);
 
  116template <
class Derived>
 
  119    return pInstance != 
nullptr;
 
  122template <
class Derived>
 
  125    if (pInstance == 
nullptr)
 
  127        throw Exception(
"Singleton instance of type '{0}' was not created yet!", TypeName<Derived>());
 
  133template <
class Derived>
 
  134inline Derived* Singleton<Derived>::GetInstancePtr()
 
  139template <
class Derived>
 
  142    if (pInstance != 
nullptr)
 
  149template <
class Derived>
 
  155template <
class Derived>
 
  156inline void Singleton<Derived>::AssignInstanceFrom(Instance& other)
 
  163template <
typename Derived>
 
  164Derived* Singleton<Derived>::pInstance = 
nullptr;
 
static void DisposeInstance(void)
Disposes this singleton instance.
Definition: Singleton.ipp:66
 
static void SetInstance(T *pInstance)
DEPRECATED.
Definition: Singleton.ipp:100
 
~Singleton(void)
The protected destructor.
 
Singleton< T > SingletonBase
Defines this type to be used from derived classes.
Definition: Singleton.hxx:26
 
static Instance & CreateInstance(Args &&... args)
Creates this singleton instance.
Definition: Singleton.ipp:31
 
static Instance & GetInstance(void)
Gets a reference of the singleton instance.
Definition: Singleton.ipp:53
 
static bool IsCreated(void)
Determines if this singleton instance is create yet.
Definition: Singleton.ipp:44
 
Singleton(void)
The protected default constructor.
 
Root namespace for the PLCnext API