c++-gtk-utils
Public Types | Public Member Functions | List of all members
Cgu::Callback::Callback1< unref, T, BoundArg, FreeArgs > Class Template Reference

#include <callback.h>

Inheritance diagram for Cgu::Callback::Callback1< unref, T, BoundArg, FreeArgs >:
Cgu::Callback::CallbackArg< FreeArgs... >

Public Types

typedef void(T::* MemFunc) (BoundArg, FreeArgs...)
 

Public Member Functions

void dispatch (typename Cgu::Param< FreeArgs >::ParamType... free_args) const
 
template<class Arg >
 Callback1 (T &obj_, MemFunc func_, Arg &&arg_)
 
- Public Member Functions inherited from Cgu::Callback::CallbackArg< FreeArgs... >
 CallbackArg ()
 
virtual ~CallbackArg ()
 

Member Typedef Documentation

◆ MemFunc

template<bool unref, class T , class BoundArg , class... FreeArgs>
typedef void(T::* Cgu::Callback::Callback1< unref, T, BoundArg, FreeArgs >::MemFunc) (BoundArg, FreeArgs...)

Constructor & Destructor Documentation

◆ Callback1()

template<bool unref, class T , class BoundArg , class... FreeArgs>
template<class Arg >
Cgu::Callback::Callback1< unref, T, BoundArg, FreeArgs >::Callback1 ( T &  obj_,
MemFunc  func_,
Arg &&  arg_ 
)
inline

Member Function Documentation

◆ dispatch()

template<bool unref, class T , class BoundArg , class... FreeArgs>
void Cgu::Callback::Callback1< unref, T, BoundArg, FreeArgs >::dispatch ( typename Cgu::Param< FreeArgs >::ParamType...  args) const
inlinevirtual

This will execute the referenced function, callable object or class method encapsulated by this class. It will only throw if the dispatched function, callable object or class method throws, or if the copy constructor of a free or bound argument throws and it is not a reference argument. It is thread safe if the referenced function or class method is thread safe.

Parameters
argsThe unbound arguments to be passed to the referenced function, callable object or class method, if any.
Note
We use dispatch() to execute the callback, because the callback would normally be invoked through a base class pointer. To invoke it through operator()(), use the FunctorArg or SafeFunctorArg wrapper class.

Implements Cgu::Callback::CallbackArg< FreeArgs... >.


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