Callback slot to hold and trigger multiple callbacks.
More...
#include <callback_slot.hpp>
|
| int | add (const std::function< Func > &callback) |
| | Add a new callback.
|
| |
| void | remove (int callback_id) |
| | Remove a callback.
|
| |
| | operator bool () const |
| | Check if the slot has a valid callback.
|
| |
| template<class... Args> |
| void | call (Args &&... args) const |
| | Call all the registered callbacks.
|
| |
| template<class... Args> |
| void | operator() (Args &&... args) const |
| | Call all the registered callbacks.
|
| |
template<typename Func>
class CallbackSlot< Func >
Callback slot to hold and trigger multiple callbacks.
◆ add()
template<typename Func >
| int CallbackSlot< Func >::add |
( |
const std::function< Func > & |
callback | ) |
|
|
inline |
Add a new callback.
- Parameters
-
| callback | Callback to be registered |
- Returns
- int Callback ID
◆ call()
template<typename Func >
template<class... Args>
Call all the registered callbacks.
- Parameters
-
| args | Arguments for the callbacks |
◆ operator bool()
Check if the slot has a valid callback.
- Returns
- true The slot has at least one valid callback
-
false No valid callbacks
◆ operator()()
template<typename Func >
template<class... Args>
| void CallbackSlot< Func >::operator() |
( |
Args &&... |
args | ) |
const |
|
inline |
Call all the registered callbacks.
- Parameters
-
| args | Arguments for the callbacks |
◆ remove()
Remove a callback.
- Parameters
-
The documentation for this class was generated from the following file: