Anklang C++ API 0.0.0
Loading...
Searching...
No Matches
CallbackList< A >

#include "callback.hh"

Inherits enable_shared_from_this< CallbackList< A... > >.

Public Types

usingCallback = std::function< void(const A &...)>

Public Member Functions

size_tadd (const Callback &f)
std::function< void()>add_delcb (const Callback &f)
ASE_DEFINE_MAKE_SHARED (CallbackList)
voidcall (const std::function< void(const Callback &, const A &...)> &wrapper, const A &...args)
booldel (size_t id)
boolempty () const
voidoperator() (const A &...args)

Detailed Description

template<class... A>
class Ase::CallbackList< A >

Reentrant callback list with configurable arguments.

Member Typedef Documentation

Callback

template<class... A>
using Callback = std::function<void(const A&...)>

Member Function Documentation

ASE_DEFINE_MAKE_SHARED()

template<class... A>
ASE_DEFINE_MAKE_SHARED ( CallbackList< A > )

empty()

template<class... A>
bool empty ( ) const

Check if the callback list is empty, i.e. invocation will not call any callbacks.

del()

template<class... A>
bool del ( size_t id)

Delete a previously added callback via its id, returns if any was found.

add()

template<class... A>
size_t add ( const Callback & f)

Add a callback, returns an id that can be used for deletion.

add_delcb()

template<class... A>
std::function< void()> add_delcb ( const Callback & f)

Add a callback and return a deleter that removes the callback when invoked.

call()

template<class... A>
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.

operator()()

template<class... A>
void operator() ( const A &... args)

Call all callbacks in the order they were added.