c++-gtk-utils
|
The callback interface class. More...
#include <c++-gtk-utils/callback.h>
Public Member Functions | |
virtual void | dispatch (typename Cgu::Param< FreeArg >::ParamType arg) const =0 |
CallbackArg () | |
virtual | ~CallbackArg () |
The callback interface class.
This provides the basic interface class that users will generally see. The template type is the type of the unbound argument or container of unbound argument types, if any. Callback::CallbackArg<void> is typedef'ed to Callback::Callback.
Usage
For a class object my_obj of type MyClass, with a method void MyClass::my_method(int, const char*), usage for a fully bound callback would be:
Or for a partially bound callback:
There may be up to two bound arguments and up to three unbound arguments. Callback/CallbackArg classes do not provide for a return value. If a result is wanted, users should pass an unbound argument by reference or pointer (or pointer to pointer).
For further background, including about the Callback::make() and Callback::make_ref() functions, and the use of the Cgu::TypeTuple struct for calls involving two or three unbound arguments, read this: Callback
|
inline |
The constructor will not throw unless the copy constructor of an argument bound to the derived implementation class throws.
|
inlinevirtual |
The destructor will not throw unless the destructor of an argument bound to the derived implementation class throws.
|
pure virtual |
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.
arg | The argument to be passed to the referenced function or class method, if any. |
Implemented in Cgu::Callback::CallbackArg2_static_< unref, BoundArg1, BoundArg2, FreeArg >, Cgu::Callback::CallbackArg1_static_< unref, BoundArg, FreeArg >, Cgu::Callback::CallbackArg0_static< FreeArg >, Cgu::Callback::CallbackArg2_const_< unref, T, BoundArg1, BoundArg2, FreeArg >, Cgu::Callback::CallbackArg1_const_< unref, T, BoundArg, FreeArg >, Cgu::Callback::CallbackArg0_const< T, FreeArg >, Cgu::Callback::CallbackArg2_< unref, T, BoundArg1, BoundArg2, FreeArg >, Cgu::Callback::CallbackArg1_< unref, T, BoundArg, FreeArg >, and Cgu::Callback::CallbackArg0< T, FreeArg >.