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

#include <callback.h>

Inheritance diagram for Cgu::Callback::CallbackArg0< T, FreeArg >:
Cgu::Callback::CallbackArg< FreeArg >

Public Types

typedef void(T::* MemFunc) (FreeArg)
 

Public Member Functions

void dispatch (typename Cgu::Param< FreeArg >::ParamType free_arg) const
 
 CallbackArg0 (T &obj_, MemFunc func_)
 
- Public Member Functions inherited from Cgu::Callback::CallbackArg< FreeArg >
 CallbackArg ()
 
virtual ~CallbackArg ()
 

Member Typedef Documentation

◆ MemFunc

template<class T , class FreeArg >
typedef void(T::* Cgu::Callback::CallbackArg0< T, FreeArg >::MemFunc) (FreeArg)

Constructor & Destructor Documentation

◆ CallbackArg0()

template<class T , class FreeArg >
Cgu::Callback::CallbackArg0< T, FreeArg >::CallbackArg0 ( T &  obj_,
MemFunc  func_ 
)
inline

Member Function Documentation

◆ dispatch()

template<class T , class FreeArg >
void Cgu::Callback::CallbackArg0< T, FreeArg >::dispatch ( typename Cgu::Param< FreeArg >::ParamType  arg) const
inlinevirtual

This will execute the referenced function or class method encapsulated by this class. It will only throw if the dispatched function 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
argThe argument to be passed to the referenced function or class method, if any.
Note
1. 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 wrapper class.
2. This function is specialised for Callback::Callback (ie Callback::CallbackArg<void>) to take no argument, and for Callback::CallbackArg<TypeTuple<T1, T2> > and Callback::CallbackArg<TypeTuple<T1, T2, T3> > to take two and three arguments respectively.

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


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