StaticNamedSingleton< T > Struct Template Reference

#include <namedSingleton.h>

Inheritance diagram for StaticNamedSingleton< T >:

Inheritance graph
[legend]
List of all members.

Detailed Description


template<class T> struct StaticNamedSingleton< T >

Collection of statically registered named singletons.

This class is useful as a mix-in for classes that are supposed to represent a range of named singleton instances from which a specific instance is then selected at run-time.

Parameters:
T Arbitrary type parameter; identical types will share static data.


Public Types

typedef StaticNamedSingleton This

Public Member Functions

 StaticNamedSingleton (const char *name)
virtual ~StaticNamedSingleton ()
const char * getName ()
T * getNext ()

Static Public Member Functions

static T * staticGetFirst ()
static T * staticFindSingleton (const char *name)
 Find the instance with the given name.
static EnumTablestaticCreateEnumTable ()
 Create a TorqueScript EnumTable that contains all registered instance names.
static U32 staticGetNumSingletons ()
 Return the number of registered named singletons.

Private Attributes

const char * mName
ThismNext

Static Private Attributes

static ThissmSingletons


Member Typedef Documentation

template<class T>
typedef StaticNamedSingleton StaticNamedSingleton< T >::This


Constructor & Destructor Documentation

template<class T>
StaticNamedSingleton< T >::StaticNamedSingleton ( const char *  name  ) 

template<class T>
virtual StaticNamedSingleton< T >::~StaticNamedSingleton (  )  [inline, virtual]


Member Function Documentation

template<class T>
const char * StaticNamedSingleton< T >::getName (  )  [inline]

template<class T>
T * StaticNamedSingleton< T >::getNext (  )  [inline]

template<class T>
T * StaticNamedSingleton< T >::staticGetFirst (  )  [static]

template<class T>
T * StaticNamedSingleton< T >::staticFindSingleton ( const char *  name  )  [static]

Find the instance with the given name.

Returns NULL if no such instance exists.

template<class T>
EnumTable * StaticNamedSingleton< T >::staticCreateEnumTable (  )  [static]

Create a TorqueScript EnumTable that contains all registered instance names.

template<class T>
U32 StaticNamedSingleton< T >::staticGetNumSingletons (  )  [static]

Return the number of registered named singletons.


Member Data Documentation

template<class T>
const char* StaticNamedSingleton< T >::mName [private]

template<class T>
This* StaticNamedSingleton< T >::mNext [private]

template<class T>
StaticNamedSingleton< T > * StaticNamedSingleton< T >::smSingletons [static, private]