Ocean
|
This class implements the basic manager for the Ocean framework. More...
Public Types | |
typedef void(* | SingletonDestroyFunction) () |
Definition of a function pointer that releases a singleton object. More... | |
Public Member Functions | |
void | registerSingleton (const SingletonDestroyFunction &singletonDestroyFunction) |
Registers a new singleton object. More... | |
void | shutdown () |
Explicit shutdown of all Ocean framework resources that are handled by the Singleton class implementation. More... | |
Static Public Member Functions | |
static OceanManager & | get () |
Returns a reference to the OceanManager object. More... | |
Private Types | |
typedef std::vector< SingletonDestroyFunction > | SingletonDestroyFunctions |
Definition of a vector holding functions to release singleton objects. More... | |
Private Member Functions | |
OceanManager () | |
Creates a new manager object. More... | |
OceanManager (const OceanManager &oceanManager)=delete | |
Disabled copy constructor. More... | |
~OceanManager () | |
Destructs this manager object. More... | |
OceanManager & | operator= (const OceanManager &oceanManager)=delete |
Disabled assign operator. More... | |
Static Private Member Functions | |
static void | internalRelease () |
Internal callback function for a std::atexit call. More... | |
Private Attributes | |
Lock | lock_ |
Lock of this manager. More... | |
SingletonDestroyFunctions | singletonDestroyFunctions_ |
The pointers to release functions for all registered singletons. More... | |
This class implements the basic manager for the Ocean framework.
The manager is implemented as singleton while it is not derived from the Singleton class of the Ocean framework.
This manager allows to explicitly release all resources that are connected with objects derived by the Singleton class.
However, normally there is no need to release the resources explicitly as all resources will be released automatically during the call of std::atexit.
Therefore, use the shutdown function of this manager only if there is the explicit need for releasing all existing Ocean framework resources at a specific moment in your application.
typedef void(* Ocean::OceanManager::SingletonDestroyFunction) () |
Definition of a function pointer that releases a singleton object.
|
private |
Definition of a vector holding functions to release singleton objects.
|
private |
Creates a new manager object.
This constructor is protected as it must not be created by a constructor directly.
|
privatedelete |
Disabled copy constructor.
oceanManager | The manager object that would be copied |
|
private |
Destructs this manager object.
|
static |
Returns a reference to the OceanManager object.
|
staticprivate |
Internal callback function for a std::atexit call.
|
privatedelete |
Disabled assign operator.
oceanManager | The manager object that would be copied |
void Ocean::OceanManager::registerSingleton | ( | const SingletonDestroyFunction & | singletonDestroyFunction | ) |
Registers a new singleton object.
Every registered singleton object is released by this manager if:
a) the std::atexit function invokes the default shutdown of this manager
b) the shutdown() function of this manager object (and all other manager objects in the remaining standalone dynamic libraries) are invoked explicitly
singletonDestroyFunction | The function pointer that can be invoked to release the singleton, must be valid |
void Ocean::OceanManager::shutdown | ( | ) |
|
private |
The pointers to release functions for all registered singletons.