Torque3D Documentation / _generateds / ManagedSingleton

ManagedSingleton

Engine/source/core/util/tSingleton.h

This is a managed singleton class with explict creation and destruction functions which must be called at startup and shutdown of the engine.

More...

Private Static Attributes

Public Static Functions

Create the singleton instance.

Destroy the singleton instance.

T *

Return the singleton instance.

T *

Return the singleton instance or NULL if it has been deleted or not yet constructed.

Detailed Description

This is a managed singleton class with explict creation and destruction functions which must be called at startup and shutdown of the engine.

Your class to be managed must implement the following function:

static const char* getSingletonName() { return "YourClassName"; }

This allow us to provide better asserts.

Private Static Attributes

T * smSingleton 

Public Static Functions

createSingleton()

Create the singleton instance.

note:

Asserts when the singleton instance has already been constructed.

deleteSingleton()

Destroy the singleton instance.

note:

Asserts when no singleton has been constructed.

instance()

Return the singleton instance.

note:

Asserts when called before createSingleton().

instanceOrNull()

Return the singleton instance or NULL if it has been deleted or not yet constructed.