Static Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
openfluid::utils::KillableSingleton< T > Class Template Reference

#include <utils/KillableSingleton.hpp>

Static Public Member Functions

static T * instance ()
 
static void kill ()
 

Protected Member Functions

 KillableSingleton ()
 
 ~KillableSingleton ()
 

Static Protected Attributes

static T * mp_Instance
 

Detailed Description

template<typename T>
class openfluid::utils::KillableSingleton< T >

Singleton template class implementing a killable singleton design. This implementation is not thread safe.

Warning
This template class does not work in a cross-dll context on Windows. Due to this restriction, it must not be used in the OpenFLUID framework.

Example of use to design an Example class as a killable singleton

class Example : public openfluid::utils::KillableSingleton<Example>
{
friend class openfluid::utils::KillableSingleton<Example>;
private:
Example();
~Example();
public:
// some public members
};

Constructor & Destructor Documentation

template<typename T >
openfluid::utils::KillableSingleton< T >::KillableSingleton ( )
inlineprotected
template<typename T >
openfluid::utils::KillableSingleton< T >::~KillableSingleton ( )
inlineprotected

Member Function Documentation

template<typename T >
static T* openfluid::utils::KillableSingleton< T >::instance ( )
inlinestatic

Returns a pointer to the singleton object. Instantiates the class if it not has not been instantiated before or it has been killed before.

Returns
A pointer to the singleton object
template<typename T >
static void openfluid::utils::KillableSingleton< T >::kill ( )
inlinestatic

Kills the singleton class

Member Data Documentation

template<typename T >
T * openfluid::utils::KillableSingleton< T >::mp_Instance
staticprotected

The documentation for this class was generated from the following file: