#include <signal_f.h>
Public Types | |
typedef T_signal | signal_type |
typedef signal_f< signal_type > | self_type |
Public Member Functions | |
template<typename T_threadpriv > | |
signal_f (const shared_dispatchable &_A_disp, Glib::Private< T_threadpriv > &_A_priv, signal_type T_threadpriv::*_A_sig) | |
Constructs a signal functor from a thread private object's member signal of type T_signal. | |
template<typename T_dispatchable > | |
signal_f (T_dispatchable &_A_obj, signal_type T_dispatchable::*_A_sig) | |
Constructs a signal functor from a dispatchable's member signal of type T_signal. | |
template<typename T_obj > | |
signal_f (const shared_dispatchable &_A_disp, T_obj &_A_obj, signal_type T_obj::*_A_sig) | |
Constructs a signal functor from an object's member signal of type T_signal. | |
template<typename T_obj > | |
signal_f (const shared_dispatchable &_A_disp, sigc::const_reference_wrapper< T_obj * > _A_obj, signal_type T_obj::*_A_sig) | |
Constructs a signal functor from an object's member signal of type T_signal. Object instance is late bound. | |
template<typename T_obj > | |
signal_f (const shared_dispatchable &_A_disp, sigc::reference_wrapper< T_obj * > _A_obj, signal_type T_obj::*_A_sig) | |
template<typename T_obj , typename T_functor > | |
signal_f (const shared_dispatchable &_A_disp, sigc::const_reference_wrapper< T_obj * > _A_obj, const T_functor &_A_sig_func) | |
Constructs a signal functor from a member functor returning a signal of type T_signal and a member functor's bound object. Object instance is late bound. | |
template<typename T_obj , typename T_functor > | |
signal_f (const shared_dispatchable &_A_disp, sigc::reference_wrapper< T_obj * > _A_obj, const T_functor &_A_sig_func) | |
template<typename T_functor > | |
signal_f (const shared_dispatchable &_A_disp, const T_functor &_A_sig_func) | |
Constructs a signal functor from any functor returning a signal of type T_signal. | |
template<typename T_functor > | |
signal_f (const T_functor &_A_sig_func) | |
Constructs a signal functor from a dispatchable functor (i.e. a functor on a dispatchable's method) returning a signal of type T_signal. | |
signal_wrapper< signal_type > | operator() () const |
A signal functor is used to expose a thread's signals and replaces a traditional access function. It acts as a middle tier between two threads, creating a sigx::signal_wrapper to a signal existing in the server thread's context, handing it over to the calling thread.
A signal functor can be created from different signal sources:
Here are some examples for signal sources: From a thread private: Class MyThread has a signal "did something" in a thread private data. The class exposes this signal through a threadsafe signal wrapper.
class MyThread: public sigx::glib_threadable { protected: typedef sigc::signal<void> signal_did_something_type; public: MyThread(); // expose signal "did_something" sigx::signal_f<signal_did_something_type> signal_did_something; private: struct ThreadData { signal_did_something_type m_sigDidSomething; }; Glib::Private<ThreadData> m_threadpriv; }; MyThread::MyThread(): sigx::glib_threadable(), // params: dispatchable, thread private key, signal pointer signal_did_something(this, m_threadpriv, &ThreadData::m_sigDidSomething) {}
From an object's member function, object instance is late bound: There is a window object that exposes a button's "clicked" signal through a threadsafe signal wrapper.
class TheGUI: public Gtk::Window, public sigx::glib_auto_dispatchable { public: TheGUI(); public: // expose Gtk::Button::signal_clicked sigx::signal_f<Glib::SignalProxy0<void> > signal_button_clicked; private: Gtk::Button* m_btn; }; TheGUI::TheGUI(): Gtk::Window(), sigx::glib_auto_dispatchable(), // set up signal functor with late object instance binding signal_button_clicked(this, sigc::ref(m_btn), &Gtk::Button::signal_clicked), m_btn() { // now object instance m_btn is pointing to is created, // signal_button_clicked now has a valid object instance m_btn = manage(new Gtk::Button("notify thread")); add(*m_btn); show_all_children(); }
typedef signal_f<signal_type> sigx::signal_f< T_signal >::self_type |
typedef T_signal sigx::signal_f< T_signal >::signal_type |
sigx::signal_f< T_signal >::signal_f | ( | const shared_dispatchable & | _A_disp, | |
Glib::Private< T_threadpriv > & | _A_priv, | |||
signal_type T_threadpriv::* | _A_sig | |||
) | [inline] |
Constructs a signal functor from a thread private object's member signal of type T_signal.
_A_disp | The dispatchable to operate on. | |
_A_priv | Key to the thread private data | |
_A_sig | pointer to the thread private object's member signal |
sigx::signal_f< T_signal >::signal_f | ( | T_dispatchable & | _A_obj, | |
signal_type T_dispatchable::* | _A_sig | |||
) | [inline] |
Constructs a signal functor from a dispatchable's member signal of type T_signal.
_A_obj | The dispatchable to operate on and the object instance for _A_sig | |
_A_sig | Pointer to the _A_obj's member signal |
sigx::signal_f< T_signal >::signal_f | ( | const shared_dispatchable & | _A_disp, | |
T_obj & | _A_obj, | |||
signal_type T_obj::* | _A_sig | |||
) | [inline] |
Constructs a signal functor from an object's member signal of type T_signal.
_A_disp | The dispatchable to operate on. | |
_A_obj | The object instance for _A_sig | |
_A_sig | Pointer to the _A_obj's member signal |
sigx::signal_f< T_signal >::signal_f | ( | const shared_dispatchable & | _A_disp, | |
sigc::const_reference_wrapper< T_obj * > | _A_obj, | |||
signal_type T_obj::* | _A_sig | |||
) | [inline] |
Constructs a signal functor from an object's member signal of type T_signal. Object instance is late bound.
_A_disp | The dispatchable to operate on. | |
_A_obj | Pointer reference to the object for _A_sig | |
_A_sig | Pointer to the _A_obj's member signal |
sigx::signal_f< T_signal >::signal_f | ( | const shared_dispatchable & | _A_disp, | |
sigc::reference_wrapper< T_obj * > | _A_obj, | |||
signal_type T_obj::* | _A_sig | |||
) | [inline] |
sigx::signal_f< T_signal >::signal_f | ( | const shared_dispatchable & | _A_disp, | |
sigc::const_reference_wrapper< T_obj * > | _A_obj, | |||
const T_functor & | _A_sig_func | |||
) | [inline] |
Constructs a signal functor from a member functor returning a signal of type T_signal and a member functor's bound object. Object instance is late bound.
_A_disp | The dispatchable to operate on. | |
_A_obj | pointer reference to the object for _A_sig_func | |
_A_sig_func | Functor returning a signal of type T_signal; must take a T_obj* as argument, e.g. create the functor with sigc::mem_fun(&MyObj::signal_did_something) |
sigx::signal_f< T_signal >::signal_f | ( | const shared_dispatchable & | _A_disp, | |
sigc::reference_wrapper< T_obj * > | _A_obj, | |||
const T_functor & | _A_sig_func | |||
) | [inline] |
sigx::signal_f< T_signal >::signal_f | ( | const shared_dispatchable & | _A_disp, | |
const T_functor & | _A_sig_func | |||
) | [inline] |
Constructs a signal functor from any functor returning a signal of type T_signal.
_A_disp | The dispatchable to operate on. | |
_A_sig_func | Functor returning a signal of type T_signal |
sigx::signal_f< T_signal >::signal_f | ( | const T_functor & | _A_sig_func | ) | [inline, explicit] |
Constructs a signal functor from a dispatchable functor (i.e. a functor on a dispatchable's method) returning a signal of type T_signal.
_A_sig_func | Dispatchable functor returning a signal of type T_signal |
signal_wrapper<signal_type> sigx::signal_f< T_signal >::operator() | ( | ) | const [inline] |
References sigx::signal_f_base::m_disp, and sigx::signal_f_base::m_sigsource.