#include <Singleton.h>
It is used as follows.
class TheRulbusDeviceList : public Singleton<TheRulbusDeviceList> { friend class Singleton<TheRulbusDeviceList>; // implementation };
If the instance cannot be created via the default constructor, static function instance() must be overridden to create the (single) instance, for example:
inline TheRulbusInterfaceRef TheRulbusInterface::instance() { if ( 0 == theInstance ) { theInstance = RulbusInterfaceFactory::createInterface(); } return *theInstance; }
Static Public Member Functions | |
T & | instance () |
return the instance, creating it if necessary. | |
Static Protected Attributes | |
T * | theInstance = 0 |
the single instance. |