sigx++  2.0.1
Data Structures | Public Types | Public Member Functions
sigx::tunnel_functor< ASYNC, T_functor > Struct Template Reference

creates a tunnel on the given functor. More...

#include <tunnel_functor.h>

Inheritance diagram for sigx::tunnel_functor< ASYNC, T_functor >:
sigx::tunnel_base

Data Structures

struct  deduce_result_type

Public Types

typedef sigc::adapts
< T_functor >::adaptor_type 
adaptor_type
typedef adaptor_type::result_type result_type

Public Member Functions

result_type operator() ()
result_type sun_forte_workaround ()
template<typename T_arg1 >
deduce_result_type< T_arg1 >::type operator() (T_arg1 _A_arg1)
template<typename T_arg1 >
deduce_result_type< T_arg1 >::type sun_forte_workaround (T_arg1 _A_arg1)
template<typename T_arg1 , typename T_arg2 >
deduce_result_type< T_arg1,
T_arg2 >::type 
operator() (T_arg1 _A_arg1, T_arg2 _A_arg2)
template<typename T_arg1 , typename T_arg2 >
deduce_result_type< T_arg1,
T_arg2 >::type 
sun_forte_workaround (T_arg1 _A_arg1, T_arg2 _A_arg2)
template<typename T_arg1 , typename T_arg2 , typename T_arg3 >
deduce_result_type< T_arg1,
T_arg2, T_arg3 >::type 
operator() (T_arg1 _A_arg1, T_arg2 _A_arg2, T_arg3 _A_arg3)
template<typename T_arg1 , typename T_arg2 , typename T_arg3 >
deduce_result_type< T_arg1,
T_arg2, T_arg3 >::type 
sun_forte_workaround (T_arg1 _A_arg1, T_arg2 _A_arg2, T_arg3 _A_arg3)
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 >
deduce_result_type< T_arg1,
T_arg2, T_arg3, T_arg4 >::type 
operator() (T_arg1 _A_arg1, T_arg2 _A_arg2, T_arg3 _A_arg3, T_arg4 _A_arg4)
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 >
deduce_result_type< T_arg1,
T_arg2, T_arg3, T_arg4 >::type 
sun_forte_workaround (T_arg1 _A_arg1, T_arg2 _A_arg2, T_arg3 _A_arg3, T_arg4 _A_arg4)
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 , typename T_arg5 >
deduce_result_type< T_arg1,
T_arg2, T_arg3, T_arg4, T_arg5 >
::type 
operator() (T_arg1 _A_arg1, T_arg2 _A_arg2, T_arg3 _A_arg3, T_arg4 _A_arg4, T_arg5 _A_arg5)
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 , typename T_arg5 >
deduce_result_type< T_arg1,
T_arg2, T_arg3, T_arg4, T_arg5 >
::type 
sun_forte_workaround (T_arg1 _A_arg1, T_arg2 _A_arg2, T_arg3 _A_arg3, T_arg4 _A_arg4, T_arg5 _A_arg5)
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 , typename T_arg5 , typename T_arg6 >
deduce_result_type< T_arg1,
T_arg2, T_arg3, T_arg4, T_arg5,
T_arg6 >::type 
operator() (T_arg1 _A_arg1, T_arg2 _A_arg2, T_arg3 _A_arg3, T_arg4 _A_arg4, T_arg5 _A_arg5, T_arg6 _A_arg6)
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 , typename T_arg5 , typename T_arg6 >
deduce_result_type< T_arg1,
T_arg2, T_arg3, T_arg4, T_arg5,
T_arg6 >::type 
sun_forte_workaround (T_arg1 _A_arg1, T_arg2 _A_arg2, T_arg3 _A_arg3, T_arg4 _A_arg4, T_arg5 _A_arg5, T_arg6 _A_arg6)
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 , typename T_arg5 , typename T_arg6 , typename T_arg7 >
deduce_result_type< T_arg1,
T_arg2, T_arg3, T_arg4, T_arg5,
T_arg6, T_arg7 >::type 
operator() (T_arg1 _A_arg1, T_arg2 _A_arg2, T_arg3 _A_arg3, T_arg4 _A_arg4, T_arg5 _A_arg5, T_arg6 _A_arg6, T_arg7 _A_arg7)
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 , typename T_arg5 , typename T_arg6 , typename T_arg7 >
deduce_result_type< T_arg1,
T_arg2, T_arg3, T_arg4, T_arg5,
T_arg6, T_arg7 >::type 
sun_forte_workaround (T_arg1 _A_arg1, T_arg2 _A_arg2, T_arg3 _A_arg3, T_arg4 _A_arg4, T_arg5 _A_arg5, T_arg6 _A_arg6, T_arg7 _A_arg7)
 tunnel_functor (typename sigc::type_trait< T_functor >::take _A_func)
 Constructs an adaptor that wraps the passed functor.
