iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nrt::Singleton< T > Class Template Reference

#include <nrt/Core/Design/Singleton.H>

template<class T>
class nrt::Singleton< T >

A generic singleton class to enforce a single instance of a class.

The Singleton class should be inherited by any class which needs:

  1. To have only one instance
  2. To be globally accessible

Note that there are currently no guarantees on the order of destruction of Singletons, so care should be taken to never reference another Singleton in the destructor of a Singleton.

This particular implementation is from:

The following is an example use of the Singleton:

class MyClass : public Singleton<MyClass>
void doIt() {...}
int main()
Template Parameters
TThe class that is being made the singleton.

Definition at line 75 of file Singleton.H.

Inheritance diagram for nrt::Singleton< T >:

Static Public Member Functions

static T & instance ()
 Get the global, unique instance of the class T. More...

Protected Member Functions

 Singleton ()
 Only classes that inherit from Singleton can construct it via its protected default constructor.

Member Function Documentation

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