LBIBCell
 All Classes Functions Variables Friends Pages
UtilLib::Singleton< T > Class Template Reference

#include <Singleton.hpp>

Public Member Functions

 Singleton ()=delete
 
 Singleton (const Singleton &S)=delete
 
Singletonoperator= (const Singleton &S)=delete
 
 ~Singleton ()
 

Static Public Member Functions

static T & instance ()
 

Detailed Description

template<class T>
class UtilLib::Singleton< T >

Singleton holder template class. Template class to create singletons. A singleton instance of class MyType is created and accessed using

typedef Singleton<MyType> MySingletonType;
MyType& myRef = MySingletonType::instance()
// ... do something ...

Definition at line 38 of file Singleton.hpp.

Constructor & Destructor Documentation

template<class T >
UtilLib::Singleton< T >::Singleton ( )
delete

Deleted constructor to disallow explicit construction. Is not defined.

template<class T >
UtilLib::Singleton< T >::Singleton ( const Singleton< T > &  S)
delete

Deleted copy constructor to disallow explicit copying. Is not defined.

Parameters
SA singleton object.
template<class T >
UtilLib::Singleton< T >::~Singleton ( )

Destructor.

Definition at line 103 of file Singleton.hpp.

Member Function Documentation

template<class T >
T & UtilLib::Singleton< T >::instance ( )
static

Return a reference to the only instance of Singleton<T>.

Returns
A reference to the instance of the object.

Returns the unique instance of class T. If it was already deleted an exception is thrown. If the class T was never used before a new instance is generated.

Returns
Unique instance of class T

Definition at line 90 of file Singleton.hpp.

template<class T >
Singleton& UtilLib::Singleton< T >::operator= ( const Singleton< T > &  S)
delete

Deleted assignment operator to disallow explicit assignment.

Parameters
SA singleton object.
Returns
The current singleton.

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