Sen API
Sen Libraries
Loading...
Searching...
No Matches
sen::Callback< InfoClass, Args > Class Template Referencefinal

Base class for event or method callbacks. It stores the queue where to push the response. The queue can be obtained directly as an argument, or through an object. More...

#include <callback.h>

Inheritance diagram for sen::Callback< InfoClass, Args >:

Public Types

using Function = sen::std_util::move_only_function<void(MaybeRef<Args>...)>
using FunctionWithCallInfo = sen::std_util::move_only_function<void(const InfoClass&, MaybeRef<Args>...)>
using CallbackFunc = std::variant<Function, FunctionWithCallInfo>

Public Member Functions

 Callback ()=default
 ~Callback () override=default
 Callback (impl::WorkQueue *queue, CallbackFunc &&function) noexcept
 A callback with an explicit queue and a callable.
 Callback (NativeObject *obj, CallbackFunc &&function) noexcept
 A callback where the queue is extracted from an object and a callable. If the object gets deleted the callback won't be executed.
template<typename C>
 Callback (C *obj, void(C::*function)(MaybeRef< Args >...))
 A callback where the queue is extracted from an object and a function pointer to a member. If the object gets deleted the callback won't be executed.
template<typename C>
 Callback (C *obj, void(C::*function)(const InfoClass &, MaybeRef< Args >...))
 A callback where the queue is extracted from an object and a function pointer to member that also receives meta information.
void invoke (const InfoClass &info, MaybeRef< Args >... args) const
 Invokes the function passed in the constructor.

Detailed Description

template<typename InfoClass, typename... Args>
class sen::Callback< InfoClass, Args >

Base class for event or method callbacks. It stores the queue where to push the response. The queue can be obtained directly as an argument, or through an object.

Member Typedef Documentation

◆ Function

template<typename InfoClass, typename... Args>
using sen::Callback< InfoClass, Args >::Function = sen::std_util::move_only_function<void(MaybeRef<Args>...)>

◆ FunctionWithCallInfo

template<typename InfoClass, typename... Args>
using sen::Callback< InfoClass, Args >::FunctionWithCallInfo = sen::std_util::move_only_function<void(const InfoClass&, MaybeRef<Args>...)>

◆ CallbackFunc

template<typename InfoClass, typename... Args>
using sen::Callback< InfoClass, Args >::CallbackFunc = std::variant<Function, FunctionWithCallInfo>

Constructor & Destructor Documentation

◆ Callback() [1/5]

template<typename InfoClass, typename... Args>
sen::Callback< InfoClass, Args >::Callback ( )
default

◆ ~Callback()

template<typename InfoClass, typename... Args>
sen::Callback< InfoClass, Args >::~Callback ( )
overridedefault

◆ Callback() [2/5]

template<typename InfoClass, typename... Args>
sen::Callback< InfoClass, Args >::Callback ( impl::WorkQueue * queue,
CallbackFunc && function )
inlinenoexcept

A callback with an explicit queue and a callable.

◆ Callback() [3/5]

template<typename InfoClass, typename... Args>
sen::Callback< InfoClass, Args >::Callback ( NativeObject * obj,
CallbackFunc && function )
inlinenoexcept

A callback where the queue is extracted from an object and a callable. If the object gets deleted the callback won't be executed.

◆ Callback() [4/5]

template<typename InfoClass, typename... Args>
template<typename C>
sen::Callback< InfoClass, Args >::Callback ( C * obj,
void(C::* function )(MaybeRef< Args >...) )
inline

A callback where the queue is extracted from an object and a function pointer to a member. If the object gets deleted the callback won't be executed.

◆ Callback() [5/5]

template<typename InfoClass, typename... Args>
template<typename C>
sen::Callback< InfoClass, Args >::Callback ( C * obj,
void(C::* function )(const InfoClass &, MaybeRef< Args >...) )
inline

A callback where the queue is extracted from an object and a function pointer to member that also receives meta information.

Member Function Documentation

◆ invoke()

template<typename InfoClass, typename... Args>
void sen::Callback< InfoClass, Args >::invoke ( const InfoClass & info,
MaybeRef< Args >... args ) const
inline

Invokes the function passed in the constructor.


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