CObservable Class Reference

OpenViBE Observable class. More...

Inheritance diagram for CObservable:
IBox IScenario

Public Member Functions

virtual void addObserver (IObserver *o)
 Add the observer give in parameter in the list of observers of the object. More...
 
virtual void deleteObserver (IObserver *o)
 Remove the observer give in parameter from the list of observers of the object. Only the first occurence of the observer will be remove from the list. More...
 

Protected Member Functions

virtual void setChanged ()
 This function is used to indicate when the notification need to reach the observers. If this function is not called before notifyObserver, the notification will be ignore. More...
 
virtual void clearChanged ()
 Revert the effect of setChanged.
 
virtual OpenViBE::boolean hasChanged ()
 Indicate if some change have been made. More...
 
virtual void notifyObservers (void *data=NULL)
 Notify all registered observers. More...
 

Detailed Description

OpenViBE Observable class.

Author
Guillaume Serrière (Inria/Loria)
Date
2014-11-7 This class furnished all mecanisms to handle the Observable part of the Observer/Observable pattern implementation of OpenViBE.

Member Function Documentation

void addObserver ( IObserver o)
virtual

Add the observer give in parameter in the list of observers of the object.

Parameters
o[in] : the observer to add
Note
A same observer can be add multiple time.
void deleteObserver ( IObserver o)
virtual

Remove the observer give in parameter from the list of observers of the object. Only the first occurence of the observer will be remove from the list.

Parameters
o[in] : the observer to remove
void setChanged ( )
protectedvirtual

This function is used to indicate when the notification need to reach the observers. If this function is not called before notifyObserver, the notification will be ignore.

Note
The "changed" state will be reverted after each call to clearChanged and notifyObservers.
boolean hasChanged ( )
protectedvirtual

Indicate if some change have been made.

Returns
true if setChanged have been called this the last clearChanged/notifyObservers call.
false in other case.
void notifyObservers ( void *  data = NULL)
protectedvirtual

Notify all registered observers.

Parameters
data[in] : a pointer to data that will be send to observers.