![]() |
Radium Engine
1.6.3
|
#include <Core/Utils/Observable.hpp>
Inheritance diagram for Ra::Core::Utils::Observable< Args >:
Collaboration diagram for Ra::Core::Utils::Observable< Args >:Public Types | |
| using | Observer = std::function<void( Args... )> |
| Observer functor type. | |
Public Member Functions | |
| Observable ()=default | |
| Default constructor ... do nothing ;) | |
| Observable (const Observable &)=delete | |
| Observable & | operator= (const Observable &)=delete |
| void | copyObserversTo (Observable &other) const |
explicit copy of all attached observers the other Observable | |
| int | attach (Observer observer) |
| template<typename T > | |
| int | attachMember (T *object, void(T::*observer)(Args...)) |
| void | notify (Args... p) const |
Notify (i.e. call) each attached observer with argument p. | |
| void | detachAll () |
| Detach all observers. | |
| void | detach (int observerId) |
Simple observable implementation with void observer(Args...) notification. Typical usage is to derive from Observer with the intended Args as in
Also a class can have Observable members, than act as slots
Definition at line 33 of file Observable.hpp.
| using Ra::Core::Utils::Observable< Args >::Observer = std::function<void( Args... )> |
Observer functor type.
Definition at line 37 of file Observable.hpp.
|
inline |
Attach an observer that will be call on subsecant call to notify()
Definition at line 54 of file Observable.hpp.
|
inline |
Utility function that extract the observer from a class member. Attach an observer that will be call on subsecant call to notify()
Definition at line 63 of file Observable.hpp.
Here is the call graph for this function:
|
inline |
explicit copy of all attached observers the other Observable
Definition at line 46 of file Observable.hpp.
Here is the call graph for this function:
|
inline |
Detach the observerId, observerId must have been saved from a previous call to attach
Definition at line 77 of file Observable.hpp.
|
inline |
Detach all observers.
Definition at line 73 of file Observable.hpp.
|
inline |
Notify (i.e. call) each attached observer with argument p.
Definition at line 67 of file Observable.hpp.
Here is the call graph for this function: