8 #ifndef META_OCEAN_BASE_SINGLETON_H
9 #define META_OCEAN_BASE_SINGLETON_H
114 template <
typename T>
117 return *internalGet();
120 template <
typename T>
123 static T* singleton =
nullptr;
133 ocean_assert(singleton);
139 ocean_assert(singleton);
143 template <
typename T>
146 ocean_assert(internalGet() !=
nullptr);
147 delete internalGet();
This class implements a recursive lock object.
Definition: Lock.h:31
void registerSingleton(const SingletonDestroyFunction &singletonDestroyFunction)
Registers a new singleton object.
static OceanManager & get()
Returns a reference to the OceanManager object.
This class implements a scoped lock object for recursive lock objects.
Definition: Lock.h:135
This template class is the base class for all singleton objects.
Definition: Singleton.h:71
static void releaseSingleton()
Releases the singleton object.
Definition: Singleton.h:144
static T & get()
Returns a reference to the unique object.
Definition: Singleton.h:115
Singleton()=default
Default constructor.
static T * internalGet()
Returns a pointer to the unique object.
Definition: Singleton.h:121
Singleton & operator=(const Singleton< T > &singleton)=delete
Disabled assign operator.
Singleton(const Singleton< T > &singleton)=delete
Disabled copy constructor.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15