Orxonox
0.0.5 Codename: Arcturus
|
Manages a scoped singleton. More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/singleton/ScopedSingletonWrapper.h>
Public Member Functions | |
ClassScopedSingletonWrapper (const std::string &className) | |
~ClassScopedSingletonWrapper () | |
virtual void | activated () override |
Called if the Scope of the Singleton gets active (creates the instance) More... | |
virtual void | deactivated () override |
Called if the Scope of this Singleton gets deactivated (destroys the instance) More... | |
void | destroy (Destroyable *) |
Destroys the singleton instance - overloaded for Destroyable, calls Destroyable::destroy() More... | |
void | destroy (void *) |
Destroys the singleton instance - overloaded for all other pointers, calls delete. More... | |
Public Member Functions inherited from orxonox::ScopedSingletonWrapper | |
ScopedSingletonWrapper (const std::string &className) | |
Constructor: Initializes all the values. More... | |
virtual | ~ScopedSingletonWrapper ()=default |
Private Attributes | |
T * | singletonPtr_ |
Unique instance of the singleton class T. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from orxonox::ScopeListener | |
ScopeListener () | |
virtual | ~ScopeListener ()=default |
Protected Attributes inherited from orxonox::ScopedSingletonWrapper | |
const std::string | className_ |
The name of the scoped singleton class that is managed by this object. More... | |
Manages a scoped singleton.
T | The managed singleton class |
allowedToFail | If true, a specialization of this template is used, that uses try-catch blocks to handle possible failures. |
This class inherits from ScopeListener and is registered for a scope in ScopeManager and thus its functions activated() and deactivated() are called whenever the Scope changes its state.
If the Scope is activated, a new instance of T (which must be a singleton) is created. If the Scope is deactivated, the singleton is destroyed.
|
inline |
|
inline |
|
inlineoverridevirtual |
Called if the Scope of the Singleton gets active (creates the instance)
Implements orxonox::ScopeListener.
|
inlineoverridevirtual |
Called if the Scope of this Singleton gets deactivated (destroys the instance)
Implements orxonox::ScopeListener.
|
inline |
Destroys the singleton instance - overloaded for Destroyable, calls Destroyable::destroy()
|
inline |
Destroys the singleton instance - overloaded for all other pointers, calls delete.
|
private |
Unique instance of the singleton class T.