c++-gtk-utils
|
The callback interface class. More...
#include <c++-gtk-utils/callback.h>
Public Member Functions | |
virtual void | dispatch (typename Cgu::Param< FreeArgs >::ParamType...args) const =0 |
CallbackArg () | |
virtual | ~CallbackArg () |
The callback interface class.
This provides the basic interface class that users will generally see. The template types are the types of the unbound arguments, if any. Callback::CallbackArg<> is typedef'ed to Callback::Callback.
Usage
For a class object my_obj of type MyClass, with a method void MyClass::my_method(int, int, const char*), usage for a fully bound callback would be:
Or for a partially bound callback:
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(), Callback::make_ref() and Callback::lambda() functions, and the use of these classes with std::function objects, 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 the free or a bound argument throws and it is not a reference argument. It is thread safe if the referenced function or class method is thread safe.
args | The unbound arguments to be passed to the referenced function or class method, if any. |
Implemented in Cgu::Callback::Callback_lambda< Lambda, FreeArgs >, Cgu::Callback::Callback_function< FreeArgs >, Cgu::Callback::Callback5_static< unref, BoundArg1, BoundArg2, BoundArg3, BoundArg4, BoundArg5, FreeArgs >, Cgu::Callback::Callback4_static< unref, BoundArg1, BoundArg2, BoundArg3, BoundArg4, FreeArgs >, Cgu::Callback::Callback3_static< unref, BoundArg1, BoundArg2, BoundArg3, FreeArgs >, Cgu::Callback::Callback2_static< unref, BoundArg1, BoundArg2, FreeArgs >, Cgu::Callback::Callback1_static< unref, BoundArg, FreeArgs >, Cgu::Callback::Callback0_static< FreeArgs >, Cgu::Callback::Callback5_const< unref, T, BoundArg1, BoundArg2, BoundArg3, BoundArg4, BoundArg5, FreeArgs >, Cgu::Callback::Callback4_const< unref, T, BoundArg1, BoundArg2, BoundArg3, BoundArg4, FreeArgs >, Cgu::Callback::Callback3_const< unref, T, BoundArg1, BoundArg2, BoundArg3, FreeArgs >, Cgu::Callback::Callback2_const< unref, T, BoundArg1, BoundArg2, FreeArgs >, Cgu::Callback::Callback1_const< unref, T, BoundArg, FreeArgs >, Cgu::Callback::Callback0_const< T, FreeArgs >, Cgu::Callback::Callback5< unref, T, BoundArg1, BoundArg2, BoundArg3, BoundArg4, BoundArg5, FreeArgs >, Cgu::Callback::Callback4< unref, T, BoundArg1, BoundArg2, BoundArg3, BoundArg4, FreeArgs >, Cgu::Callback::Callback3< unref, T, BoundArg1, BoundArg2, BoundArg3, FreeArgs >, Cgu::Callback::Callback2< unref, T, BoundArg1, BoundArg2, FreeArgs >, Cgu::Callback::Callback1< unref, T, BoundArg, FreeArgs >, and Cgu::Callback::Callback0< T, FreeArgs >.