Ocean
Ocean::OceanManager Class Reference

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 OceanManagerget ()
 Returns a reference to the OceanManager object. More...
 

Private Types

typedef std::vector< SingletonDestroyFunctionSingletonDestroyFunctions
 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...
 
OceanManageroperator= (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...
 

Detailed Description

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.

See also
Singleton

Member Typedef Documentation

◆ SingletonDestroyFunction

typedef void(* Ocean::OceanManager::SingletonDestroyFunction) ()

Definition of a function pointer that releases a singleton object.

◆ SingletonDestroyFunctions

Definition of a vector holding functions to release singleton objects.

Constructor & Destructor Documentation

◆ OceanManager() [1/2]

Ocean::OceanManager::OceanManager ( )
private

Creates a new manager object.

This constructor is protected as it must not be created by a constructor directly.

◆ OceanManager() [2/2]

Ocean::OceanManager::OceanManager ( const OceanManager oceanManager)
privatedelete

Disabled copy constructor.

Parameters
oceanManagerThe manager object that would be copied

◆ ~OceanManager()

Ocean::OceanManager::~OceanManager ( )
private

Destructs this manager object.

Member Function Documentation

◆ get()

static OceanManager& Ocean::OceanManager::get ( )
static

Returns a reference to the OceanManager object.

Returns
Reference to the manager

◆ internalRelease()

static void Ocean::OceanManager::internalRelease ( )
staticprivate

Internal callback function for a std::atexit call.

◆ operator=()

OceanManager& Ocean::OceanManager::operator= ( const OceanManager oceanManager)
privatedelete

Disabled assign operator.

Parameters
oceanManagerThe manager object that would be copied

◆ registerSingleton()

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

Parameters
singletonDestroyFunctionThe function pointer that can be invoked to release the singleton, must be valid

◆ shutdown()

void Ocean::OceanManager::shutdown ( )

Explicit shutdown of all Ocean framework resources that are handled by the Singleton class implementation.

Beware: Do not call this shutdown function unless all Singletons must be released at a specific moment in the application.

Field Documentation

◆ lock_

Lock Ocean::OceanManager::lock_
private

Lock of this manager.

◆ singletonDestroyFunctions_

SingletonDestroyFunctions Ocean::OceanManager::singletonDestroyFunctions_
private

The pointers to release functions for all registered singletons.


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