|
HikoGUI
A low latency retained GUI
|
#include <ttauri/notifier.hpp>
Public Types | |
| using | callback_type = std::function<Result(Args const &...)> |
| using | callback_ptr_type = std::shared_ptr<callback_type> |
Public Member Functions | |
| void | subscribe_ptr (callback_ptr_type const &callback_ptr) noexcept |
| Add a callback to the notifier. | |
| template<typename Callback > | |
| callback_ptr_type | subscribe (Callback &&callback) noexcept |
| Add a callback to the notifier. | |
| void | unsubscribe (callback_ptr_type const &callback_ptr) noexcept |
| Remove a callback from the notifier. | |
| void | operator() (Args const &...args) const noexcept |
| Call the subscribed callbacks with the given arguments. | |
A notifier which can be used to call a set of registered callbacks.
This class is thread-safe; however you must not use this object from within the callback.
| Result | The result of calling the callback. |
| Args | The argument types of the callback function. |
|
inlinenoexcept |
Call the subscribed callbacks with the given arguments.
| args | The arguments to pass with the invocation of the callback |
|
inlinenoexcept |
Add a callback to the notifier.
Ownership of the callback belongs with the caller of subscribe(). The notifier will hold a weak_ptr to the callback so that when the callback is destroyed it will no longer be called.
| callback | The callback-function to register. |
|
inlinenoexcept |
Add a callback to the notifier.
Ownership of the callback belongs with the caller of subscribe(). The notifier will hold a weak_ptr to the callback so that when the callback is destroyed it will no longer be called.
| callback_ptr | A shared_ptr to a callback function. |
|
inlinenoexcept |
Remove a callback from the notifier.
| callback_ptr | A share_ptr to the callback function to unsubscribe. |