Base class for an event handler. More...
Public Types | |
| typedef EventObserver< Args... > | ObserverType |
Public Member Functions | |
| void | attach (ObserverType *o) |
| Attaches the observer o to this observable. | |
| void | detach (ObserverType *o) |
| Detaches the observer o from this observable. | |
| template<typename Lambda> | |
| void | attach (EventObserverPool &pool, const Lambda &lambda) |
| Adds an observer using the lambda lambda and stores a reference in pool. | |
| void | notify (Args... args) |
| Calls the observers associated with this observable. | |
| Public Member Functions inherited from Arcane::EventObservableBase | |
| EventObservableBase (const EventObservableBase &)=delete | |
| EventObservableBase (EventObservableBase &&)=delete | |
| EventObservableBase & | operator= (const EventObservableBase &)=delete |
| EventObservableBase & | operator= (EventObservableBase &&)=delete |
| bool | hasObservers () const |
| void | detachAllObservers () |
Additional Inherited Members | |
| Protected Member Functions inherited from Arcane::EventObservableBase | |
| void | _attachObserver (EventObserverBase *obs, bool is_auto_destroy) |
| void | _detachObserver (EventObserverBase *obs) |
| ConstArrayView< EventObserverBase * > | _observers () const |
Base class for an event handler.
Instances of this class cannot be copied.
This class allows registering a list of observers that can be notified when notify() is called. Args contains the list of notification parameters.
It is possible to add an observer via the attach() method. If the observer is a lambda function, it is necessary to specify an instance of EventObserverPool to manage the lifetime of the lambda, which will then be the same as that of the associated EventObserverPool.
Definition at line 194 of file arccore/src/common/arccore/common/Event.h.
| typedef EventObserver<Args...> Arcane::EventObservable< Args >::ObserverType |
Definition at line 199 of file arccore/src/common/arccore/common/Event.h.
|
inline |
Adds an observer using the lambda lambda and stores a reference in pool.
Definition at line 226 of file arccore/src/common/arccore/common/Event.h.
|
inline |
Attaches the observer o to this observable.
An exception is thrown if the observer is already attached to an observable.
Definition at line 212 of file arccore/src/common/arccore/common/Event.h.
|
inline |
Detaches the observer o from this observable.
An exception is thrown if the observer is not attached to this observable.
Definition at line 219 of file arccore/src/common/arccore/common/Event.h.
|
inline |
Calls the observers associated with this observable.
Definition at line 234 of file arccore/src/common/arccore/common/Event.h.