ASL
Singleton< T > Class Template Reference

Detailed Description

template<class T>
class asl::Singleton< T >

This class can be used to create singletons from existing classes.

These are classes of which there can only be one instance and that instance is not explicitly created.

Can be used on existing classes withoud defining one:

static T * instance()
Returns a pointer to an instance of class T, creating it on the first call.
Definition: Singleton.h:44

Or declaring a typedef:

typedef Singleton<DeviceManager> TheDeviceManager;
TheDeviceManager::instance()->initialize();

Or defining a class as a subclass of a singleton of itself:

class DeviceManager : public Singleton<DeviceManager>
{...};
DeviceManager::instance()->initialize();

#include <Singleton.h>

Static Public Member Functions

static T * instance ()
 Returns a pointer to an instance of class T, creating it on the first call.
 

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