Interface of an observable. More...
Public Member Functions | |
| virtual | ~IObservable () |
| Frees resources. | |
| virtual void | attachObserver (IObserver *obs)=0 |
| Attaches the observer obs to this observable. | |
| virtual void | detachObserver (IObserver *obs)=0 |
| Detaches the observer obs from this observable. | |
| virtual void | notifyAllObservers ()=0 |
| Notifies all observers. | |
| virtual bool | hasObservers () const =0 |
| True if observers are attached to this observable. | |
| virtual void | detachAllObservers ()=0 |
| Detaches all observers associated with this instance. | |
Static Public Member Functions | |
| static IObservable * | createDefault () |
Interface of an observable.
An observable is an object that maintains a list of observers (IObserver) and allows them to be notified of an event via the notifyAllObserver() method.
An observer is added to the list of observers by the attachObserver() method and removed from this same list by detachObserver().
The list of attached observers is ordered, and notifications occur in the order of the list elements. If the same observer is present multiple times, it will be notified as many times as it is present.
Definition at line 47 of file arccore/src/base/arccore/base/IObservable.h.
|
inlinevirtual |
Frees resources.
Definition at line 51 of file arccore/src/base/arccore/base/IObservable.h.
|
pure virtual |
Attaches the observer obs to this observable.
It is possible to attach an observer more than once.
Implemented in Arcane::Observable.
Referenced by Arcane::ObserverPool::addObserver(), and Arcane::ObserverPool::addObserver().
|
static |
Definition at line 109 of file Observable.cc.
|
pure virtual |
Detaches all observers associated with this instance.
Implemented in Arcane::Observable.
Referenced by Arcane::ObservablePool< KeyType >::~ObservablePool().
|
pure virtual |
Detaches the observer obs from this observable.
If the observer obs is not present, nothing happens. If it is present multiple times, the last occurrence is deleted.
Implemented in Arcane::Observable.
|
pure virtual |
True if observers are attached to this observable.
Implemented in Arcane::Observable.
|
pure virtual |
Notifies all observers.
For each attached observer, calls IObserver::observerUpdate().
Implemented in Arcane::Observable.
Referenced by Arcane::Variable::notifyBeginWrite(), Arcane::Variable::notifyEndRead(), and Arcane::Variable::syncReferences().