MetriVis Overview | Download | User Manual | Development
Reference Overview | Design Documentation | Reference Backend | Reference Frontend

metrivis::Singleton< T > Class Template Reference

Template class represents the singleton pattern. More...

#include <Singleton.h>


Static Public Member Functions

static T & Instance ()
 Interface function to fetch the singleton instance.
static void Destroy ()
 Frees the the singleton memory.

Private Member Functions

 Singleton (const Singleton &singleton)
Singletonoperator= (const Singleton &singleton)

Static Private Attributes

static T *volatile singleton_instance_ = 0
 The singleton instance.
static boost::mutex instance_mutex_
 Mutex locks creation process.


Detailed Description

template<class T>
class metrivis::Singleton< T >

Template class represents the singleton pattern.

Template can be used to define singleton classes. It's a very simplified singleton implementation. Doesn't implement the dead reference problem, so be sure to delete the singletons in the correct way. Is thread save.


Member Function Documentation

template<class T>
T & metrivis::Singleton< T >::Instance (  )  [inline, static]

Interface function to fetch the singleton instance.

Returns:
Returns a reference to the singleton object.

template<class T>
void metrivis::Singleton< T >::Destroy (  )  [inline, static]

Frees the the singleton memory.

Deletes the singleton object and the mutex.


The documentation for this class was generated from the following file:
Generated on Fri Feb 29 16:47:20 2008 for MetriVis by  doxygen 1.5.3