Observable< T > Class Template Reference

Base class for Observable classes, takes care of relationship management between observers and observed objects. More...

#include <observer.h>

Inheritance diagram for Observable< T >:
ObservableBase

List of all members.

Public Member Functions

virtual ~Observable ()
 Besides simply destroying this object, the destructor removes this object from the list of all Observer objects watching it.
bool addObserver (const Observer *observer) const
 Adds the passed Observer to the list of observing ones and registers this object at the passed utils/observer.
bool removeObserver (const Observer *observer) const
 Removes the passed Observed object from the list of observers observing this object and de-registers this object from the passed utils/observer.
bool isObservedBy (const Observer *observer) const
 Returns whether this object is observed by the passed one.

Protected Member Functions

const std::vector< T * > getObservers () const
 Returns all observers currently registered at this observable.

Detailed Description

template<class T>
class voreen::Observable< T >

Base class for Observable classes, takes care of relationship management between observers and observed objects.

Subclass it in order to allow Observers of a certain type to monitor instances of the derived class.

Parameters:
T Type of observers that are to be allowed to register at the derived class.
Note:
It is possible to modify the observation state of const objects.
See also:
Observer

Definition at line 167 of file observer.h.


Constructor & Destructor Documentation

virtual ~Observable (  )  [inline, virtual]

Besides simply destroying this object, the destructor removes this object from the list of all Observer objects watching it.

The user does therefore not need to manually remove this object from all its observers.

Definition at line 176 of file observer.h.


Member Function Documentation

bool addObserver ( const Observer observer  )  const [inline, virtual]

Adds the passed Observer to the list of observing ones and registers this object at the passed utils/observer.

Note:
The observer must be of type T and can only be inserted once.
Parameters:
observer Observer of type T to be inserted
Returns:
true if the insertion has been successful, false otherwise

Reimplemented from ObservableBase.

Definition at line 219 of file observer.h.

bool removeObserver ( const Observer observer  )  const [inline, virtual]

Removes the passed Observed object from the list of observers observing this object and de-registers this object from the passed utils/observer.

Parameters:
observer the observer to be removed
Returns:
true if the observer was removed, false if the passed object is not registered at this observable.

Reimplemented from ObservableBase.

Definition at line 231 of file observer.h.