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

#include <callback.h>

Inheritance diagram for Cgu::Callback::CallbackArg2_const_< unref, T, BoundArg1, BoundArg2, FreeArg >:
Cgu::Callback::CallbackArg< FreeArg >

Public Types

typedef void(T::* MemFunc) (BoundArg1, BoundArg2, FreeArg) const
 

Public Member Functions

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

Member Typedef Documentation

◆ MemFunc

template<bool unref, class T , class BoundArg1 , class BoundArg2 , class FreeArg >
typedef void(T::* Cgu::Callback::CallbackArg2_const_< unref, T, BoundArg1, BoundArg2, FreeArg >::MemFunc) (BoundArg1, BoundArg2, FreeArg) const

Constructor & Destructor Documentation

◆ CallbackArg2_const_()

template<bool unref, class T , class BoundArg1 , class BoundArg2 , class FreeArg >
Cgu::Callback::CallbackArg2_const_< unref, T, BoundArg1, BoundArg2, FreeArg >::CallbackArg2_const_ ( const T &  obj_,
MemFunc  func_,
typename Cgu::Param< BoundArg1 >::ParamType  arg1_,
typename Cgu::Param< BoundArg2 >::ParamType  arg2_ 
)
inline

Member Function Documentation

◆ dispatch()

template<bool unref, class T , class BoundArg1 , class BoundArg2 , class FreeArg >
void Cgu::Callback::CallbackArg2_const_< unref, T, BoundArg1, BoundArg2, 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: