Callback list. More...
#include <callback-list.hpp>
Public Member Functions | |
CallbackList (const CallbackList &)=default | |
CallbackList & | operator= (const CallbackList &)=default |
CallbackList (CallbackList &&)=default | |
CallbackList & | operator= (CallbackList &&)=default |
~CallbackList () override=default | |
CallbackList (std::initializer_list< BaseCallback< TArgs... >> callbacks) | |
Callback constructor from a set of callbacks. More... | |
Public Member Functions inherited from kouta::base::callback::BaseCallback< TArgs... > | |
BaseCallback ()=default | |
Default constructor. More... | |
BaseCallback (const BaseCallback &)=default | |
BaseCallback (BaseCallback &&)=default | |
BaseCallback & | operator= (const BaseCallback &)=default |
BaseCallback & | operator= (BaseCallback &&)=default |
virtual | ~BaseCallback ()=default |
void | operator() (TArgs... args) const |
Invoke the underlying callable. More... | |
Private Member Functions | |
void | invoke_callbacks (TArgs... args) |
Invoke all stored callbacks in order. More... | |
Private Attributes | |
std::vector< BaseCallback< TArgs... > > | m_callbacks |
Additional Inherited Members | |
Public Types inherited from kouta::base::callback::BaseCallback< TArgs... > | |
using | Callable = std::function< void(TArgs...)> |
The type of the callable the Callback points to. More... | |
Protected Member Functions inherited from kouta::base::callback::BaseCallback< TArgs... > | |
void | set_callable (Callable &&callable) |
Set the callable. More... | |
Callback list.
The Callback list exposes the same API as a regular Callback, but is initialized by providing a set of any kind of Callback. When the callback list is called, it will in turn invoke every Callback contained within.
The lifetime of the contained Callbacks and the objects they may point to must be guaranteed to surpass that of the Callback list itself.
TArgs | Callable arguments. |
|
default |
|
default |
|
overridedefault |
|
inline |
Callback constructor from a set of callbacks.
This constructor initializes the internal callable to point to an internal function that calls all the stored Callbacks (in order).
[in] | callbacks | Set of Callbacks to store. |
|
inlineprivate |
Invoke all stored callbacks in order.
|
default |
|
default |
|
private |