Phongo Clap RT  1.0
Simple Raytracing Renderer
Static Public Member Functions | Static Private Attributes | List of all members
Singleton< T > Class Template Reference

Makes sure that no object is instanciated twice. More...

#include <Singleton.h>

Collaboration diagram for Singleton< T >:
Collaboration graph

Static Public Member Functions

static T * Instance ()
 If the instance is null it creates one, otherwise just returns the current one. More...
 
static void destroyInstance ()
 Destroys the instance thus freeing memory from the heap. More...
 

Static Private Attributes

static T * m_Instance = NULL
 The instance of an object as an address. More...
 

Detailed Description

template<class T>
class Singleton< T >

Makes sure that no object is instanciated twice.

Definition at line 10 of file Singleton.h.

Member Function Documentation

template<class T >
static void Singleton< T >::destroyInstance ( )
inlinestatic

Destroys the instance thus freeing memory from the heap.

Definition at line 27 of file Singleton.h.

References Singleton< T >::m_Instance.

28  {
29  delete m_Instance;
30  }
static T * m_Instance
The instance of an object as an address.
Definition: Singleton.h:36

Here is the caller graph for this function:

template<class T >
static T* Singleton< T >::Instance ( )
inlinestatic

If the instance is null it creates one, otherwise just returns the current one.

Definition at line 16 of file Singleton.h.

References Singleton< T >::m_Instance.

17  {
18  if(!m_Instance)
19  {
20  m_Instance = new T;
21  }
22  return m_Instance;
23  }
static T * m_Instance
The instance of an object as an address.
Definition: Singleton.h:36

Here is the caller graph for this function:

Member Data Documentation

template<class T >
T * Singleton< T >::m_Instance = NULL
staticprivate

The instance of an object as an address.

Definition at line 36 of file Singleton.h.


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