sigx++  2.0.1
Public Types | Public Member Functions
sigx::request_f< T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 > Class Template Reference

Asynchronous request functor for a sigx::threadable. More...

#include <request_f.h>

Inheritance diagram for sigx::request_f< T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 >:
sigx::noncopyable sigx::nonheapallocatable sigx::nonpointeraliasing

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. More...
 

Detailed Description

template<typename T_arg1 = sigc::nil, typename T_arg2 = sigc::nil, typename T_arg3 = sigc::nil, typename T_arg4 = sigc::nil, typename T_arg5 = sigc::nil, typename T_arg6 = sigc::nil, typename T_arg7 = sigc::nil>
class sigx::request_f< T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 >

Asynchronous request functor for a sigx::threadable.

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<> 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 sigc::slot because a slot provides already all the necessary functionalities: takes a functor and creates a untyped slot representation,has function invokation operator ().

Attention
Do not specify a return type as the first template parameter. As asynchronous tunnels actually do not have a return type,request_f omits it,thus the return type is always `void".
Note
non-copyable,not constructible on the heap (with new) and can't be pointer aliased (with operator &) to ensure that it is de-facto bound to a wrapping object.
Examples:
ipresolver/main.cpp.

Member Typedef Documentation

template<typename T_arg1 = sigc::nil, typename T_arg2 = sigc::nil, typename T_arg3 = sigc::nil, typename T_arg4 = sigc::nil, typename T_arg5 = sigc::nil, typename T_arg6 = sigc::nil, typename T_arg7 = sigc::nil>
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

Constructor & Destructor Documentation

template<typename T_arg1 = sigc::nil, typename T_arg2 = sigc::nil, typename T_arg3 = sigc::nil, typename T_arg4 = sigc::nil, typename T_arg5 = sigc::nil, typename T_arg6 = sigc::nil, typename T_arg7 = sigc::nil>
template<typename T_functor >
sigx::request_f< T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7 >::request_f ( const T_functor &  _A_func)
inlineexplicit

Constructs the request functor.

Note
The passed in functor must not be a sigc::slot and must not be a tunnel functor. The passed in functor gets tunneled automatically.
Parameters
_A_funcA dispatchable functor,i.e. a functor on a dispatchable's method or one explicitly created with dispatch_with().

References SIGX_STATIC_ASSERT.


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