GLIM
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CallbackSlot< Func > Class Template Reference

Callback slot to hold and trigger multiple callbacks. More...

#include <callback_slot.hpp>

Public Member Functions

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.
 

Detailed Description

template<typename Func>
class CallbackSlot< Func >

Callback slot to hold and trigger multiple callbacks.

Member Function Documentation

◆ add()

template<typename Func >
int CallbackSlot< Func >::add ( const std::function< Func > &  callback)
inline

Add a new callback.

Parameters
callbackCallback to be registered
Returns
int Callback ID

◆ call()

template<typename Func >
template<class... Args>
void CallbackSlot< Func >::call ( Args &&...  args) const
inline

Call all the registered callbacks.

Parameters
argsArguments for the callbacks

◆ operator bool()

template<typename Func >
CallbackSlot< Func >::operator bool ( ) const
inline

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
argsArguments for the callbacks

◆ remove()

template<typename Func >
void CallbackSlot< Func >::remove ( int  callback_id)
inline

Remove a callback.

Parameters
callback_idCallback ID

The documentation for this class was generated from the following file: