diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2012-02-15 17:20:00 +0200 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2012-02-15 16:28:00 +0200 |
| commit | 6ec490fef6d30271980fa9f1aa6de45a6cdc7780 (patch) | |
| tree | b981b8469b62dc5f09ced22b646d07ce02c06e68 /sigslot.h | |
| parent | d4bc378ecfd7b546ce0299e8c3e73232a692fe76 (diff) | |
| download | sigslot-6ec490fef6d30271980fa9f1aa6de45a6cdc7780.tar.gz sigslot-6ec490fef6d30271980fa9f1aa6de45a6cdc7780.zip | |
Remove _signal_baseN classes and move functionality to signalN classes
Diffstat (limited to 'sigslot.h')
| -rw-r--r-- | sigslot.h | 1854 |
1 files changed, 825 insertions, 1029 deletions
@@ -485,19 +485,470 @@ namespace sigslot { sender_set m_senders; }; - template<class mt_policy> - class _signal_base0 : public _signal_base<mt_policy> + + + template<class dest_type, class mt_policy> + class _connection0 : public _connection_base0<mt_policy> { public: - typedef std::list<_connection_base0<mt_policy> *> connections_list; + _connection0() + { + m_pobject = NULL; + m_pmemfun = NULL; + } - _signal_base0() + _connection0(dest_type* pobject, void (dest_type::*pmemfun)()) { - ; + m_pobject = pobject; + m_pmemfun = pmemfun; } - _signal_base0(const _signal_base0& s) - : _signal_base<mt_policy>(s) + virtual ~_connection0() + { + } + + virtual _connection_base0<mt_policy>* clone() + { + return new _connection0<dest_type, mt_policy>(*this); + } + + virtual _connection_base0<mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) + { + return new _connection0<dest_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); + } + + virtual void SIGSLOT_EMIT() + { + (m_pobject->*m_pmemfun)(); + } + + virtual has_slots<mt_policy>* getdest() const + { + return m_pobject; + } + + private: + dest_type* m_pobject; + void (dest_type::* m_pmemfun)(); + }; + + template<class dest_type, class arg1_type, class mt_policy> + class _connection1 : public _connection_base1<arg1_type, mt_policy> + { + public: + _connection1() + { + m_pobject = NULL; + m_pmemfun = NULL; + } + + _connection1(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type)) + { + m_pobject = pobject; + m_pmemfun = pmemfun; + } + + virtual ~_connection1() + { + } + + virtual _connection_base1<arg1_type, mt_policy>* clone() + { + return new _connection1<dest_type, arg1_type, mt_policy>(*this); + } + + virtual _connection_base1<arg1_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) + { + return new _connection1<dest_type, arg1_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); + } + + virtual void SIGSLOT_EMIT(arg1_type a1) + { + (m_pobject->*m_pmemfun)(a1); + } + + virtual has_slots<mt_policy>* getdest() const + { + return m_pobject; + } + + private: + dest_type* m_pobject; + void (dest_type::* m_pmemfun)(arg1_type); + }; + + template<class dest_type, class arg1_type, class arg2_type, class mt_policy> + class _connection2 : public _connection_base2<arg1_type, arg2_type, mt_policy> + { + public: + _connection2() + { + m_pobject = NULL; + m_pmemfun = NULL; + } + + _connection2(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, + arg2_type)) + { + m_pobject = pobject; + m_pmemfun = pmemfun; + } + + virtual ~_connection2() + { + } + + virtual _connection_base2<arg1_type, arg2_type, mt_policy>* clone() + { + return new _connection2<dest_type, arg1_type, arg2_type, mt_policy>(*this); + } + + virtual _connection_base2<arg1_type, arg2_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) + { + return new _connection2<dest_type, arg1_type, arg2_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); + } + + virtual void SIGSLOT_EMIT(arg1_type a1, arg2_type a2) + { + (m_pobject->*m_pmemfun)(a1, a2); + } + + virtual has_slots<mt_policy>* getdest() const + { + return m_pobject; + } + + private: + dest_type* m_pobject; + void (dest_type::* m_pmemfun)(arg1_type, arg2_type); + }; + + template<class dest_type, class arg1_type, class arg2_type, class arg3_type, class mt_policy> + class _connection3 : public _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy> + { + public: + _connection3() + { + m_pobject = NULL; + m_pmemfun = NULL; + } + + _connection3(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, + arg2_type, arg3_type)) + { + m_pobject = pobject; + m_pmemfun = pmemfun; + } + + virtual ~_connection3() + { + } + + virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* clone() + { + return new _connection3<dest_type, arg1_type, arg2_type, arg3_type, mt_policy>(*this); + } + + virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) + { + return new _connection3<dest_type, arg1_type, arg2_type, arg3_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); + } + + virtual void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3) + { + (m_pobject->*m_pmemfun)(a1, a2, a3); + } + + virtual has_slots<mt_policy>* getdest() const + { + return m_pobject; + } + + private: + dest_type* m_pobject; + void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type); + }; + + template<class dest_type, class arg1_type, class arg2_type, class arg3_type, + class arg4_type, class mt_policy> + class _connection4 : public _connection_base4<arg1_type, arg2_type, + arg3_type, arg4_type, mt_policy> + { + public: + _connection4() + { + m_pobject = NULL; + m_pmemfun = NULL; + } + + _connection4(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, + arg2_type, arg3_type, arg4_type)) + { + m_pobject = pobject; + m_pmemfun = pmemfun; + } + + virtual ~_connection4() + { + } + + virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* clone() + { + return new _connection4<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>(*this); + } + + virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) + { + return new _connection4<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); + } + + virtual void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, + arg4_type a4) + { + (m_pobject->*m_pmemfun)(a1, a2, a3, a4); + } + + virtual has_slots<mt_policy>* getdest() const + { + return m_pobject; + } + + private: + dest_type* m_pobject; + void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, + arg4_type); + }; + + template<class dest_type, class arg1_type, class arg2_type, class arg3_type, + class arg4_type, class arg5_type, class mt_policy> + class _connection5 : public _connection_base5<arg1_type, arg2_type, + arg3_type, arg4_type, arg5_type, mt_policy> + { + public: + _connection5() + { + m_pobject = NULL; + m_pmemfun = NULL; + } + + _connection5(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, + arg2_type, arg3_type, arg4_type, arg5_type)) + { + m_pobject = pobject; + m_pmemfun = pmemfun; + } + + virtual ~_connection5() + { + } + + virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, mt_policy>* clone() + { + return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, mt_policy>(*this); + } + + virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) + { + return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); + } + + virtual void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, + arg5_type a5) + { + (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5); + } + + virtual has_slots<mt_policy>* getdest() const + { + return m_pobject; + } + + private: + dest_type* m_pobject; + void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type); + }; + + template<class dest_type, class arg1_type, class arg2_type, class arg3_type, + class arg4_type, class arg5_type, class arg6_type, class mt_policy> + class _connection6 : public _connection_base6<arg1_type, arg2_type, + arg3_type, arg4_type, arg5_type, arg6_type, mt_policy> + { + public: + _connection6() + { + m_pobject = NULL; + m_pmemfun = NULL; + } + + _connection6(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, + arg2_type, arg3_type, arg4_type, arg5_type, arg6_type)) + { + m_pobject = pobject; + m_pmemfun = pmemfun; + } + + virtual ~_connection6() + { + } + + virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, mt_policy>* clone() + { + return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, mt_policy>(*this); + } + + virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) + { + return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); + } + + virtual void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, + arg5_type a5, arg6_type a6) + { + (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6); + } + + virtual has_slots<mt_policy>* getdest() const + { + return m_pobject; + } + + private: + dest_type* m_pobject; + void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type); + }; + + template<class dest_type, class arg1_type, class arg2_type, class arg3_type, + class arg4_type, class arg5_type, class arg6_type, class arg7_type, class mt_policy> + class _connection7 : public _connection_base7<arg1_type, arg2_type, + arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, mt_policy> + { + public: + _connection7() + { + m_pobject = NULL; + m_pmemfun = NULL; + } + + _connection7(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, + arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type)) + { + m_pobject = pobject; + m_pmemfun = pmemfun; + } + + virtual ~_connection7() + { + } + + virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, arg7_type, mt_policy>* clone() + { + return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, arg7_type, mt_policy>(*this); + } + + virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, arg7_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) + { + return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, arg7_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); + } + + virtual void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, + arg5_type a5, arg6_type a6, arg7_type a7) + { + (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6, a7); + } + + virtual has_slots<mt_policy>* getdest() const + { + return m_pobject; + } + + private: + dest_type* m_pobject; + void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, arg7_type); + }; + + template<class dest_type, class arg1_type, class arg2_type, class arg3_type, + class arg4_type, class arg5_type, class arg6_type, class arg7_type, + class arg8_type, class mt_policy> + class _connection8 : public _connection_base8<arg1_type, arg2_type, + arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> + { + public: + _connection8() + { + m_pobject = NULL; + m_pmemfun = NULL; + } + + _connection8(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, + arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, + arg7_type, arg8_type)) + { + m_pobject = pobject; + m_pmemfun = pmemfun; + } + + virtual ~_connection8() + { + } + + virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* clone() + { + return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>(*this); + } + + virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) + { + return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); + } + + virtual void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, + arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8) + { + (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + virtual has_slots<mt_policy>* getdest() const + { + return m_pobject; + } + + private: + dest_type* m_pobject; + void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, arg7_type, arg8_type); + }; + + template<class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> + class signal0 : public _signal_base<mt_policy> + { + public: + + typedef std::list<_connection_base0<mt_policy> *> connections_list; + + signal0() + {} + + signal0(const signal0<mt_policy>& s) + : _signal_base<mt_policy>(s) { lock_block<mt_policy> lock(this); typename connections_list::const_iterator it = s.m_connected_slots.begin(); @@ -512,7 +963,7 @@ namespace sigslot { } } - ~_signal_base0() + ~signal0() { disconnect_all(); } @@ -618,22 +1069,54 @@ namespace sigslot { } } + template<class desttype> + void connect(desttype* pclass, void (desttype::*pmemfun)()) + { + lock_block<mt_policy> lock(this); + _connection0<desttype, mt_policy>* conn = + new _connection0<desttype, mt_policy>(pclass, pmemfun); + m_connected_slots.push_back(conn); + pclass->signal_connect(this); + } + + void SIGSLOT_EMIT() + { + lock_block<mt_policy> lock(this); + typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); + typename connections_list::const_iterator itEnd = m_connected_slots.end(); + + while(it != itEnd) + { + itNext = it; + ++itNext; + + (*it)->SIGSLOT_EMIT(); + + it = itNext; + } + } + + void operator()() + { + SIGSLOT_EMIT(); + } + protected: + connections_list m_connected_slots; }; - template<class arg1_type, class mt_policy> - class _signal_base1 : public _signal_base<mt_policy> + template<class arg1_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> + class signal1 : public _signal_base<mt_policy> { public: - typedef std::list<_connection_base1<arg1_type, mt_policy> *> connections_list; - _signal_base1() - { - ; - } + typedef std::list<_connection_base1<arg1_type, mt_policy> *> connections_list; - _signal_base1(const _signal_base1<arg1_type, mt_policy>& s) + signal1() + {} + + signal1(const signal1<arg1_type, mt_policy>& s) : _signal_base<mt_policy>(s) { lock_block<mt_policy> lock(this); @@ -647,7 +1130,12 @@ namespace sigslot { ++it; } - } + } + + ~signal1() + { + disconnect_all(); + } void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget) { @@ -666,11 +1154,6 @@ namespace sigslot { } } - ~_signal_base1() - { - disconnect_all(); - } - bool is_empty() { lock_block<mt_policy> lock(this); @@ -755,24 +1238,57 @@ namespace sigslot { } } + template<class desttype> + void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type)) + { + lock_block<mt_policy> lock(this); + _connection1<desttype, arg1_type, mt_policy>* conn = + new _connection1<desttype, arg1_type, mt_policy>(pclass, pmemfun); + m_connected_slots.push_back(conn); + pclass->signal_connect(this); + } + + void SIGSLOT_EMIT(arg1_type a1) + { + lock_block<mt_policy> lock(this); + typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); + typename connections_list::const_iterator itEnd = m_connected_slots.end(); + + while(it != itEnd) + { + itNext = it; + ++itNext; + + (*it)->SIGSLOT_EMIT(a1); + + it = itNext; + } + } + + void operator()(arg1_type a1) + { + SIGSLOT_EMIT(a1); + } protected: + connections_list m_connected_slots; }; - template<class arg1_type, class arg2_type, class mt_policy> - class _signal_base2 : public _signal_base<mt_policy> + template<class arg1_type, class arg2_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> + class signal2 : public _signal_base<mt_policy> { public: + typedef std::list<_connection_base2<arg1_type, arg2_type, mt_policy> *> connections_list; - _signal_base2() + signal2() { ; } - _signal_base2(const _signal_base2<arg1_type, arg2_type, mt_policy>& s) + signal2(const signal2<arg1_type, arg2_type, mt_policy>& s) : _signal_base<mt_policy>(s) { lock_block<mt_policy> lock(this); @@ -788,6 +1304,11 @@ namespace sigslot { } } + ~signal2() + { + disconnect_all(); + } + void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget) { lock_block<mt_policy> lock(this); @@ -805,11 +1326,6 @@ namespace sigslot { } } - ~_signal_base2() - { - disconnect_all(); - } - bool is_empty() { lock_block<mt_policy> lock(this); @@ -894,23 +1410,54 @@ namespace sigslot { } } + template<class desttype> + void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, + arg2_type)) + { + lock_block<mt_policy> lock(this); + _connection2<desttype, arg1_type, arg2_type, mt_policy>* conn = new + _connection2<desttype, arg1_type, arg2_type, mt_policy>(pclass, pmemfun); + m_connected_slots.push_back(conn); + pclass->signal_connect(this); + } + + void SIGSLOT_EMIT(arg1_type a1, arg2_type a2) + { + lock_block<mt_policy> lock(this); + typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); + typename connections_list::const_iterator itEnd = m_connected_slots.end(); + + while(it != itEnd) + { + itNext = it; + ++itNext; + + (*it)->SIGSLOT_EMIT(a1, a2); + + it = itNext; + } + } + + void operator()(arg1_type a1, arg2_type a2) + { + SIGSLOT_EMIT(a1, a2); + } + protected: connections_list m_connected_slots; }; - template<class arg1_type, class arg2_type, class arg3_type, class mt_policy> - class _signal_base3 : public _signal_base<mt_policy> + template<class arg1_type, class arg2_type, class arg3_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> + class signal3 : public _signal_base<mt_policy> { public: typedef std::list<_connection_base3<arg1_type, arg2_type, arg3_type, mt_policy> *> connections_list; - _signal_base3() - { - ; - } + signal3() + {} - _signal_base3(const _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>& s) + signal3(const signal3<arg1_type, arg2_type, arg3_type, mt_policy>& s) : _signal_base<mt_policy>(s) { lock_block<mt_policy> lock(this); @@ -926,6 +1473,11 @@ namespace sigslot { } } + ~signal3() + { + disconnect_all(); + } + void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget) { lock_block<mt_policy> lock(this); @@ -943,11 +1495,6 @@ namespace sigslot { } } - ~_signal_base3() - { - disconnect_all(); - } - bool is_empty() { lock_block<mt_policy> lock(this); @@ -1032,23 +1579,56 @@ namespace sigslot { } } + template<class desttype> + void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, + arg2_type, arg3_type)) + { + lock_block<mt_policy> lock(this); + _connection3<desttype, arg1_type, arg2_type, arg3_type, mt_policy>* conn = + new _connection3<desttype, arg1_type, arg2_type, arg3_type, mt_policy>(pclass, + pmemfun); + m_connected_slots.push_back(conn); + pclass->signal_connect(this); + } + + void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3) + { + lock_block<mt_policy> lock(this); + typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); + typename connections_list::const_iterator itEnd = m_connected_slots.end(); + + while(it != itEnd) + { + itNext = it; + ++itNext; + + (*it)->SIGSLOT_EMIT(a1, a2, a3); + + it = itNext; + } + } + + void operator()(arg1_type a1, arg2_type a2, arg3_type a3) + { + SIGSLOT_EMIT(a1, a2, a3); + } + protected: + connections_list m_connected_slots; }; - template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy> - class _signal_base4 : public _signal_base<mt_policy> + template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> + class signal4 : public _signal_base<mt_policy> { public: typedef std::list<_connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy> *> connections_list; - _signal_base4() - { - ; - } + signal4() + {} - _signal_base4(const _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>& s) + signal4(const signal4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>& s) : _signal_base<mt_policy>(s) { lock_block<mt_policy> lock(this); @@ -1064,6 +1644,11 @@ namespace sigslot { } } + ~signal4() + { + disconnect_all(); + } + void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget) { lock_block<mt_policy> lock(this); @@ -1081,11 +1666,6 @@ namespace sigslot { } } - ~_signal_base4() - { - disconnect_all(); - } - bool is_empty() { lock_block<mt_policy> lock(this); @@ -1170,24 +1750,57 @@ namespace sigslot { } } + template<class desttype> + void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, + arg2_type, arg3_type, arg4_type)) + { + lock_block<mt_policy> lock(this); + _connection4<desttype, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* + conn = new _connection4<desttype, arg1_type, arg2_type, arg3_type, + arg4_type, mt_policy>(pclass, pmemfun); + m_connected_slots.push_back(conn); + pclass->signal_connect(this); + } + + void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) + { + lock_block<mt_policy> lock(this); + typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); + typename connections_list::const_iterator itEnd = m_connected_slots.end(); + + while(it != itEnd) + { + itNext = it; + ++itNext; + + (*it)->SIGSLOT_EMIT(a1, a2, a3, a4); + + it = itNext; + } + } + + void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) + { + SIGSLOT_EMIT(a1, a2, a3, a4); + } + protected: + connections_list m_connected_slots; }; template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, - class arg5_type, class mt_policy> - class _signal_base5 : public _signal_base<mt_policy> + class arg5_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> + class signal5 : public _signal_base<mt_policy> { public: typedef std::list<_connection_base5<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, mt_policy> *> connections_list; - _signal_base5() - { - ; - } + signal5() + {} - _signal_base5(const _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type, + signal5(const signal5<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, mt_policy>& s) : _signal_base<mt_policy>(s) { @@ -1204,6 +1817,11 @@ namespace sigslot { } } + ~signal5() + { + disconnect_all(); + } + void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget) { lock_block<mt_policy> lock(this); @@ -1221,11 +1839,6 @@ namespace sigslot { } } - ~_signal_base5() - { - disconnect_all(); - } - bool is_empty() { lock_block<mt_policy> lock(this); @@ -1310,24 +1923,60 @@ namespace sigslot { } } + template<class desttype> + void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, + arg2_type, arg3_type, arg4_type, arg5_type)) + { + lock_block<mt_policy> lock(this); + _connection5<desttype, arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, mt_policy>* conn = new _connection5<desttype, arg1_type, arg2_type, + arg3_type, arg4_type, arg5_type, mt_policy>(pclass, pmemfun); + m_connected_slots.push_back(conn); + pclass->signal_connect(this); + } + + void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, + arg5_type a5) + { + lock_block<mt_policy> lock(this); + typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); + typename connections_list::const_iterator itEnd = m_connected_slots.end(); + + while(it != itEnd) + { + itNext = it; + ++itNext; + + (*it)->SIGSLOT_EMIT(a1, a2, a3, a4, a5); + + it = itNext; + } + } + + void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, + arg5_type a5) + { + SIGSLOT_EMIT(a1, a2, a3, a4, a5); + } + protected: + connections_list m_connected_slots; }; + template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, - class arg5_type, class arg6_type, class mt_policy> - class _signal_base6 : public _signal_base<mt_policy> + class arg5_type, class arg6_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> + class signal6 : public _signal_base<mt_policy> { public: typedef std::list<_connection_base6<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, mt_policy> *> connections_list; - _signal_base6() - { - ; - } + signal6() + {} - _signal_base6(const _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type, + signal6(const signal6<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, mt_policy>& s) : _signal_base<mt_policy>(s) { @@ -1344,6 +1993,11 @@ namespace sigslot { } } + ~signal6() + { + disconnect_all(); + } + void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget) { lock_block<mt_policy> lock(this); @@ -1361,11 +2015,6 @@ namespace sigslot { } } - ~_signal_base6() - { - disconnect_all(); - } - bool is_empty() { lock_block<mt_policy> lock(this); @@ -1450,24 +2099,60 @@ namespace sigslot { } } + template<class desttype> + void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, + arg2_type, arg3_type, arg4_type, arg5_type, arg6_type)) + { + lock_block<mt_policy> lock(this); + _connection6<desttype, arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, mt_policy>* conn = + new _connection6<desttype, arg1_type, arg2_type, arg3_type, + arg4_type, arg5_type, arg6_type, mt_policy>(pclass, pmemfun); + m_connected_slots.push_back(conn); + pclass->signal_connect(this); + } + + void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, + arg5_type a5, arg6_type a6) + { + lock_block<mt_policy> lock(this); + typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); + typename connections_list::const_iterator itEnd = m_connected_slots.end(); + + while(it != itEnd) + { + itNext = it; + ++itNext; + + (*it)->SIGSLOT_EMIT(a1, a2, a3, a4, a5, a6); + + it = itNext; + } + } + + void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, + arg5_type a5, arg6_type a6) + { + SIGSLOT_EMIT(a1, a2, a3, a4, a5, a6); + } + protected: + connections_list m_connected_slots; }; template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, - class arg5_type, class arg6_type, class arg7_type, class mt_policy> - class _signal_base7 : public _signal_base<mt_policy> + class arg5_type, class arg6_type, class arg7_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> + class signal7 : public _signal_base<mt_policy> { public: typedef std::list<_connection_base7<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, mt_policy> *> connections_list; - _signal_base7() - { - ; - } + signal7() + {} - _signal_base7(const _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type, + signal7(const signal7<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>& s) : _signal_base<mt_policy>(s) { @@ -1484,6 +2169,11 @@ namespace sigslot { } } + ~signal7() + { + disconnect_all(); + } + void slot_duplicate(const has_slots<mt_policy>* oldtarget, has_slots<mt_policy>* newtarget) { lock_block<mt_policy> lock(this); @@ -1501,11 +2191,6 @@ namespace sigslot { } } - ~_signal_base7() - { - disconnect_all(); - } - bool is_empty() { lock_block<mt_policy> lock(this); @@ -1590,25 +2275,63 @@ namespace sigslot { } } + template<class desttype> + void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, + arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, + arg7_type)) + { + lock_block<mt_policy> lock(this); + _connection7<desttype, arg1_type, arg2_type, arg3_type, arg4_type, + arg5_type, arg6_type, arg7_type, mt_policy>* conn = + new _connection7<desttype, arg1_type, arg2_type, arg3_type, + arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>(pclass, pmemfun); + m_connected_slots.push_back(conn); + pclass->signal_connect(this); + } + + void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, + arg5_type a5, arg6_type a6, arg7_type a7) + { + lock_block<mt_policy> lock(this); + typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); + typename connections_list::const_iterator itEnd = m_connected_slots.end(); + + while(it != itEnd) + { + itNext = it; + ++itNext; + + (*it)->SIGSLOT_EMIT(a1, a2, a3, a4, a5, a6, a7); + + it = itNext; + } + } + + void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, + arg5_type a5, arg6_type a6, arg7_type a7) + { + SIGSLOT_EMIT(a1, a2, a3, a4, a5, a6, a7); + } + protected: + connections_list m_connected_slots; }; template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, - class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy> - class _signal_base8 : public _signal_base<mt_policy> + class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> + class signal8 : public _signal_base<mt_policy> { public: + typedef std::list<_connection_base8<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *> connections_list; - _signal_base8() - { - ; - } + signal8() + {} - _signal_base8(const _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type, + signal8(const signal8<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>& s) : _signal_base<mt_policy>(s) { @@ -1642,7 +2365,7 @@ namespace sigslot { } } - ~_signal_base8() + ~signal8() { disconnect_all(); } @@ -1731,936 +2454,6 @@ namespace sigslot { } } - protected: - connections_list m_connected_slots; - }; - - - template<class dest_type, class mt_policy> - class _connection0 : public _connection_base0<mt_policy> - { - public: - _connection0() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection0(dest_type* pobject, void (dest_type::*pmemfun)()) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection0() - { - } - - virtual _connection_base0<mt_policy>* clone() - { - return new _connection0<dest_type, mt_policy>(*this); - } - - virtual _connection_base0<mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) - { - return new _connection0<dest_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); - } - - virtual void SIGSLOT_EMIT() - { - (m_pobject->*m_pmemfun)(); - } - - virtual has_slots<mt_policy>* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(); - }; - - template<class dest_type, class arg1_type, class mt_policy> - class _connection1 : public _connection_base1<arg1_type, mt_policy> - { - public: - _connection1() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection1(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection1() - { - } - - virtual _connection_base1<arg1_type, mt_policy>* clone() - { - return new _connection1<dest_type, arg1_type, mt_policy>(*this); - } - - virtual _connection_base1<arg1_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) - { - return new _connection1<dest_type, arg1_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); - } - - virtual void SIGSLOT_EMIT(arg1_type a1) - { - (m_pobject->*m_pmemfun)(a1); - } - - virtual has_slots<mt_policy>* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type); - }; - - template<class dest_type, class arg1_type, class arg2_type, class mt_policy> - class _connection2 : public _connection_base2<arg1_type, arg2_type, mt_policy> - { - public: - _connection2() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection2(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, - arg2_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection2() - { - } - - virtual _connection_base2<arg1_type, arg2_type, mt_policy>* clone() - { - return new _connection2<dest_type, arg1_type, arg2_type, mt_policy>(*this); - } - - virtual _connection_base2<arg1_type, arg2_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) - { - return new _connection2<dest_type, arg1_type, arg2_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); - } - - virtual void SIGSLOT_EMIT(arg1_type a1, arg2_type a2) - { - (m_pobject->*m_pmemfun)(a1, a2); - } - - virtual has_slots<mt_policy>* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type, arg2_type); - }; - - template<class dest_type, class arg1_type, class arg2_type, class arg3_type, class mt_policy> - class _connection3 : public _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy> - { - public: - _connection3() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection3(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, - arg2_type, arg3_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection3() - { - } - - virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* clone() - { - return new _connection3<dest_type, arg1_type, arg2_type, arg3_type, mt_policy>(*this); - } - - virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) - { - return new _connection3<dest_type, arg1_type, arg2_type, arg3_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); - } - - virtual void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3) - { - (m_pobject->*m_pmemfun)(a1, a2, a3); - } - - virtual has_slots<mt_policy>* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type); - }; - - template<class dest_type, class arg1_type, class arg2_type, class arg3_type, - class arg4_type, class mt_policy> - class _connection4 : public _connection_base4<arg1_type, arg2_type, - arg3_type, arg4_type, mt_policy> - { - public: - _connection4() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection4(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection4() - { - } - - virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* clone() - { - return new _connection4<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>(*this); - } - - virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) - { - return new _connection4<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); - } - - virtual void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, - arg4_type a4) - { - (m_pobject->*m_pmemfun)(a1, a2, a3, a4); - } - - virtual has_slots<mt_policy>* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, - arg4_type); - }; - - template<class dest_type, class arg1_type, class arg2_type, class arg3_type, - class arg4_type, class arg5_type, class mt_policy> - class _connection5 : public _connection_base5<arg1_type, arg2_type, - arg3_type, arg4_type, arg5_type, mt_policy> - { - public: - _connection5() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection5(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection5() - { - } - - virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, mt_policy>* clone() - { - return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, mt_policy>(*this); - } - - virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) - { - return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); - } - - virtual void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5) - { - (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5); - } - - virtual has_slots<mt_policy>* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type); - }; - - template<class dest_type, class arg1_type, class arg2_type, class arg3_type, - class arg4_type, class arg5_type, class arg6_type, class mt_policy> - class _connection6 : public _connection_base6<arg1_type, arg2_type, - arg3_type, arg4_type, arg5_type, arg6_type, mt_policy> - { - public: - _connection6() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection6(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type, arg6_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection6() - { - } - - virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, mt_policy>* clone() - { - return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, mt_policy>(*this); - } - - virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) - { - return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); - } - - virtual void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6) - { - (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6); - } - - virtual has_slots<mt_policy>* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type); - }; - - template<class dest_type, class arg1_type, class arg2_type, class arg3_type, - class arg4_type, class arg5_type, class arg6_type, class arg7_type, class mt_policy> - class _connection7 : public _connection_base7<arg1_type, arg2_type, - arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, mt_policy> - { - public: - _connection7() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection7(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection7() - { - } - - virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, mt_policy>* clone() - { - return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, mt_policy>(*this); - } - - virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) - { - return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); - } - - virtual void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6, arg7_type a7) - { - (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6, a7); - } - - virtual has_slots<mt_policy>* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type); - }; - - template<class dest_type, class arg1_type, class arg2_type, class arg3_type, - class arg4_type, class arg5_type, class arg6_type, class arg7_type, - class arg8_type, class mt_policy> - class _connection8 : public _connection_base8<arg1_type, arg2_type, - arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> - { - public: - _connection8() - { - m_pobject = NULL; - m_pmemfun = NULL; - } - - _connection8(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, - arg7_type, arg8_type)) - { - m_pobject = pobject; - m_pmemfun = pmemfun; - } - - virtual ~_connection8() - { - } - - virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* clone() - { - return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>(*this); - } - - virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* duplicate(has_slots<mt_policy>* pnewdest) - { - return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>((dest_type *)pnewdest, m_pmemfun); - } - - virtual void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8) - { - (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6, a7, a8); - } - - virtual has_slots<mt_policy>* getdest() const - { - return m_pobject; - } - - private: - dest_type* m_pobject; - void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, arg8_type); - }; - - template<class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> - class signal0 : public _signal_base0<mt_policy> - { - public: - typedef _signal_base0<mt_policy> base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal0() - { - ; - } - - signal0(const signal0<mt_policy>& s) - : _signal_base0<mt_policy>(s) - { - ; - } - - template<class desttype> - void connect(desttype* pclass, void (desttype::*pmemfun)()) - { - lock_block<mt_policy> lock(this); - _connection0<desttype, mt_policy>* conn = - new _connection0<desttype, mt_policy>(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void SIGSLOT_EMIT() - { - lock_block<mt_policy> lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->SIGSLOT_EMIT(); - - it = itNext; - } - } - - void operator()() - { - SIGSLOT_EMIT(); - } - }; - - template<class arg1_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> - class signal1 : public _signal_base1<arg1_type, mt_policy> - { - public: - typedef _signal_base1<arg1_type, mt_policy> base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal1() - { - ; - } - - signal1(const signal1<arg1_type, mt_policy>& s) - : _signal_base1<arg1_type, mt_policy>(s) - { - ; - } - - template<class desttype> - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type)) - { - lock_block<mt_policy> lock(this); - _connection1<desttype, arg1_type, mt_policy>* conn = - new _connection1<desttype, arg1_type, mt_policy>(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void SIGSLOT_EMIT(arg1_type a1) - { - lock_block<mt_policy> lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->SIGSLOT_EMIT(a1); - - it = itNext; - } - } - - void operator()(arg1_type a1) - { - SIGSLOT_EMIT(a1); - } - }; - - template<class arg1_type, class arg2_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> - class signal2 : public _signal_base2<arg1_type, arg2_type, mt_policy> - { - public: - typedef _signal_base2<arg1_type, arg2_type, mt_policy> base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal2() - { - ; - } - - signal2(const signal2<arg1_type, arg2_type, mt_policy>& s) - : _signal_base2<arg1_type, arg2_type, mt_policy>(s) - { - ; - } - - template<class desttype> - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, - arg2_type)) - { - lock_block<mt_policy> lock(this); - _connection2<desttype, arg1_type, arg2_type, mt_policy>* conn = new - _connection2<desttype, arg1_type, arg2_type, mt_policy>(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void SIGSLOT_EMIT(arg1_type a1, arg2_type a2) - { - lock_block<mt_policy> lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->SIGSLOT_EMIT(a1, a2); - - it = itNext; - } - } - - void operator()(arg1_type a1, arg2_type a2) - { - SIGSLOT_EMIT(a1, a2); - } - }; - - template<class arg1_type, class arg2_type, class arg3_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> - class signal3 : public _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy> - { - public: - typedef _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy> base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal3() - { - ; - } - - signal3(const signal3<arg1_type, arg2_type, arg3_type, mt_policy>& s) - : _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>(s) - { - ; - } - - template<class desttype> - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, - arg2_type, arg3_type)) - { - lock_block<mt_policy> lock(this); - _connection3<desttype, arg1_type, arg2_type, arg3_type, mt_policy>* conn = - new _connection3<desttype, arg1_type, arg2_type, arg3_type, mt_policy>(pclass, - pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3) - { - lock_block<mt_policy> lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->SIGSLOT_EMIT(a1, a2, a3); - - it = itNext; - } - } - - void operator()(arg1_type a1, arg2_type a2, arg3_type a3) - { - SIGSLOT_EMIT(a1, a2, a3); - } - }; - - template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> - class signal4 : public _signal_base4<arg1_type, arg2_type, arg3_type, - arg4_type, mt_policy> - { - public: - typedef _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy> base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal4() - { - ; - } - - signal4(const signal4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>& s) - : _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>(s) - { - ; - } - - template<class desttype> - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type)) - { - lock_block<mt_policy> lock(this); - _connection4<desttype, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* - conn = new _connection4<desttype, arg1_type, arg2_type, arg3_type, - arg4_type, mt_policy>(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) - { - lock_block<mt_policy> lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->SIGSLOT_EMIT(a1, a2, a3, a4); - - it = itNext; - } - } - - void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) - { - SIGSLOT_EMIT(a1, a2, a3, a4); - } - }; - - template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, - class arg5_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> - class signal5 : public _signal_base5<arg1_type, arg2_type, arg3_type, - arg4_type, arg5_type, mt_policy> - { - public: - typedef _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, mt_policy> base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal5() - { - ; - } - - signal5(const signal5<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, mt_policy>& s) - : _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, mt_policy>(s) - { - ; - } - - template<class desttype> - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type)) - { - lock_block<mt_policy> lock(this); - _connection5<desttype, arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, mt_policy>* conn = new _connection5<desttype, arg1_type, arg2_type, - arg3_type, arg4_type, arg5_type, mt_policy>(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5) - { - lock_block<mt_policy> lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->SIGSLOT_EMIT(a1, a2, a3, a4, a5); - - it = itNext; - } - } - - void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5) - { - SIGSLOT_EMIT(a1, a2, a3, a4, a5); - } - }; - - - template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, - class arg5_type, class arg6_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> - class signal6 : public _signal_base6<arg1_type, arg2_type, arg3_type, - arg4_type, arg5_type, arg6_type, mt_policy> - { - public: - typedef _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, mt_policy> base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal6() - { - ; - } - - signal6(const signal6<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, mt_policy>& s) - : _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, mt_policy>(s) - { - ; - } - - template<class desttype> - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type, arg6_type)) - { - lock_block<mt_policy> lock(this); - _connection6<desttype, arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, mt_policy>* conn = - new _connection6<desttype, arg1_type, arg2_type, arg3_type, - arg4_type, arg5_type, arg6_type, mt_policy>(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6) - { - lock_block<mt_policy> lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->SIGSLOT_EMIT(a1, a2, a3, a4, a5, a6); - - it = itNext; - } - } - - void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6) - { - SIGSLOT_EMIT(a1, a2, a3, a4, a5, a6); - } - }; - - template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, - class arg5_type, class arg6_type, class arg7_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> - class signal7 : public _signal_base7<arg1_type, arg2_type, arg3_type, - arg4_type, arg5_type, arg6_type, arg7_type, mt_policy> - { - public: - typedef _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, mt_policy> base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal7() - { - ; - } - - signal7(const signal7<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, mt_policy>& s) - : _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, mt_policy>(s) - { - ; - } - - template<class desttype> - void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, - arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, - arg7_type)) - { - lock_block<mt_policy> lock(this); - _connection7<desttype, arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, mt_policy>* conn = - new _connection7<desttype, arg1_type, arg2_type, arg3_type, - arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>(pclass, pmemfun); - m_connected_slots.push_back(conn); - pclass->signal_connect(this); - } - - void SIGSLOT_EMIT(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6, arg7_type a7) - { - lock_block<mt_policy> lock(this); - typename connections_list::const_iterator itNext, it = m_connected_slots.begin(); - typename connections_list::const_iterator itEnd = m_connected_slots.end(); - - while(it != itEnd) - { - itNext = it; - ++itNext; - - (*it)->SIGSLOT_EMIT(a1, a2, a3, a4, a5, a6, a7); - - it = itNext; - } - } - - void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, - arg5_type a5, arg6_type a6, arg7_type a7) - { - SIGSLOT_EMIT(a1, a2, a3, a4, a5, a6, a7); - } - }; - - template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, - class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY> - class signal8 : public _signal_base8<arg1_type, arg2_type, arg3_type, - arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> - { - public: - typedef _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> base; - typedef typename base::connections_list connections_list; - using base::m_connected_slots; - - signal8() - { - ; - } - - signal8(const signal8<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>& s) - : _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type, - arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>(s) - { - ; - } - template<class desttype> void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, @@ -2699,6 +2492,9 @@ namespace sigslot { { SIGSLOT_EMIT(a1, a2, a3, a4, a5, a6, a7, a8); } + + protected: + connections_list m_connected_slots; }; namespace impl |
