Multicast delegate — holds zero or more callbacks with the same signature and invokes them all. More...
#include <kanzi/core/util/delegate.hpp>
Public Types | |
| using | Callback |
Public Member Functions | |
| bool | empty () const |
| Returns true if no callbacks are subscribed. | |
| template<typename... Args> | |
| void | invoke (Args &&... args) const |
| Invokes all subscribed callbacks with the given arguments. | |
| DelegateHandle | subscribe (Callback callback) |
| Subscribes a callback. Returns a handle that can be passed to unsubscribe(). | |
| void | unsubscribe (DelegateHandle handle) |
| Removes the callback registered with the given handle. No-op if the handle is not found. | |
Multicast delegate — holds zero or more callbacks with the same signature and invokes them all.
subscribe() returns a DelegateHandle used to unsubscribe a specific callback later.
| using kanzi::Delegate< F >::Callback |
|
inline |
Subscribes a callback. Returns a handle that can be passed to unsubscribe().
|
inline |
Removes the callback registered with the given handle. No-op if the handle is not found.
|
inline |
Invokes all subscribed callbacks with the given arguments.
|
inline |
Returns true if no callbacks are subscribed.