Helper class to implement callbacks with lifetime management. More...
#include <notifier.hpp>
Public Types | |
| typedef FUNCTOR | functor_t |
Public Member Functions | |
| notifier () | |
| ~notifier () | |
| void | connect_notifiee (notifiee< functor_t > &target, functor_t functor) |
| Connects a callback. More... | |
| void | disconnect_notifiee (notifiee< functor_t > &target) |
| Disconnects a callback. More... | |
| const std::map< notifiee< functor_t > *, functor_t > & | notifiees () const |
Private Attributes | |
| std::map< notifiee< functor_t > *, functor_t > | notifiees_ |
| List of registered callbacks. More... | |
Helper class to implement callbacks with lifetime management.
This part manages the connecting and disconnecting of the callbacks.
Subclasses should implement a way to call all callback.
Definition at line 34 of file notifier.hpp.
| typedef FUNCTOR gui2::notifier< FUNCTOR >::functor_t |
Definition at line 37 of file notifier.hpp.
|
inline |
Definition at line 39 of file notifier.hpp.
|
inline |
Definition at line 43 of file notifier.hpp.
References gui2::notifier< FUNCTOR >::notifiees_.
|
inline |
Connects a callback.
| target | The notifiee controlling the lifetime of the callback. |
| functor | The callback to call. |
Definition at line 61 of file notifier.hpp.
References gui2::notifier< FUNCTOR >::notifiees_, and gui2::notifiee< FUNCTOR >::notifier_.
|
inline |
Disconnects a callback.
| target | The notifiee controlling the lifetime of the callback. Uses since its address is an unique key. |
Definition at line 77 of file notifier.hpp.
References gui2::notifier< FUNCTOR >::notifiees_, and gui2::notifiee< FUNCTOR >::notifier_.
Referenced by gui2::notifiee< FUNCTOR >::~notifiee().
|
inline |
Definition at line 93 of file notifier.hpp.
References gui2::notifier< FUNCTOR >::notifiees_.
|
private |
List of registered callbacks.
Definition at line 100 of file notifier.hpp.
Referenced by gui2::notifier< FUNCTOR >::connect_notifiee(), gui2::notifier< FUNCTOR >::disconnect_notifiee(), gui2::notifier< FUNCTOR >::notifiees(), and gui2::notifier< FUNCTOR >::~notifier().