#include <request_f.h>
Public Types | |
typedef sigc::slot< void, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > | parent_type |
Public Member Functions | |
template<typename T_functor > | |
request_f (const T_functor &_A_func) | |
Constructs the request functor. |
It saves you writing request methods that have to call a handler method for the request through a tunnel,like:
class IPResolverThread: public sigx::threadable { public: void resolve(in_addr_t nIP); void stop_resolving(); }; void IPResolverThread::resolve(in_addr_t nIP) { sigx::open_tunnel(sigc::mem_fun(this, &IPResolverThread::on_resolve))(nIP); } void IPResolverThread::stop_resolving() { sigx::open_tunnel(sigc::mem_fun(this, &IPResolverThread::on_stop_resolving))(); }
Instead,delegate it to the request functor:
class IPResolverThread: public sigx::threadable { public: sigx::request_f<in_addr_t> resolve; sigx::request_f<> stop_resolving; }; IPResolverThread::IPResolverThread(): resolve(sigc::mem_fun(this, &IPResolverThread::on_resolve)),* stop_resolving(sigc::mem_fun(this, &IPResolverThread::on_stop_resolving)) {}
It is derived from sigcslot because a slot provides already all the necessary functionalities: takes a functor and creates a untyped slot representation,has function invokation operator ().
typedef sigc::slot<void,T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7> sigx::request_f< T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 >::parent_type |
sigx::request_f< T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 >::request_f | ( | const T_functor & | _A_func | ) | [inline, explicit] |
Constructs the request functor.
_A_func | A dispatchable functor,i.e. a functor on a dispatchable's method or one explicitly created with dispatch_with(). |
References SIGX_STATIC_ASSERT.