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

#include <utils/MeyerSingleton.hpp>

Static Public Member Functions

static T * instance ()
 

Protected Member Functions

 MeyerSingleton ()
 

Detailed Description

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

Singleton template class implementing the Meyer's singleton design. This implementation is thread safe in C++11.

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 singleton

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

Constructor & Destructor Documentation

template<typename T >
openfluid::utils::MeyerSingleton< T >::MeyerSingleton ( )
inlineprotected

Member Function Documentation

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

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

Returns
A pointer to the singleton object

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