25 #ifndef CONNECT20110121H 26 #define CONNECT20110121H 28 #include <boost/bind.hpp> 29 #include <boost/signals2.hpp> 36 template <
typename Signal,
typename Slot>
void connect(Signal* signal, Slot slot)
38 signal->connect(slot);
42 template <
typename Signal,
typename Obj,
typename A1>
43 void connect(Signal* signal, Obj* obj,
void (Obj::*mem_func)(A1))
45 connect(signal, boost::bind(mem_func, obj, _1));
49 template <
typename Signal,
typename Obj,
typename A1,
typename A2>
50 void connect(Signal* signal, Obj* obj,
void (Obj::*mem_func)(A1, A2))
52 connect(signal, boost::bind(mem_func, obj, _1, _2));
56 template <
typename Signal,
typename Obj,
typename A1,
typename A2,
typename A3>
57 void connect(Signal* signal, Obj* obj,
void (Obj::*mem_func)(A1, A2, A3))
59 connect(signal, boost::bind(mem_func, obj, _1, _2, _3));
63 template <
typename Signal,
typename Slot>
void disconnect(Signal* signal, Slot slot)
65 signal->disconnect(slot);
69 template <
typename Signal,
typename Obj,
typename A1>
70 void disconnect(Signal* signal, Obj* obj,
void (Obj::*mem_func)(A1))
72 disconnect(signal, boost::bind(mem_func, obj, _1));
76 template <
typename Signal,
typename Obj,
typename A1,
typename A2>
77 void disconnect(Signal* signal, Obj* obj,
void (Obj::*mem_func)(A1, A2))
79 disconnect(signal, boost::bind(mem_func, obj, _1, _2));
83 template <
typename Signal,
typename Obj,
typename A1,
typename A2,
typename A3>
84 void disconnect(Signal* signal, Obj* obj,
void (Obj::*mem_func)(A1, A2, A3))
86 disconnect(signal, boost::bind(mem_func, obj, _1, _2, _3));
void connect(Signal *signal, Slot slot)
connect a signal to a slot (e.g. function pointer)
The global namespace for the Goby project.
void disconnect(Signal *signal, Slot slot)
disconnect a signal to a slot (e.g. function pointer)