Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)
« « « Anklang Documentation |
Reentrant callback list with configurable arguments. More...
#include "callback.hh"
Public Types | |
using | Callback = std::function< void(const A &...)> |
Public Member Functions | |
ASE_DEFINE_MAKE_SHARED (CallbackList) | |
bool | empty () const |
Check if the callback list is empty, i.e. invocation will not call any callbacks. | |
bool | del (size_t id) |
Delete a previously added callback via its id, returns if any was found. | |
size_t | add (const Callback &f) |
Add a callback, returns an id that can be used for deletion. | |
std::function< void()> | add_delcb (const Callback &f) |
Add a callback and return a deleter that removes the callback when invoked. | |
void | call (const std::function< void(const Callback &, const A &...)> &wrapper, const A &...args) |
Call all callbacks in the order they were added via wrapper function. | |
void | operator() (const A &...args) |
Call all callbacks in the order they were added. | |
![]() | |
T | enable_shared_from_this (T... args) |
T | operator= (T... args) |
T | shared_from_this (T... args) |
T | weak_from_this (T... args) |
T | ~enable_shared_from_this (T... args) |
Reentrant callback list with configurable arguments.
Definition at line 13 of file callback.hh.
using Ase::CallbackList< A >::Callback = std::function<void(const A&...)> |
Definition at line 17 of file callback.hh.
size_t Ase::CallbackList< A >::add | ( | const Callback & | f | ) |
Add a callback, returns an id that can be used for deletion.
Definition at line 23 of file callback.hh.
std::function< void()> Ase::CallbackList< A >::add_delcb | ( | const Callback & | f | ) |
Add a callback and return a deleter that removes the callback when invoked.
Definition at line 26 of file callback.hh.
References ASE_ASSERT_RETURN, and std::enable_shared_from_this< CallbackList< A... > >::shared_from_this().
void Ase::CallbackList< A >::call | ( | const std::function< void(const Callback &, const A &...)> & | wrapper, |
const A &... | args | ||
) |
Call all callbacks in the order they were added via wrapper function.
Definition at line 36 of file callback.hh.
References ASE_ASSERT_RETURN, std::vector::begin(), std::vector::end(), std::vector::erase(), std::vector::push_back(), std::remove_if(), and std::vector::size().
Referenced by Ase::CallbackList< A >::operator()().
bool Ase::CallbackList< A >::del | ( | size_t | id | ) |
Delete a previously added callback via its id, returns if any was found.
Definition at line 21 of file callback.hh.
bool Ase::CallbackList< A >::empty | ( | ) | const |
Check if the callback list is empty, i.e. invocation will not call any callbacks.
Definition at line 19 of file callback.hh.
References std::vector::empty().
void Ase::CallbackList< A >::operator() | ( | const A &... | args | ) |
Call all callbacks in the order they were added.
Definition at line 51 of file callback.hh.
References Ase::CallbackList< A >::call().