xmscore
1.0
|
Singleton which can share the same instance with other singletons. More...
#include <Singleton.h>
Public Types | |
typedef boost::shared_ptr< T > | Ptr |
Instance pointer. | |
Static Public Member Functions | |
static Ptr | Instance (Ptr a_new=Ptr(), bool a_delete=false) |
Get a singleton instance. More... | |
static void | Delete () |
Delete the current instance. | |
Singleton which can share the same instance with other singletons.
This allows a derived instance to be accessed as either the derived type or or as the base type. A utility may need to access the instance only as a base type, not knowing anything about the derived type, while the calling code may need to access functionality in the derived type. Create this for the base type and for 1 or more derived types, initializing each to the same instance shared pointer of the most derived type. Then access that instance through any singleton that has the appropriate type.
Definition at line 82 of file Singleton.h.
|
inlinestatic |
Get a singleton instance.
a_new | A new pointer to use as the instance when called the first time or just after the instance has been deleted. |
a_delete | If true delete the current instance and RETURN AN INVALID INSTANCE. |
Definition at line 94 of file Singleton.h.