Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
orxonox::ScopeManager Class Reference

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>

Inheritance diagram for orxonox::ScopeManager:
orxonox::Singleton< ScopeManager >

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::ValueactiveScopes_
 
std::map< ScopeID::Value, std::set< ScopeListener * > > listeners_
 Stores all listeners for a scope. More...
 

Static Private Attributes

static ScopeManagersingletonPtr_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 ScopeManagergetInstance ()
 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...
 

Detailed Description

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.

See also
See this description for details about the interrelationship of Scope, ScopeListener, and ScopeManager.

Member Function Documentation

void orxonox::ScopeManager::activateListener ( ScopeListener listener)
private
void orxonox::ScopeManager::activateListenersForScope ( ScopeID::Value  scope)
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.

void orxonox::ScopeManager::deactivateListener ( ScopeListener listener)
private
void orxonox::ScopeManager::deactivateListenersForScope ( ScopeID::Value  scope)
private
const std::set<ScopeListener*>& orxonox::ScopeManager::getListeners ( ScopeID::Value  scope)
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.

Friends And Related Function Documentation

friend class Singleton< ScopeManager >
friend

Member Data Documentation

std::set<ScopeID::Value> orxonox::ScopeManager::activeScopes_
private
std::map<ScopeID::Value, std::set<ScopeListener*> > orxonox::ScopeManager::listeners_
private

Stores all listeners for a scope.

ScopeManager * orxonox::ScopeManager::singletonPtr_s = nullptr
staticprivate

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