Orxonox
0.0.5 Codename: Arcturus
|
The ScopeManager stores the variables of the Scope templates in a statically linked context. More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/singleton/ScopeManager.h>
Public Member Functions | |
void | addListener (ScopeListener *listener, ScopeID::Value scope) |
Registers a listener for the given scope. More... | |
void | addScope (ScopeID::Value scope) |
Adds a scope and activates all listeners which are registered for this scope. More... | |
const std::set< ScopeListener * > & | getListeners (ScopeID::Value scope) |
Returns all registered listeners for a given scope. More... | |
bool | isActive (ScopeID::Value scope) |
Returns true if this scope is active. More... | |
void | removeListener (ScopeListener *listener, ScopeID::Value scope) |
Unregisters a listener for the given scope. More... | |
void | removeScope (ScopeID::Value scope) |
Removes a scope and deactivates all listeners which are registered for this scope. More... | |
Private Member Functions | |
void | activateListener (ScopeListener *listener) |
void | activateListenersForScope (ScopeID::Value scope) |
void | deactivateListener (ScopeListener *listener) |
void | deactivateListenersForScope (ScopeID::Value scope) |
Private Attributes | |
std::set< ScopeID::Value > | activeScopes_ |
std::map< ScopeID::Value, std::set< ScopeListener * > > | listeners_ |
Stores all listeners for a scope. More... | |
Static Private Attributes | |
static ScopeManager * | singletonPtr_s = nullptr |
Friends | |
class | Singleton< ScopeManager > |
Additional Inherited Members | |
Static Public Member Functions inherited from orxonox::Singleton< ScopeManager > | |
static bool | exists () |
Tells whether the singleton has been created. More... | |
static ScopeManager & | getInstance () |
Returns a reference to the singleton instance. More... | |
Protected Member Functions inherited from orxonox::Singleton< ScopeManager > | |
Singleton () | |
Constructor sets the singleton instance pointer. More... | |
virtual | ~Singleton () |
Destructor resets the singleton instance pointer. More... | |
The ScopeManager stores the variables of the Scope templates in a statically linked context.
If all Scope objects are managed by this class, they are statically linked in the core library. Without this, a new instance of Scope<T> for each T would be created in every library of Orxonox, which is of course not the desired behavior.
|
private |
|
private |
void orxonox::ScopeManager::addListener | ( | ScopeListener * | listener, |
ScopeID::Value | scope | ||
) |
Registers a listener for the given scope.
If the scope is already active, the listener is activate immediately.
void orxonox::ScopeManager::addScope | ( | ScopeID::Value | scope | ) |
Adds a scope and activates all listeners which are registered for this scope.
|
private |
|
private |
|
inline |
Returns all registered listeners for a given scope.
bool orxonox::ScopeManager::isActive | ( | ScopeID::Value | scope | ) |
Returns true if this scope is active.
void orxonox::ScopeManager::removeListener | ( | ScopeListener * | listener, |
ScopeID::Value | scope | ||
) |
Unregisters a listener for the given scope.
If the scope is still active, the listener is deactivated before removal.
void orxonox::ScopeManager::removeScope | ( | ScopeID::Value | scope | ) |
Removes a scope and deactivates all listeners which are registered for this scope.
|
friend |
|
private |
|
private |
Stores all listeners for a scope.
|
staticprivate |