void activate_validity_tracking () const
 Activates validity tracking for sigc::trackableS and tracking of a dispatcher change (e.g. when a thread finishes its execution and resets its dispatcher)
- Public Member Functions inherited from sigx::tunnel_base
 tunnel_base (const shared_dispatchable &_A_disp)
tunnel_validity_trackervalidity_tracker () const

Additional Inherited Members

- Protected Attributes inherited from sigx::tunnel_base
shared_dispatchable m_disp
tunnel_validity_tracker m_validity_tracker

Detailed Description

template<typename T_functor>
struct sigx::tunnel_functor< ASYNC, T_functor >

creates a tunnel on the given functor.

Note
expects the functor to be dispatchable. A functor is dispatchable if the class the functor operates on is derived from sigx::dispatchable or if the functor is or contains a SIGX_DISPATCH_WITH_FUNCTOR.
// if class MyThread is dispatchable, sigc::mem_fun creates a dispatchable functor.
open_tunnel(sigc::mem_fun(destobj, &MyThread::dosomething));
// otherwise, create a dispatchable functor explicitly with dispatch_with
open_tunnel_with(sigc::mem_fun(destobj, &MyThread::dosomething), dispatchable);
open_tunnel_with(sigc::ptr_fun(&MyThread::dosomething_static), dispatchable);
Attention
Never invoke an asynchronous functor with arguments passed by reference with sigc::ref() (or at least not if you don't know exactly what you are doing)!
Note
You have to be careful that T_functor, arguments bound to it and passed arguments are threadsafe. Asynchronous tunnels copy T_functor and passed arguments on invokation of the tunnel functor and destroy them in the context of the server thread (the thread receiving the message which is different from the sender thread!). e.g. never do this:
struct MyThread
{
void do_something(const GLib::RefPtr<X>& p) {}
};
Glib::RefPtr<X> p;
open_tunnel(mythread, &MyThread::do_something)(p);
For safety reasons you can apply this rule also for synchronous tunnels, although the invokation behaves differently: Still T_functor is copied but passed arguments are sent by reference to the server thread. The same rules apply for sigx::request_f

Member Typedef Documentation

template<typename T_functor >
typedef sigc::adapts<T_functor>::adaptor_type sigx::tunnel_functor< ASYNC, T_functor >::adaptor_type
template<typename T_functor >
typedef adaptor_type::result_type sigx::tunnel_functor< ASYNC, T_functor >::result_type

Constructor & Destructor Documentation

template<typename T_functor >
sigx::tunnel_functor< ASYNC, T_functor >::tunnel_functor ( typename sigc::type_trait< T_functor >::take  _A_func)
inlineexplicit

Constructs an adaptor that wraps the passed functor.

Parameters
_A_funcFunctor to invoke at the other end of the tunnel from operator()().
dispatcher_change_is_cleanupWhether a dispatcher change should be be treated as reason to destroy the tunnel
Note
The passed in functor must be a "dispatchable functor", i.e. a functor on a dispatchable's method or a functor created by sigx::dispatch_with.

Member Function Documentation

template<typename T_functor >
void sigx::tunnel_functor< ASYNC, T_functor >::activate_validity_tracking ( ) const
inline

Activates validity tracking for sigc::trackableS and tracking of a dispatcher change (e.g. when a thread finishes its execution and resets its dispatcher)

Note
activate_validity_tracking() assumes that the tunnel functor, all sigc::trackableS and the dispatcher/dispatchable are managed and accessed in the context of the calling thread.

References sigx::tunnel_validity_tracker::do_bind_to_trackable().

template<typename T_functor >
result_type sigx::tunnel_functor< ASYNC, T_functor >::operator() ( )
inline
template<typename T_functor >
template<typename T_arg1 >
deduce_result_type<T_arg1>::type sigx::tunnel_functor< ASYNC, T_functor >::operator() ( T_arg1  _A_arg1)
inline
template<typename T_functor >
template<typename T_arg1 , typename T_arg2 >
deduce_result_type<T_arg1, T_arg2>::type sigx::tunnel_functor< ASYNC, T_functor >::operator() ( T_arg1  _A_arg1,
T_arg2  _A_arg2 
)
inline
template<typename T_functor >
template<typename T_arg1 , typename T_arg2 , typename T_arg3 >
deduce_result_type<T_arg1, T_arg2, T_arg3>::type sigx::tunnel_functor< ASYNC, T_functor >::operator() ( T_arg1  _A_arg1,
T_arg2  _A_arg2,
T_arg3  _A_arg3 
)
inline
template<typename T_functor >
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 >
deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4>::type sigx::tunnel_functor< ASYNC, T_functor >::operator() ( T_arg1  _A_arg1,
T_arg2  _A_arg2,
T_arg3  _A_arg3,
T_arg4  _A_arg4 
)
inline
template<typename T_functor >
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 , typename T_arg5 >
deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5>::type sigx::tunnel_functor< ASYNC, T_functor >::operator() ( T_arg1  _A_arg1,
T_arg2  _A_arg2,
T_arg3  _A_arg3,
T_arg4  _A_arg4,
T_arg5  _A_arg5 
)
inline
template<typename T_functor >
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 , typename T_arg5 , typename T_arg6 >
deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6>::type sigx::tunnel_functor< ASYNC, T_functor >::operator() ( T_arg1  _A_arg1,
T_arg2  _A_arg2,
T_arg3  _A_arg3,
T_arg4  _A_arg4,
T_arg5  _A_arg5,
T_arg6  _A_arg6 
)
inline
template<typename T_functor >
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 , typename T_arg5 , typename T_arg6 , typename T_arg7 >
deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>::type sigx::tunnel_functor< ASYNC, T_functor >::operator() ( T_arg1  _A_arg1,
T_arg2  _A_arg2,
T_arg3  _A_arg3,
T_arg4  _A_arg4,
T_arg5  _A_arg5,
T_arg6  _A_arg6,
T_arg7  _A_arg7 
)
inline
template<typename T_functor >
result_type sigx::tunnel_functor< ASYNC, T_functor >::sun_forte_workaround ( )
inline
template<typename T_functor >
template<typename T_arg1 >
deduce_result_type<T_arg1>::type sigx::tunnel_functor< ASYNC, T_functor >::sun_forte_workaround ( T_arg1  _A_arg1)
inline
template<typename T_functor >
template<typename T_arg1 , typename T_arg2 >
deduce_result_type<T_arg1, T_arg2>::type sigx::tunnel_functor< ASYNC, T_functor >::sun_forte_workaround ( T_arg1  _A_arg1,
T_arg2  _A_arg2 
)
inline
template<typename T_functor >
template<typename T_arg1 , typename T_arg2 , typename T_arg3 >
deduce_result_type<T_arg1, T_arg2, T_arg3>::type sigx::tunnel_functor< ASYNC, T_functor >::sun_forte_workaround ( T_arg1  _A_arg1,
T_arg2  _A_arg2,
T_arg3  _A_arg3 
)
inline
template<typename T_functor >
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 >
deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4>::type sigx::tunnel_functor< ASYNC, T_functor >::sun_forte_workaround ( T_arg1  _A_arg1,
T_arg2  _A_arg2,
T_arg3  _A_arg3,
T_arg4  _A_arg4 
)
inline
template<typename T_functor >
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 , typename T_arg5 >
deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5>::type sigx::tunnel_functor< ASYNC, T_functor >::sun_forte_workaround ( T_arg1  _A_arg1,
T_arg2  _A_arg2,
T_arg3  _A_arg3,
T_arg4  _A_arg4,
T_arg5  _A_arg5 
)
inline
template<typename T_functor >
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 , typename T_arg5 , typename T_arg6 >
deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6>::type sigx::tunnel_functor< ASYNC, T_functor >::sun_forte_workaround ( T_arg1  _A_arg1,
T_arg2  _A_arg2,
T_arg3  _A_arg3,
T_arg4  _A_arg4,
T_arg5  _A_arg5,
T_arg6  _A_arg6 
)
inline
template<typename T_functor >
template<typename T_arg1 , typename T_arg2 , typename T_arg3 , typename T_arg4 , typename T_arg5 , typename T_arg6 , typename T_arg7 >
deduce_result_type<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>::type sigx::tunnel_functor< ASYNC, T_functor >::sun_forte_workaround ( T_arg1  _A_arg1,
T_arg2  _A_arg2,
T_arg3  _A_arg3,
T_arg4  _A_arg4,
T_arg5  _A_arg5,
T_arg6  _A_arg6,
T_arg7  _A_arg7 
)
inline

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