• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // sigslot.h: Signal/Slot classes
2 //
3 // Written by Sarah Thompson (sarah@telergy.com) 2002.
4 //
5 // License: Public domain. You are free to use this code however you like, with the proviso that
6 //          the author takes on no responsibility or liability for any use.
7 //
8 // QUICK DOCUMENTATION
9 //
10 //				(see also the full documentation at http://sigslot.sourceforge.net/)
11 //
12 //		#define switches
13 //			SIGSLOT_PURE_ISO			- Define this to force ISO C++ compliance. This also disables
14 //										  all of the thread safety support on platforms where it is
15 //										  available.
16 //
17 //			SIGSLOT_USE_POSIX_THREADS	- Force use of Posix threads when using a C++ compiler other than
18 //										  gcc on a platform that supports Posix threads. (When using gcc,
19 //										  this is the default - use SIGSLOT_PURE_ISO to disable this if
20 //										  necessary)
21 //
22 //			SIGSLOT_DEFAULT_MT_POLICY	- Where thread support is enabled, this defaults to multi_threaded_global.
23 //										  Otherwise, the default is single_threaded. #define this yourself to
24 //										  override the default. In pure ISO mode, anything other than
25 //										  single_threaded will cause a compiler error.
26 //
27 //		PLATFORM NOTES
28 //
29 //			Win32						- On Win32, the WEBRTC_WIN symbol must be #defined. Most mainstream
30 //										  compilers do this by default, but you may need to define it
31 //										  yourself if your build environment is less standard. This causes
32 //										  the Win32 thread support to be compiled in and used automatically.
33 //
34 //			Unix/Linux/BSD, etc.		- If you're using gcc, it is assumed that you have Posix threads
35 //										  available, so they are used automatically. You can override this
36 //										  (as under Windows) with the SIGSLOT_PURE_ISO switch. If you're using
37 //										  something other than gcc but still want to use Posix threads, you
38 //										  need to #define SIGSLOT_USE_POSIX_THREADS.
39 //
40 //			ISO C++						- If none of the supported platforms are detected, or if
41 //										  SIGSLOT_PURE_ISO is defined, all multithreading support is turned off,
42 //										  along with any code that might cause a pure ISO C++ environment to
43 //										  complain. Before you ask, gcc -ansi -pedantic won't compile this
44 //										  library, but gcc -ansi is fine. Pedantic mode seems to throw a lot of
45 //										  errors that aren't really there. If you feel like investigating this,
46 //										  please contact the author.
47 //
48 //
49 //		THREADING MODES
50 //
51 //			single_threaded				- Your program is assumed to be single threaded from the point of view
52 //										  of signal/slot usage (i.e. all objects using signals and slots are
53 //										  created and destroyed from a single thread). Behaviour if objects are
54 //										  destroyed concurrently is undefined (i.e. you'll get the occasional
55 //										  segmentation fault/memory exception).
56 //
57 //			multi_threaded_global		- Your program is assumed to be multi threaded. Objects using signals and
58 //										  slots can be safely created and destroyed from any thread, even when
59 //										  connections exist. In multi_threaded_global mode, this is achieved by a
60 //										  single global mutex (actually a critical section on Windows because they
61 //										  are faster). This option uses less OS resources, but results in more
62 //										  opportunities for contention, possibly resulting in more context switches
63 //										  than are strictly necessary.
64 //
65 //			multi_threaded_local		- Behaviour in this mode is essentially the same as multi_threaded_global,
66 //										  except that each signal, and each object that inherits has_slots, all
67 //										  have their own mutex/critical section. In practice, this means that
68 //										  mutex collisions (and hence context switches) only happen if they are
69 //										  absolutely essential. However, on some platforms, creating a lot of
70 //										  mutexes can slow down the whole OS, so use this option with care.
71 //
72 //		USING THE LIBRARY
73 //
74 //			See the full documentation at http://sigslot.sourceforge.net/
75 //
76 //
77 // Libjingle specific:
78 // This file has been modified such that has_slots and signalx do not have to be
79 // using the same threading requirements. E.g. it is possible to connect a
80 // has_slots<single_threaded> and signal0<multi_threaded_local> or
81 // has_slots<multi_threaded_local> and signal0<single_threaded>.
82 // If has_slots is single threaded the user must ensure that it is not trying
83 // to connect or disconnect to signalx concurrently or data race may occur.
84 // If signalx is single threaded the user must ensure that disconnect, connect
85 // or signal is not happening concurrently or data race may occur.
86 
87 #ifndef WEBRTC_BASE_SIGSLOT_H__
88 #define WEBRTC_BASE_SIGSLOT_H__
89 
90 #include <list>
91 #include <set>
92 #include <stdlib.h>
93 
94 // On our copy of sigslot.h, we set single threading as default.
95 #define SIGSLOT_DEFAULT_MT_POLICY single_threaded
96 
97 #if defined(SIGSLOT_PURE_ISO) || (!defined(WEBRTC_WIN) && !defined(__GNUG__) && !defined(SIGSLOT_USE_POSIX_THREADS))
98 #	define _SIGSLOT_SINGLE_THREADED
99 #elif defined(WEBRTC_WIN)
100 #	define _SIGSLOT_HAS_WIN32_THREADS
101 #	if !defined(WIN32_LEAN_AND_MEAN)
102 #		define WIN32_LEAN_AND_MEAN
103 #	endif
104 #	include "webrtc/base/win32.h"
105 #elif defined(__GNUG__) || defined(SIGSLOT_USE_POSIX_THREADS)
106 #	define _SIGSLOT_HAS_POSIX_THREADS
107 #	include <pthread.h>
108 #else
109 #	define _SIGSLOT_SINGLE_THREADED
110 #endif
111 
112 #ifndef SIGSLOT_DEFAULT_MT_POLICY
113 #	ifdef _SIGSLOT_SINGLE_THREADED
114 #		define SIGSLOT_DEFAULT_MT_POLICY single_threaded
115 #	else
116 #		define SIGSLOT_DEFAULT_MT_POLICY multi_threaded_local
117 #	endif
118 #endif
119 
120 // TODO: change this namespace to rtc?
121 namespace sigslot {
122 
123 	class single_threaded
124 	{
125 	public:
single_threaded()126 		single_threaded()
127 		{
128 			;
129 		}
130 
~single_threaded()131                 virtual ~single_threaded() {}
132 
lock()133                 virtual void lock() {}
134 
unlock()135                 virtual void unlock() {}
136         };
137 
138 #ifdef _SIGSLOT_HAS_WIN32_THREADS
139 	// The multi threading policies only get compiled in if they are enabled.
140 	class multi_threaded_global
141 	{
142 	public:
multi_threaded_global()143 		multi_threaded_global()
144 		{
145 			static bool isinitialised = false;
146 
147 			if(!isinitialised)
148 			{
149 				InitializeCriticalSection(get_critsec());
150 				isinitialised = true;
151 			}
152 		}
153 
multi_threaded_global(const multi_threaded_global &)154 		multi_threaded_global(const multi_threaded_global&)
155 		{
156 			;
157 		}
158 
~multi_threaded_global()159 		virtual ~multi_threaded_global()
160 		{
161 			;
162 		}
163 
lock()164 		virtual void lock()
165 		{
166 			EnterCriticalSection(get_critsec());
167 		}
168 
unlock()169 		virtual void unlock()
170 		{
171 			LeaveCriticalSection(get_critsec());
172 		}
173 
174 	private:
get_critsec()175 		CRITICAL_SECTION* get_critsec()
176 		{
177 			static CRITICAL_SECTION g_critsec;
178 			return &g_critsec;
179 		}
180 	};
181 
182 	class multi_threaded_local
183 	{
184 	public:
multi_threaded_local()185 		multi_threaded_local()
186 		{
187 			InitializeCriticalSection(&m_critsec);
188 		}
189 
multi_threaded_local(const multi_threaded_local &)190 		multi_threaded_local(const multi_threaded_local&)
191 		{
192 			InitializeCriticalSection(&m_critsec);
193 		}
194 
~multi_threaded_local()195 		virtual ~multi_threaded_local()
196 		{
197 			DeleteCriticalSection(&m_critsec);
198 		}
199 
lock()200 		virtual void lock()
201 		{
202 			EnterCriticalSection(&m_critsec);
203 		}
204 
unlock()205 		virtual void unlock()
206 		{
207 			LeaveCriticalSection(&m_critsec);
208 		}
209 
210 	private:
211 		CRITICAL_SECTION m_critsec;
212 	};
213 #endif // _SIGSLOT_HAS_WIN32_THREADS
214 
215 #ifdef _SIGSLOT_HAS_POSIX_THREADS
216 	// The multi threading policies only get compiled in if they are enabled.
217 	class multi_threaded_global
218 	{
219 	public:
220          multi_threaded_global();
221          multi_threaded_global(const multi_threaded_global&);
222          virtual ~multi_threaded_global();
223          virtual void lock();
224          virtual void unlock();
225 
226         private:
get_mutex()227 		pthread_mutex_t* get_mutex()
228 		{
229 			static pthread_mutex_t g_mutex;
230 			return &g_mutex;
231 		}
232 	};
233 
234 	class multi_threaded_local
235 	{
236 	public:
237          multi_threaded_local();
238          multi_threaded_local(const multi_threaded_local&);
239          virtual ~multi_threaded_local();
240          virtual void lock();
241          virtual void unlock();
242 
243         private:
244 		pthread_mutex_t m_mutex;
245 	};
246 #endif // _SIGSLOT_HAS_POSIX_THREADS
247 
248 	template<class mt_policy>
249 	class lock_block
250 	{
251 	public:
252 		mt_policy *m_mutex;
253 
lock_block(mt_policy * mtx)254 		lock_block(mt_policy *mtx)
255 			: m_mutex(mtx)
256 		{
257 			m_mutex->lock();
258 		}
259 
~lock_block()260 		~lock_block()
261 		{
262 			m_mutex->unlock();
263 		}
264 	};
265 
266 	class has_slots_interface;
267 
268 	template<class mt_policy>
269 	class _connection_base0
270 	{
271 	public:
~_connection_base0()272 		virtual ~_connection_base0() {}
273 		virtual has_slots_interface* getdest() const = 0;
274 		virtual void emit() = 0;
275 		virtual _connection_base0* clone() = 0;
276 		virtual _connection_base0* duplicate(has_slots_interface* pnewdest) = 0;
277 	};
278 
279 	template<class arg1_type, class mt_policy>
280 	class _connection_base1
281 	{
282 	public:
~_connection_base1()283 		virtual ~_connection_base1() {}
284 		virtual has_slots_interface* getdest() const = 0;
285 		virtual void emit(arg1_type) = 0;
286 		virtual _connection_base1<arg1_type, mt_policy>* clone() = 0;
287 		virtual _connection_base1<arg1_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
288 	};
289 
290 	template<class arg1_type, class arg2_type, class mt_policy>
291 	class _connection_base2
292 	{
293 	public:
~_connection_base2()294 		virtual ~_connection_base2() {}
295 		virtual has_slots_interface* getdest() const = 0;
296 		virtual void emit(arg1_type, arg2_type) = 0;
297 		virtual _connection_base2<arg1_type, arg2_type, mt_policy>* clone() = 0;
298 		virtual _connection_base2<arg1_type, arg2_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
299 	};
300 
301 	template<class arg1_type, class arg2_type, class arg3_type, class mt_policy>
302 	class _connection_base3
303 	{
304 	public:
~_connection_base3()305 		virtual ~_connection_base3() {}
306 		virtual has_slots_interface* getdest() const = 0;
307 		virtual void emit(arg1_type, arg2_type, arg3_type) = 0;
308 		virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* clone() = 0;
309 		virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
310 	};
311 
312 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy>
313 	class _connection_base4
314 	{
315 	public:
~_connection_base4()316 		virtual ~_connection_base4() {}
317 		virtual has_slots_interface* getdest() const = 0;
318 		virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type) = 0;
319 		virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* clone() = 0;
320 		virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
321 	};
322 
323 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
324 	class arg5_type, class mt_policy>
325 	class _connection_base5
326 	{
327 	public:
~_connection_base5()328 		virtual ~_connection_base5() {}
329 		virtual has_slots_interface* getdest() const = 0;
330 		virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type,
331 			arg5_type) = 0;
332 		virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
333 			arg5_type, mt_policy>* clone() = 0;
334 		virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
335 			arg5_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
336 	};
337 
338 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
339 	class arg5_type, class arg6_type, class mt_policy>
340 	class _connection_base6
341 	{
342 	public:
~_connection_base6()343 		virtual ~_connection_base6() {}
344 		virtual has_slots_interface* getdest() const = 0;
345 		virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
346 			arg6_type) = 0;
347 		virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
348 			arg5_type, arg6_type, mt_policy>* clone() = 0;
349 		virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
350 			arg5_type, arg6_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
351 	};
352 
353 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
354 	class arg5_type, class arg6_type, class arg7_type, class mt_policy>
355 	class _connection_base7
356 	{
357 	public:
~_connection_base7()358 		virtual ~_connection_base7() {}
359 		virtual has_slots_interface* getdest() const = 0;
360 		virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
361 			arg6_type, arg7_type) = 0;
362 		virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
363 			arg5_type, arg6_type, arg7_type, mt_policy>* clone() = 0;
364 		virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
365 			arg5_type, arg6_type, arg7_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
366 	};
367 
368 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
369 	class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy>
370 	class _connection_base8
371 	{
372 	public:
~_connection_base8()373 		virtual ~_connection_base8() {}
374 		virtual has_slots_interface* getdest() const = 0;
375 		virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
376 			arg6_type, arg7_type, arg8_type) = 0;
377 		virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
378 			arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* clone() = 0;
379 		virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
380 			arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
381 	};
382 
383 	class _signal_base_interface
384 	{
385 	public:
~_signal_base_interface()386 		virtual ~_signal_base_interface() {}
387 		virtual void slot_disconnect(has_slots_interface* pslot) = 0;
388 		virtual void slot_duplicate(const has_slots_interface* poldslot, has_slots_interface* pnewslot) = 0;
389 	};
390 
391 	template<class mt_policy>
392 	class _signal_base : public _signal_base_interface, public mt_policy
393 	{
394 	};
395 
396 	class has_slots_interface
397 	{
398 	public:
has_slots_interface()399 		has_slots_interface()
400 		{
401 			;
402 		}
403 
404 		virtual void signal_connect(_signal_base_interface* sender) = 0;
405 
406 		virtual void signal_disconnect(_signal_base_interface* sender) = 0;
407 
~has_slots_interface()408 		virtual ~has_slots_interface()
409 		{
410 		}
411 
412 		virtual void disconnect_all() = 0;
413 	};
414 
415 	template<class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
416 	class has_slots : public has_slots_interface, public mt_policy
417 	{
418 	private:
419 		typedef std::set<_signal_base_interface*> sender_set;
420 		typedef sender_set::const_iterator const_iterator;
421 
422 	public:
has_slots()423 		has_slots()
424 		{
425 			;
426 		}
427 
has_slots(const has_slots & hs)428 		has_slots(const has_slots& hs)
429 		{
430 			lock_block<mt_policy> lock(this);
431 			const_iterator it = hs.m_senders.begin();
432 			const_iterator itEnd = hs.m_senders.end();
433 
434 			while(it != itEnd)
435 			{
436 				(*it)->slot_duplicate(&hs, this);
437 				m_senders.insert(*it);
438 				++it;
439 			}
440 		}
441 
signal_connect(_signal_base_interface * sender)442 		void signal_connect(_signal_base_interface* sender)
443 		{
444 			lock_block<mt_policy> lock(this);
445 			m_senders.insert(sender);
446 		}
447 
signal_disconnect(_signal_base_interface * sender)448 		void signal_disconnect(_signal_base_interface* sender)
449 		{
450 			lock_block<mt_policy> lock(this);
451 			m_senders.erase(sender);
452 		}
453 
~has_slots()454 		virtual ~has_slots()
455 		{
456 			disconnect_all();
457 		}
458 
disconnect_all()459 		void disconnect_all()
460 		{
461 			lock_block<mt_policy> lock(this);
462 			const_iterator it = m_senders.begin();
463 			const_iterator itEnd = m_senders.end();
464 
465 			while(it != itEnd)
466 			{
467 				(*it)->slot_disconnect(this);
468 				++it;
469 			}
470 
471 			m_senders.erase(m_senders.begin(), m_senders.end());
472 		}
473 
474 	private:
475 		sender_set m_senders;
476 	};
477 
478 	template<class mt_policy>
479 	class _signal_base0 : public _signal_base<mt_policy>
480 	{
481 	public:
482 		typedef std::list<_connection_base0<mt_policy> *>  connections_list;
483 
_signal_base0()484 		_signal_base0()
485 		{
486 			;
487 		}
488 
_signal_base0(const _signal_base0 & s)489 		_signal_base0(const _signal_base0& s)
490 			: _signal_base<mt_policy>(s)
491 		{
492 			lock_block<mt_policy> lock(this);
493 			typename connections_list::const_iterator it = s.m_connected_slots.begin();
494 			typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
495 
496 			while(it != itEnd)
497 			{
498 				(*it)->getdest()->signal_connect(this);
499 				m_connected_slots.push_back((*it)->clone());
500 
501 				++it;
502 			}
503 		}
504 
~_signal_base0()505 		~_signal_base0()
506 		{
507 			disconnect_all();
508 		}
509 
is_empty()510 		bool is_empty()
511 		{
512 			lock_block<mt_policy> lock(this);
513 			typename connections_list::const_iterator it = m_connected_slots.begin();
514 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
515 			return it == itEnd;
516 		}
517 
disconnect_all()518 		void disconnect_all()
519 		{
520 			lock_block<mt_policy> lock(this);
521 			typename connections_list::const_iterator it = m_connected_slots.begin();
522 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
523 
524 			while(it != itEnd)
525 			{
526 				(*it)->getdest()->signal_disconnect(this);
527 				delete *it;
528 
529 				++it;
530 			}
531 
532 			m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
533 		}
534 
535 #if !defined(NDEBUG)
connected(has_slots_interface * pclass)536 			bool connected(has_slots_interface* pclass)
537 		{
538 			lock_block<mt_policy> lock(this);
539 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
540 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
541 			while(it != itEnd)
542 			{
543 				itNext = it;
544 				++itNext;
545 				if ((*it)->getdest() == pclass)
546 					return true;
547 				it = itNext;
548 			}
549 			return false;
550 		}
551 #endif
552 
disconnect(has_slots_interface * pclass)553 		void disconnect(has_slots_interface* pclass)
554 		{
555 			lock_block<mt_policy> lock(this);
556 			typename connections_list::iterator it = m_connected_slots.begin();
557 			typename connections_list::iterator itEnd = m_connected_slots.end();
558 
559 			while(it != itEnd)
560 			{
561 				if((*it)->getdest() == pclass)
562 				{
563 					delete *it;
564 					m_connected_slots.erase(it);
565 					pclass->signal_disconnect(this);
566 					return;
567 				}
568 
569 				++it;
570 			}
571 		}
572 
slot_disconnect(has_slots_interface * pslot)573 		void slot_disconnect(has_slots_interface* pslot)
574 		{
575 			lock_block<mt_policy> lock(this);
576 			typename connections_list::iterator it = m_connected_slots.begin();
577 			typename connections_list::iterator itEnd = m_connected_slots.end();
578 
579 			while(it != itEnd)
580 			{
581 				typename connections_list::iterator itNext = it;
582 				++itNext;
583 
584 				if((*it)->getdest() == pslot)
585 				{
586 					delete *it;
587 					m_connected_slots.erase(it);
588 				}
589 
590 				it = itNext;
591 			}
592 		}
593 
slot_duplicate(const has_slots_interface * oldtarget,has_slots_interface * newtarget)594 		void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
595 		{
596 			lock_block<mt_policy> lock(this);
597 			typename connections_list::iterator it = m_connected_slots.begin();
598 			typename connections_list::iterator itEnd = m_connected_slots.end();
599 
600 			while(it != itEnd)
601 			{
602 				if((*it)->getdest() == oldtarget)
603 				{
604 					m_connected_slots.push_back((*it)->duplicate(newtarget));
605 				}
606 
607 				++it;
608 			}
609 		}
610 
611 	protected:
612 		connections_list m_connected_slots;
613 	};
614 
615 	template<class arg1_type, class mt_policy>
616 	class _signal_base1 : public _signal_base<mt_policy>
617 	{
618 	public:
619 		typedef std::list<_connection_base1<arg1_type, mt_policy> *>  connections_list;
620 
_signal_base1()621 		_signal_base1()
622 		{
623 			;
624 		}
625 
_signal_base1(const _signal_base1<arg1_type,mt_policy> & s)626 		_signal_base1(const _signal_base1<arg1_type, mt_policy>& s)
627 			: _signal_base<mt_policy>(s)
628 		{
629 			lock_block<mt_policy> lock(this);
630 			typename connections_list::const_iterator it = s.m_connected_slots.begin();
631 			typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
632 
633 			while(it != itEnd)
634 			{
635 				(*it)->getdest()->signal_connect(this);
636 				m_connected_slots.push_back((*it)->clone());
637 
638 				++it;
639 			}
640 		}
641 
slot_duplicate(const has_slots_interface * oldtarget,has_slots_interface * newtarget)642 		void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
643 		{
644 			lock_block<mt_policy> lock(this);
645 			typename connections_list::iterator it = m_connected_slots.begin();
646 			typename connections_list::iterator itEnd = m_connected_slots.end();
647 
648 			while(it != itEnd)
649 			{
650 				if((*it)->getdest() == oldtarget)
651 				{
652 					m_connected_slots.push_back((*it)->duplicate(newtarget));
653 				}
654 
655 				++it;
656 			}
657 		}
658 
~_signal_base1()659 		~_signal_base1()
660 		{
661 			disconnect_all();
662 		}
663 
is_empty()664 		bool is_empty()
665 		{
666 			lock_block<mt_policy> lock(this);
667 			typename connections_list::const_iterator it = m_connected_slots.begin();
668 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
669 			return it == itEnd;
670 		}
671 
disconnect_all()672 		void disconnect_all()
673 		{
674 			lock_block<mt_policy> lock(this);
675 			typename connections_list::const_iterator it = m_connected_slots.begin();
676 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
677 
678 			while(it != itEnd)
679 			{
680 				(*it)->getdest()->signal_disconnect(this);
681 				delete *it;
682 
683 				++it;
684 			}
685 
686 			m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
687 		}
688 
689 #if !defined(NDEBUG)
connected(has_slots_interface * pclass)690 			bool connected(has_slots_interface* pclass)
691 		{
692 			lock_block<mt_policy> lock(this);
693 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
694 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
695 			while(it != itEnd)
696 			{
697 				itNext = it;
698 				++itNext;
699 				if ((*it)->getdest() == pclass)
700 					return true;
701 				it = itNext;
702 			}
703 			return false;
704 		}
705 #endif
706 
disconnect(has_slots_interface * pclass)707 		void disconnect(has_slots_interface* pclass)
708 		{
709 			lock_block<mt_policy> lock(this);
710 			typename connections_list::iterator it = m_connected_slots.begin();
711 			typename connections_list::iterator itEnd = m_connected_slots.end();
712 
713 			while(it != itEnd)
714 			{
715 				if((*it)->getdest() == pclass)
716 				{
717 					delete *it;
718 					m_connected_slots.erase(it);
719 					pclass->signal_disconnect(this);
720 					return;
721 				}
722 
723 				++it;
724 			}
725 		}
726 
slot_disconnect(has_slots_interface * pslot)727 		void slot_disconnect(has_slots_interface* pslot)
728 		{
729 			lock_block<mt_policy> lock(this);
730 			typename connections_list::iterator it = m_connected_slots.begin();
731 			typename connections_list::iterator itEnd = m_connected_slots.end();
732 
733 			while(it != itEnd)
734 			{
735 				typename connections_list::iterator itNext = it;
736 				++itNext;
737 
738 				if((*it)->getdest() == pslot)
739 				{
740 					delete *it;
741 					m_connected_slots.erase(it);
742 				}
743 
744 				it = itNext;
745 			}
746 		}
747 
748 
749 	protected:
750 		connections_list m_connected_slots;
751 	};
752 
753 	template<class arg1_type, class arg2_type, class mt_policy>
754 	class _signal_base2 : public _signal_base<mt_policy>
755 	{
756 	public:
757 		typedef std::list<_connection_base2<arg1_type, arg2_type, mt_policy> *>
758 			connections_list;
759 
_signal_base2()760 		_signal_base2()
761 		{
762 			;
763 		}
764 
_signal_base2(const _signal_base2<arg1_type,arg2_type,mt_policy> & s)765 		_signal_base2(const _signal_base2<arg1_type, arg2_type, mt_policy>& s)
766 			: _signal_base<mt_policy>(s)
767 		{
768 			lock_block<mt_policy> lock(this);
769 			typename connections_list::const_iterator it = s.m_connected_slots.begin();
770 			typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
771 
772 			while(it != itEnd)
773 			{
774 				(*it)->getdest()->signal_connect(this);
775 				m_connected_slots.push_back((*it)->clone());
776 
777 				++it;
778 			}
779 		}
780 
slot_duplicate(const has_slots_interface * oldtarget,has_slots_interface * newtarget)781 		void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
782 		{
783 			lock_block<mt_policy> lock(this);
784 			typename connections_list::iterator it = m_connected_slots.begin();
785 			typename connections_list::iterator itEnd = m_connected_slots.end();
786 
787 			while(it != itEnd)
788 			{
789 				if((*it)->getdest() == oldtarget)
790 				{
791 					m_connected_slots.push_back((*it)->duplicate(newtarget));
792 				}
793 
794 				++it;
795 			}
796 		}
797 
~_signal_base2()798 		~_signal_base2()
799 		{
800 			disconnect_all();
801 		}
802 
is_empty()803 		bool is_empty()
804 		{
805 			lock_block<mt_policy> lock(this);
806 			typename connections_list::const_iterator it = m_connected_slots.begin();
807 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
808 			return it == itEnd;
809 		}
810 
disconnect_all()811 		void disconnect_all()
812 		{
813 			lock_block<mt_policy> lock(this);
814 			typename connections_list::const_iterator it = m_connected_slots.begin();
815 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
816 
817 			while(it != itEnd)
818 			{
819 				(*it)->getdest()->signal_disconnect(this);
820 				delete *it;
821 
822 				++it;
823 			}
824 
825 			m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
826 		}
827 
828 #if !defined(NDEBUG)
connected(has_slots_interface * pclass)829 			bool connected(has_slots_interface* pclass)
830 		{
831 			lock_block<mt_policy> lock(this);
832 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
833 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
834 			while(it != itEnd)
835 			{
836 				itNext = it;
837 				++itNext;
838 				if ((*it)->getdest() == pclass)
839 					return true;
840 				it = itNext;
841 			}
842 			return false;
843 		}
844 #endif
845 
disconnect(has_slots_interface * pclass)846 		void disconnect(has_slots_interface* pclass)
847 		{
848 			lock_block<mt_policy> lock(this);
849 			typename connections_list::iterator it = m_connected_slots.begin();
850 			typename connections_list::iterator itEnd = m_connected_slots.end();
851 
852 			while(it != itEnd)
853 			{
854 				if((*it)->getdest() == pclass)
855 				{
856 					delete *it;
857 					m_connected_slots.erase(it);
858 					pclass->signal_disconnect(this);
859 					return;
860 				}
861 
862 				++it;
863 			}
864 		}
865 
slot_disconnect(has_slots_interface * pslot)866 		void slot_disconnect(has_slots_interface* pslot)
867 		{
868 			lock_block<mt_policy> lock(this);
869 			typename connections_list::iterator it = m_connected_slots.begin();
870 			typename connections_list::iterator itEnd = m_connected_slots.end();
871 
872 			while(it != itEnd)
873 			{
874 				typename connections_list::iterator itNext = it;
875 				++itNext;
876 
877 				if((*it)->getdest() == pslot)
878 				{
879 					delete *it;
880 					m_connected_slots.erase(it);
881 				}
882 
883 				it = itNext;
884 			}
885 		}
886 
887 	protected:
888 		connections_list m_connected_slots;
889 	};
890 
891 	template<class arg1_type, class arg2_type, class arg3_type, class mt_policy>
892 	class _signal_base3 : public _signal_base<mt_policy>
893 	{
894 	public:
895 		typedef std::list<_connection_base3<arg1_type, arg2_type, arg3_type, mt_policy> *>
896 			connections_list;
897 
_signal_base3()898 		_signal_base3()
899 		{
900 			;
901 		}
902 
_signal_base3(const _signal_base3<arg1_type,arg2_type,arg3_type,mt_policy> & s)903 		_signal_base3(const _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>& s)
904 			: _signal_base<mt_policy>(s)
905 		{
906 			lock_block<mt_policy> lock(this);
907 			typename connections_list::const_iterator it = s.m_connected_slots.begin();
908 			typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
909 
910 			while(it != itEnd)
911 			{
912 				(*it)->getdest()->signal_connect(this);
913 				m_connected_slots.push_back((*it)->clone());
914 
915 				++it;
916 			}
917 		}
918 
slot_duplicate(const has_slots_interface * oldtarget,has_slots_interface * newtarget)919 		void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
920 		{
921 			lock_block<mt_policy> lock(this);
922 			typename connections_list::iterator it = m_connected_slots.begin();
923 			typename connections_list::iterator itEnd = m_connected_slots.end();
924 
925 			while(it != itEnd)
926 			{
927 				if((*it)->getdest() == oldtarget)
928 				{
929 					m_connected_slots.push_back((*it)->duplicate(newtarget));
930 				}
931 
932 				++it;
933 			}
934 		}
935 
~_signal_base3()936 		~_signal_base3()
937 		{
938 			disconnect_all();
939 		}
940 
is_empty()941 		bool is_empty()
942 		{
943 			lock_block<mt_policy> lock(this);
944 			typename connections_list::const_iterator it = m_connected_slots.begin();
945 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
946 			return it == itEnd;
947 		}
948 
disconnect_all()949 		void disconnect_all()
950 		{
951 			lock_block<mt_policy> lock(this);
952 			typename connections_list::const_iterator it = m_connected_slots.begin();
953 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
954 
955 			while(it != itEnd)
956 			{
957 				(*it)->getdest()->signal_disconnect(this);
958 				delete *it;
959 
960 				++it;
961 			}
962 
963 			m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
964 		}
965 
966 #if !defined(NDEBUG)
connected(has_slots_interface * pclass)967 			bool connected(has_slots_interface* pclass)
968 		{
969 			lock_block<mt_policy> lock(this);
970 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
971 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
972 			while(it != itEnd)
973 			{
974 				itNext = it;
975 				++itNext;
976 				if ((*it)->getdest() == pclass)
977 					return true;
978 				it = itNext;
979 			}
980 			return false;
981 		}
982 #endif
983 
disconnect(has_slots_interface * pclass)984 		void disconnect(has_slots_interface* pclass)
985 		{
986 			lock_block<mt_policy> lock(this);
987 			typename connections_list::iterator it = m_connected_slots.begin();
988 			typename connections_list::iterator itEnd = m_connected_slots.end();
989 
990 			while(it != itEnd)
991 			{
992 				if((*it)->getdest() == pclass)
993 				{
994 					delete *it;
995 					m_connected_slots.erase(it);
996 					pclass->signal_disconnect(this);
997 					return;
998 				}
999 
1000 				++it;
1001 			}
1002 		}
1003 
slot_disconnect(has_slots_interface * pslot)1004 		void slot_disconnect(has_slots_interface* pslot)
1005 		{
1006 			lock_block<mt_policy> lock(this);
1007 			typename connections_list::iterator it = m_connected_slots.begin();
1008 			typename connections_list::iterator itEnd = m_connected_slots.end();
1009 
1010 			while(it != itEnd)
1011 			{
1012 				typename connections_list::iterator itNext = it;
1013 				++itNext;
1014 
1015 				if((*it)->getdest() == pslot)
1016 				{
1017 					delete *it;
1018 					m_connected_slots.erase(it);
1019 				}
1020 
1021 				it = itNext;
1022 			}
1023 		}
1024 
1025 	protected:
1026 		connections_list m_connected_slots;
1027 	};
1028 
1029 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy>
1030 	class _signal_base4 : public _signal_base<mt_policy>
1031 	{
1032 	public:
1033 		typedef std::list<_connection_base4<arg1_type, arg2_type, arg3_type,
1034 			arg4_type, mt_policy> *>  connections_list;
1035 
_signal_base4()1036 		_signal_base4()
1037 		{
1038 			;
1039 		}
1040 
_signal_base4(const _signal_base4<arg1_type,arg2_type,arg3_type,arg4_type,mt_policy> & s)1041 		_signal_base4(const _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>& s)
1042 			: _signal_base<mt_policy>(s)
1043 		{
1044 			lock_block<mt_policy> lock(this);
1045 			typename connections_list::const_iterator it = s.m_connected_slots.begin();
1046 			typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
1047 
1048 			while(it != itEnd)
1049 			{
1050 				(*it)->getdest()->signal_connect(this);
1051 				m_connected_slots.push_back((*it)->clone());
1052 
1053 				++it;
1054 			}
1055 		}
1056 
slot_duplicate(const has_slots_interface * oldtarget,has_slots_interface * newtarget)1057 		void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
1058 		{
1059 			lock_block<mt_policy> lock(this);
1060 			typename connections_list::iterator it = m_connected_slots.begin();
1061 			typename connections_list::iterator itEnd = m_connected_slots.end();
1062 
1063 			while(it != itEnd)
1064 			{
1065 				if((*it)->getdest() == oldtarget)
1066 				{
1067 					m_connected_slots.push_back((*it)->duplicate(newtarget));
1068 				}
1069 
1070 				++it;
1071 			}
1072 		}
1073 
~_signal_base4()1074 		~_signal_base4()
1075 		{
1076 			disconnect_all();
1077 		}
1078 
is_empty()1079 		bool is_empty()
1080 		{
1081 			lock_block<mt_policy> lock(this);
1082 			typename connections_list::const_iterator it = m_connected_slots.begin();
1083 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1084 			return it == itEnd;
1085 		}
1086 
disconnect_all()1087 		void disconnect_all()
1088 		{
1089 			lock_block<mt_policy> lock(this);
1090 			typename connections_list::const_iterator it = m_connected_slots.begin();
1091 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1092 
1093 			while(it != itEnd)
1094 			{
1095 				(*it)->getdest()->signal_disconnect(this);
1096 				delete *it;
1097 
1098 				++it;
1099 			}
1100 
1101 			m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
1102 		}
1103 
1104 #if !defined(NDEBUG)
connected(has_slots_interface * pclass)1105 			bool connected(has_slots_interface* pclass)
1106 		{
1107 			lock_block<mt_policy> lock(this);
1108 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
1109 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1110 			while(it != itEnd)
1111 			{
1112 				itNext = it;
1113 				++itNext;
1114 				if ((*it)->getdest() == pclass)
1115 					return true;
1116 				it = itNext;
1117 			}
1118 			return false;
1119 		}
1120 #endif
1121 
disconnect(has_slots_interface * pclass)1122 		void disconnect(has_slots_interface* pclass)
1123 		{
1124 			lock_block<mt_policy> lock(this);
1125 			typename connections_list::iterator it = m_connected_slots.begin();
1126 			typename connections_list::iterator itEnd = m_connected_slots.end();
1127 
1128 			while(it != itEnd)
1129 			{
1130 				if((*it)->getdest() == pclass)
1131 				{
1132 					delete *it;
1133 					m_connected_slots.erase(it);
1134 					pclass->signal_disconnect(this);
1135 					return;
1136 				}
1137 
1138 				++it;
1139 			}
1140 		}
1141 
slot_disconnect(has_slots_interface * pslot)1142 		void slot_disconnect(has_slots_interface* pslot)
1143 		{
1144 			lock_block<mt_policy> lock(this);
1145 			typename connections_list::iterator it = m_connected_slots.begin();
1146 			typename connections_list::iterator itEnd = m_connected_slots.end();
1147 
1148 			while(it != itEnd)
1149 			{
1150 				typename connections_list::iterator itNext = it;
1151 				++itNext;
1152 
1153 				if((*it)->getdest() == pslot)
1154 				{
1155 					delete *it;
1156 					m_connected_slots.erase(it);
1157 				}
1158 
1159 				it = itNext;
1160 			}
1161 		}
1162 
1163 	protected:
1164 		connections_list m_connected_slots;
1165 	};
1166 
1167 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
1168 	class arg5_type, class mt_policy>
1169 	class _signal_base5 : public _signal_base<mt_policy>
1170 	{
1171 	public:
1172 		typedef std::list<_connection_base5<arg1_type, arg2_type, arg3_type,
1173 			arg4_type, arg5_type, mt_policy> *>  connections_list;
1174 
_signal_base5()1175 		_signal_base5()
1176 		{
1177 			;
1178 		}
1179 
_signal_base5(const _signal_base5<arg1_type,arg2_type,arg3_type,arg4_type,arg5_type,mt_policy> & s)1180 		_signal_base5(const _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type,
1181 			arg5_type, mt_policy>& s)
1182 			: _signal_base<mt_policy>(s)
1183 		{
1184 			lock_block<mt_policy> lock(this);
1185 			typename connections_list::const_iterator it = s.m_connected_slots.begin();
1186 			typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
1187 
1188 			while(it != itEnd)
1189 			{
1190 				(*it)->getdest()->signal_connect(this);
1191 				m_connected_slots.push_back((*it)->clone());
1192 
1193 				++it;
1194 			}
1195 		}
1196 
slot_duplicate(const has_slots_interface * oldtarget,has_slots_interface * newtarget)1197 		void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
1198 		{
1199 			lock_block<mt_policy> lock(this);
1200 			typename connections_list::iterator it = m_connected_slots.begin();
1201 			typename connections_list::iterator itEnd = m_connected_slots.end();
1202 
1203 			while(it != itEnd)
1204 			{
1205 				if((*it)->getdest() == oldtarget)
1206 				{
1207 					m_connected_slots.push_back((*it)->duplicate(newtarget));
1208 				}
1209 
1210 				++it;
1211 			}
1212 		}
1213 
~_signal_base5()1214 		~_signal_base5()
1215 		{
1216 			disconnect_all();
1217 		}
1218 
is_empty()1219 		bool is_empty()
1220 		{
1221 			lock_block<mt_policy> lock(this);
1222 			typename connections_list::const_iterator it = m_connected_slots.begin();
1223 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1224 			return it == itEnd;
1225 		}
1226 
disconnect_all()1227 		void disconnect_all()
1228 		{
1229 			lock_block<mt_policy> lock(this);
1230 			typename connections_list::const_iterator it = m_connected_slots.begin();
1231 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1232 
1233 			while(it != itEnd)
1234 			{
1235 				(*it)->getdest()->signal_disconnect(this);
1236 				delete *it;
1237 
1238 				++it;
1239 			}
1240 
1241 			m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
1242 		}
1243 
1244 #if !defined(NDEBUG)
connected(has_slots_interface * pclass)1245 			bool connected(has_slots_interface* pclass)
1246 		{
1247 			lock_block<mt_policy> lock(this);
1248 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
1249 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1250 			while(it != itEnd)
1251 			{
1252 				itNext = it;
1253 				++itNext;
1254 				if ((*it)->getdest() == pclass)
1255 					return true;
1256 				it = itNext;
1257 			}
1258 			return false;
1259 		}
1260 #endif
1261 
disconnect(has_slots_interface * pclass)1262 		void disconnect(has_slots_interface* pclass)
1263 		{
1264 			lock_block<mt_policy> lock(this);
1265 			typename connections_list::iterator it = m_connected_slots.begin();
1266 			typename connections_list::iterator itEnd = m_connected_slots.end();
1267 
1268 			while(it != itEnd)
1269 			{
1270 				if((*it)->getdest() == pclass)
1271 				{
1272 					delete *it;
1273 					m_connected_slots.erase(it);
1274 					pclass->signal_disconnect(this);
1275 					return;
1276 				}
1277 
1278 				++it;
1279 			}
1280 		}
1281 
slot_disconnect(has_slots_interface * pslot)1282 		void slot_disconnect(has_slots_interface* pslot)
1283 		{
1284 			lock_block<mt_policy> lock(this);
1285 			typename connections_list::iterator it = m_connected_slots.begin();
1286 			typename connections_list::iterator itEnd = m_connected_slots.end();
1287 
1288 			while(it != itEnd)
1289 			{
1290 				typename connections_list::iterator itNext = it;
1291 				++itNext;
1292 
1293 				if((*it)->getdest() == pslot)
1294 				{
1295 					delete *it;
1296 					m_connected_slots.erase(it);
1297 				}
1298 
1299 				it = itNext;
1300 			}
1301 		}
1302 
1303 	protected:
1304 		connections_list m_connected_slots;
1305 	};
1306 
1307 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
1308 	class arg5_type, class arg6_type, class mt_policy>
1309 	class _signal_base6 : public _signal_base<mt_policy>
1310 	{
1311 	public:
1312 		typedef std::list<_connection_base6<arg1_type, arg2_type, arg3_type,
1313 			arg4_type, arg5_type, arg6_type, mt_policy> *>  connections_list;
1314 
_signal_base6()1315 		_signal_base6()
1316 		{
1317 			;
1318 		}
1319 
_signal_base6(const _signal_base6<arg1_type,arg2_type,arg3_type,arg4_type,arg5_type,arg6_type,mt_policy> & s)1320 		_signal_base6(const _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type,
1321 			arg5_type, arg6_type, mt_policy>& s)
1322 			: _signal_base<mt_policy>(s)
1323 		{
1324 			lock_block<mt_policy> lock(this);
1325 			typename connections_list::const_iterator it = s.m_connected_slots.begin();
1326 			typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
1327 
1328 			while(it != itEnd)
1329 			{
1330 				(*it)->getdest()->signal_connect(this);
1331 				m_connected_slots.push_back((*it)->clone());
1332 
1333 				++it;
1334 			}
1335 		}
1336 
slot_duplicate(const has_slots_interface * oldtarget,has_slots_interface * newtarget)1337 		void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
1338 		{
1339 			lock_block<mt_policy> lock(this);
1340 			typename connections_list::iterator it = m_connected_slots.begin();
1341 			typename connections_list::iterator itEnd = m_connected_slots.end();
1342 
1343 			while(it != itEnd)
1344 			{
1345 				if((*it)->getdest() == oldtarget)
1346 				{
1347 					m_connected_slots.push_back((*it)->duplicate(newtarget));
1348 				}
1349 
1350 				++it;
1351 			}
1352 		}
1353 
~_signal_base6()1354 		~_signal_base6()
1355 		{
1356 			disconnect_all();
1357 		}
1358 
is_empty()1359 		bool is_empty()
1360 		{
1361 			lock_block<mt_policy> lock(this);
1362 			typename connections_list::const_iterator it = m_connected_slots.begin();
1363 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1364 			return it == itEnd;
1365 		}
1366 
disconnect_all()1367 		void disconnect_all()
1368 		{
1369 			lock_block<mt_policy> lock(this);
1370 			typename connections_list::const_iterator it = m_connected_slots.begin();
1371 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1372 
1373 			while(it != itEnd)
1374 			{
1375 				(*it)->getdest()->signal_disconnect(this);
1376 				delete *it;
1377 
1378 				++it;
1379 			}
1380 
1381 			m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
1382 		}
1383 
1384 #if !defined(NDEBUG)
connected(has_slots_interface * pclass)1385 			bool connected(has_slots_interface* pclass)
1386 		{
1387 			lock_block<mt_policy> lock(this);
1388 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
1389 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1390 			while(it != itEnd)
1391 			{
1392 				itNext = it;
1393 				++itNext;
1394 				if ((*it)->getdest() == pclass)
1395 					return true;
1396 				it = itNext;
1397 			}
1398 			return false;
1399 		}
1400 #endif
1401 
disconnect(has_slots_interface * pclass)1402 		void disconnect(has_slots_interface* pclass)
1403 		{
1404 			lock_block<mt_policy> lock(this);
1405 			typename connections_list::iterator it = m_connected_slots.begin();
1406 			typename connections_list::iterator itEnd = m_connected_slots.end();
1407 
1408 			while(it != itEnd)
1409 			{
1410 				if((*it)->getdest() == pclass)
1411 				{
1412 					delete *it;
1413 					m_connected_slots.erase(it);
1414 					pclass->signal_disconnect(this);
1415 					return;
1416 				}
1417 
1418 				++it;
1419 			}
1420 		}
1421 
slot_disconnect(has_slots_interface * pslot)1422 		void slot_disconnect(has_slots_interface* pslot)
1423 		{
1424 			lock_block<mt_policy> lock(this);
1425 			typename connections_list::iterator it = m_connected_slots.begin();
1426 			typename connections_list::iterator itEnd = m_connected_slots.end();
1427 
1428 			while(it != itEnd)
1429 			{
1430 				typename connections_list::iterator itNext = it;
1431 				++itNext;
1432 
1433 				if((*it)->getdest() == pslot)
1434 				{
1435 					delete *it;
1436 					m_connected_slots.erase(it);
1437 				}
1438 
1439 				it = itNext;
1440 			}
1441 		}
1442 
1443 	protected:
1444 		connections_list m_connected_slots;
1445 	};
1446 
1447 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
1448 	class arg5_type, class arg6_type, class arg7_type, class mt_policy>
1449 	class _signal_base7 : public _signal_base<mt_policy>
1450 	{
1451 	public:
1452 		typedef std::list<_connection_base7<arg1_type, arg2_type, arg3_type,
1453 			arg4_type, arg5_type, arg6_type, arg7_type, mt_policy> *>  connections_list;
1454 
_signal_base7()1455 		_signal_base7()
1456 		{
1457 			;
1458 		}
1459 
_signal_base7(const _signal_base7<arg1_type,arg2_type,arg3_type,arg4_type,arg5_type,arg6_type,arg7_type,mt_policy> & s)1460 		_signal_base7(const _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type,
1461 			arg5_type, arg6_type, arg7_type, mt_policy>& s)
1462 			: _signal_base<mt_policy>(s)
1463 		{
1464 			lock_block<mt_policy> lock(this);
1465 			typename connections_list::const_iterator it = s.m_connected_slots.begin();
1466 			typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
1467 
1468 			while(it != itEnd)
1469 			{
1470 				(*it)->getdest()->signal_connect(this);
1471 				m_connected_slots.push_back((*it)->clone());
1472 
1473 				++it;
1474 			}
1475 		}
1476 
slot_duplicate(const has_slots_interface * oldtarget,has_slots_interface * newtarget)1477 		void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
1478 		{
1479 			lock_block<mt_policy> lock(this);
1480 			typename connections_list::iterator it = m_connected_slots.begin();
1481 			typename connections_list::iterator itEnd = m_connected_slots.end();
1482 
1483 			while(it != itEnd)
1484 			{
1485 				if((*it)->getdest() == oldtarget)
1486 				{
1487 					m_connected_slots.push_back((*it)->duplicate(newtarget));
1488 				}
1489 
1490 				++it;
1491 			}
1492 		}
1493 
~_signal_base7()1494 		~_signal_base7()
1495 		{
1496 			disconnect_all();
1497 		}
1498 
is_empty()1499 		bool is_empty()
1500 		{
1501 			lock_block<mt_policy> lock(this);
1502 			typename connections_list::const_iterator it = m_connected_slots.begin();
1503 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1504 			return it == itEnd;
1505 		}
1506 
disconnect_all()1507 		void disconnect_all()
1508 		{
1509 			lock_block<mt_policy> lock(this);
1510 			typename connections_list::const_iterator it = m_connected_slots.begin();
1511 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1512 
1513 			while(it != itEnd)
1514 			{
1515 				(*it)->getdest()->signal_disconnect(this);
1516 				delete *it;
1517 
1518 				++it;
1519 			}
1520 
1521 			m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
1522 		}
1523 
1524 #if !defined(NDEBUG)
connected(has_slots_interface * pclass)1525 			bool connected(has_slots_interface* pclass)
1526 		{
1527 			lock_block<mt_policy> lock(this);
1528 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
1529 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1530 			while(it != itEnd)
1531 			{
1532 				itNext = it;
1533 				++itNext;
1534 				if ((*it)->getdest() == pclass)
1535 					return true;
1536 				it = itNext;
1537 			}
1538 			return false;
1539 		}
1540 #endif
1541 
disconnect(has_slots_interface * pclass)1542 		void disconnect(has_slots_interface* pclass)
1543 		{
1544 			lock_block<mt_policy> lock(this);
1545 			typename connections_list::iterator it = m_connected_slots.begin();
1546 			typename connections_list::iterator itEnd = m_connected_slots.end();
1547 
1548 			while(it != itEnd)
1549 			{
1550 				if((*it)->getdest() == pclass)
1551 				{
1552 					delete *it;
1553 					m_connected_slots.erase(it);
1554 					pclass->signal_disconnect(this);
1555 					return;
1556 				}
1557 
1558 				++it;
1559 			}
1560 		}
1561 
slot_disconnect(has_slots_interface * pslot)1562 		void slot_disconnect(has_slots_interface* pslot)
1563 		{
1564 			lock_block<mt_policy> lock(this);
1565 			typename connections_list::iterator it = m_connected_slots.begin();
1566 			typename connections_list::iterator itEnd = m_connected_slots.end();
1567 
1568 			while(it != itEnd)
1569 			{
1570 				typename connections_list::iterator itNext = it;
1571 				++itNext;
1572 
1573 				if((*it)->getdest() == pslot)
1574 				{
1575 					delete *it;
1576 					m_connected_slots.erase(it);
1577 				}
1578 
1579 				it = itNext;
1580 			}
1581 		}
1582 
1583 	protected:
1584 		connections_list m_connected_slots;
1585 	};
1586 
1587 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
1588 	class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy>
1589 	class _signal_base8 : public _signal_base<mt_policy>
1590 	{
1591 	public:
1592 		typedef std::list<_connection_base8<arg1_type, arg2_type, arg3_type,
1593 			arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *>
1594 			connections_list;
1595 
_signal_base8()1596 		_signal_base8()
1597 		{
1598 			;
1599 		}
1600 
_signal_base8(const _signal_base8<arg1_type,arg2_type,arg3_type,arg4_type,arg5_type,arg6_type,arg7_type,arg8_type,mt_policy> & s)1601 		_signal_base8(const _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type,
1602 			arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>& s)
1603 			: _signal_base<mt_policy>(s)
1604 		{
1605 			lock_block<mt_policy> lock(this);
1606 			typename connections_list::const_iterator it = s.m_connected_slots.begin();
1607 			typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
1608 
1609 			while(it != itEnd)
1610 			{
1611 				(*it)->getdest()->signal_connect(this);
1612 				m_connected_slots.push_back((*it)->clone());
1613 
1614 				++it;
1615 			}
1616 		}
1617 
slot_duplicate(const has_slots_interface * oldtarget,has_slots_interface * newtarget)1618 		void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
1619 		{
1620 			lock_block<mt_policy> lock(this);
1621 			typename connections_list::iterator it = m_connected_slots.begin();
1622 			typename connections_list::iterator itEnd = m_connected_slots.end();
1623 
1624 			while(it != itEnd)
1625 			{
1626 				if((*it)->getdest() == oldtarget)
1627 				{
1628 					m_connected_slots.push_back((*it)->duplicate(newtarget));
1629 				}
1630 
1631 				++it;
1632 			}
1633 		}
1634 
~_signal_base8()1635 		~_signal_base8()
1636 		{
1637 			disconnect_all();
1638 		}
1639 
is_empty()1640 		bool is_empty()
1641 		{
1642 			lock_block<mt_policy> lock(this);
1643 			typename connections_list::const_iterator it = m_connected_slots.begin();
1644 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1645 			return it == itEnd;
1646 		}
1647 
disconnect_all()1648 		void disconnect_all()
1649 		{
1650 			lock_block<mt_policy> lock(this);
1651 			typename connections_list::const_iterator it = m_connected_slots.begin();
1652 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1653 
1654 			while(it != itEnd)
1655 			{
1656 				(*it)->getdest()->signal_disconnect(this);
1657 				delete *it;
1658 
1659 				++it;
1660 			}
1661 
1662 			m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
1663 		}
1664 
1665 #if !defined(NDEBUG)
connected(has_slots_interface * pclass)1666 			bool connected(has_slots_interface* pclass)
1667 		{
1668 			lock_block<mt_policy> lock(this);
1669 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
1670 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
1671 			while(it != itEnd)
1672 			{
1673 				itNext = it;
1674 				++itNext;
1675 				if ((*it)->getdest() == pclass)
1676 					return true;
1677 				it = itNext;
1678 			}
1679 			return false;
1680 		}
1681 #endif
1682 
disconnect(has_slots_interface * pclass)1683 		void disconnect(has_slots_interface* pclass)
1684 		{
1685 			lock_block<mt_policy> lock(this);
1686 			typename connections_list::iterator it = m_connected_slots.begin();
1687 			typename connections_list::iterator itEnd = m_connected_slots.end();
1688 
1689 			while(it != itEnd)
1690 			{
1691 				if((*it)->getdest() == pclass)
1692 				{
1693 					delete *it;
1694 					m_connected_slots.erase(it);
1695 					pclass->signal_disconnect(this);
1696 					return;
1697 				}
1698 
1699 				++it;
1700 			}
1701 		}
1702 
slot_disconnect(has_slots_interface * pslot)1703 		void slot_disconnect(has_slots_interface* pslot)
1704 		{
1705 			lock_block<mt_policy> lock(this);
1706 			typename connections_list::iterator it = m_connected_slots.begin();
1707 			typename connections_list::iterator itEnd = m_connected_slots.end();
1708 
1709 			while(it != itEnd)
1710 			{
1711 				typename connections_list::iterator itNext = it;
1712 				++itNext;
1713 
1714 				if((*it)->getdest() == pslot)
1715 				{
1716 					delete *it;
1717 					m_connected_slots.erase(it);
1718 				}
1719 
1720 				it = itNext;
1721 			}
1722 		}
1723 
1724 	protected:
1725 		connections_list m_connected_slots;
1726 	};
1727 
1728 
1729 	template<class dest_type, class mt_policy>
1730 	class _connection0 : public _connection_base0<mt_policy>
1731 	{
1732 	public:
_connection0()1733 		_connection0()
1734 		{
1735 			m_pobject = NULL;
1736 			m_pmemfun = NULL;
1737 		}
1738 
_connection0(dest_type * pobject,void (dest_type::* pmemfun)())1739 		_connection0(dest_type* pobject, void (dest_type::*pmemfun)())
1740 		{
1741 			m_pobject = pobject;
1742 			m_pmemfun = pmemfun;
1743 		}
1744 
~_connection0()1745 		virtual ~_connection0()
1746 		{
1747                 }
1748 
clone()1749 		virtual _connection_base0<mt_policy>* clone()
1750 		{
1751 			return new _connection0<dest_type, mt_policy>(*this);
1752 		}
1753 
duplicate(has_slots_interface * pnewdest)1754 		virtual _connection_base0<mt_policy>* duplicate(has_slots_interface* pnewdest)
1755 		{
1756 			return new _connection0<dest_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
1757 		}
1758 
emit()1759 		virtual void emit()
1760 		{
1761 			(m_pobject->*m_pmemfun)();
1762 		}
1763 
getdest()1764 		virtual has_slots_interface* getdest() const
1765 		{
1766 			return m_pobject;
1767 		}
1768 
1769 	private:
1770 		dest_type* m_pobject;
1771 		void (dest_type::* m_pmemfun)();
1772 	};
1773 
1774 	template<class dest_type, class arg1_type, class mt_policy>
1775 	class _connection1 : public _connection_base1<arg1_type, mt_policy>
1776 	{
1777 	public:
_connection1()1778 		_connection1()
1779 		{
1780 			m_pobject = NULL;
1781 			m_pmemfun = NULL;
1782 		}
1783 
_connection1(dest_type * pobject,void (dest_type::* pmemfun)(arg1_type))1784 		_connection1(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type))
1785 		{
1786 			m_pobject = pobject;
1787 			m_pmemfun = pmemfun;
1788 		}
1789 
~_connection1()1790 		virtual ~_connection1()
1791 		{
1792                 }
1793 
clone()1794 		virtual _connection_base1<arg1_type, mt_policy>* clone()
1795 		{
1796 			return new _connection1<dest_type, arg1_type, mt_policy>(*this);
1797 		}
1798 
duplicate(has_slots_interface * pnewdest)1799 		virtual _connection_base1<arg1_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
1800 		{
1801 			return new _connection1<dest_type, arg1_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
1802 		}
1803 
emit(arg1_type a1)1804 		virtual void emit(arg1_type a1)
1805 		{
1806 			(m_pobject->*m_pmemfun)(a1);
1807 		}
1808 
getdest()1809 		virtual has_slots_interface* getdest() const
1810 		{
1811 			return m_pobject;
1812 		}
1813 
1814 	private:
1815 		dest_type* m_pobject;
1816 		void (dest_type::* m_pmemfun)(arg1_type);
1817 	};
1818 
1819 	template<class dest_type, class arg1_type, class arg2_type, class mt_policy>
1820 	class _connection2 : public _connection_base2<arg1_type, arg2_type, mt_policy>
1821 	{
1822 	public:
_connection2()1823 		_connection2()
1824 		{
1825 			m_pobject = NULL;
1826 			m_pmemfun = NULL;
1827 		}
1828 
_connection2(dest_type * pobject,void (dest_type::* pmemfun)(arg1_type,arg2_type))1829 		_connection2(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
1830 			arg2_type))
1831 		{
1832 			m_pobject = pobject;
1833 			m_pmemfun = pmemfun;
1834 		}
1835 
~_connection2()1836 		virtual ~_connection2()
1837 		{
1838                 }
1839 
clone()1840 		virtual _connection_base2<arg1_type, arg2_type, mt_policy>* clone()
1841 		{
1842 			return new _connection2<dest_type, arg1_type, arg2_type, mt_policy>(*this);
1843 		}
1844 
duplicate(has_slots_interface * pnewdest)1845 		virtual _connection_base2<arg1_type, arg2_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
1846 		{
1847 			return new _connection2<dest_type, arg1_type, arg2_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
1848 		}
1849 
emit(arg1_type a1,arg2_type a2)1850 		virtual void emit(arg1_type a1, arg2_type a2)
1851 		{
1852 			(m_pobject->*m_pmemfun)(a1, a2);
1853 		}
1854 
getdest()1855 		virtual has_slots_interface* getdest() const
1856 		{
1857 			return m_pobject;
1858 		}
1859 
1860 	private:
1861 		dest_type* m_pobject;
1862 		void (dest_type::* m_pmemfun)(arg1_type, arg2_type);
1863 	};
1864 
1865 	template<class dest_type, class arg1_type, class arg2_type, class arg3_type, class mt_policy>
1866 	class _connection3 : public _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>
1867 	{
1868 	public:
_connection3()1869 		_connection3()
1870 		{
1871 			m_pobject = NULL;
1872 			m_pmemfun = NULL;
1873 		}
1874 
_connection3(dest_type * pobject,void (dest_type::* pmemfun)(arg1_type,arg2_type,arg3_type))1875 		_connection3(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
1876 			arg2_type, arg3_type))
1877 		{
1878 			m_pobject = pobject;
1879 			m_pmemfun = pmemfun;
1880 		}
1881 
~_connection3()1882 		virtual ~_connection3()
1883 		{
1884                 }
1885 
clone()1886 		virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* clone()
1887 		{
1888 			return new _connection3<dest_type, arg1_type, arg2_type, arg3_type, mt_policy>(*this);
1889 		}
1890 
duplicate(has_slots_interface * pnewdest)1891 		virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
1892 		{
1893 			return new _connection3<dest_type, arg1_type, arg2_type, arg3_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
1894 		}
1895 
emit(arg1_type a1,arg2_type a2,arg3_type a3)1896 		virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3)
1897 		{
1898 			(m_pobject->*m_pmemfun)(a1, a2, a3);
1899 		}
1900 
getdest()1901 		virtual has_slots_interface* getdest() const
1902 		{
1903 			return m_pobject;
1904 		}
1905 
1906 	private:
1907 		dest_type* m_pobject;
1908 		void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type);
1909 	};
1910 
1911 	template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
1912 	class arg4_type, class mt_policy>
1913 	class _connection4 : public _connection_base4<arg1_type, arg2_type,
1914 		arg3_type, arg4_type, mt_policy>
1915 	{
1916 	public:
_connection4()1917 		_connection4()
1918 		{
1919 			m_pobject = NULL;
1920 			m_pmemfun = NULL;
1921 		}
1922 
_connection4(dest_type * pobject,void (dest_type::* pmemfun)(arg1_type,arg2_type,arg3_type,arg4_type))1923 		_connection4(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
1924 			arg2_type, arg3_type, arg4_type))
1925 		{
1926 			m_pobject = pobject;
1927 			m_pmemfun = pmemfun;
1928 		}
1929 
~_connection4()1930 		virtual ~_connection4()
1931 		{
1932                 }
1933 
clone()1934 		virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* clone()
1935 		{
1936 			return new _connection4<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>(*this);
1937 		}
1938 
duplicate(has_slots_interface * pnewdest)1939 		virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
1940 		{
1941 			return new _connection4<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
1942 		}
1943 
emit(arg1_type a1,arg2_type a2,arg3_type a3,arg4_type a4)1944 		virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3,
1945 			arg4_type a4)
1946 		{
1947 			(m_pobject->*m_pmemfun)(a1, a2, a3, a4);
1948 		}
1949 
getdest()1950 		virtual has_slots_interface* getdest() const
1951 		{
1952 			return m_pobject;
1953 		}
1954 
1955 	private:
1956 		dest_type* m_pobject;
1957 		void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type,
1958 			arg4_type);
1959 	};
1960 
1961 	template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
1962 	class arg4_type, class arg5_type, class mt_policy>
1963 	class _connection5 : public _connection_base5<arg1_type, arg2_type,
1964 		arg3_type, arg4_type, arg5_type, mt_policy>
1965 	{
1966 	public:
_connection5()1967 		_connection5()
1968 		{
1969 			m_pobject = NULL;
1970 			m_pmemfun = NULL;
1971 		}
1972 
_connection5(dest_type * pobject,void (dest_type::* pmemfun)(arg1_type,arg2_type,arg3_type,arg4_type,arg5_type))1973 		_connection5(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
1974 			arg2_type, arg3_type, arg4_type, arg5_type))
1975 		{
1976 			m_pobject = pobject;
1977 			m_pmemfun = pmemfun;
1978 		}
1979 
~_connection5()1980 		virtual ~_connection5()
1981 		{
1982                 }
1983 
1984 		virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
clone()1985 			arg5_type, mt_policy>* clone()
1986 		{
1987 			return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
1988 				arg5_type, mt_policy>(*this);
1989 		}
1990 
1991 		virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
duplicate(has_slots_interface * pnewdest)1992 			arg5_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
1993 		{
1994 			return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
1995 				arg5_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
1996 		}
1997 
emit(arg1_type a1,arg2_type a2,arg3_type a3,arg4_type a4,arg5_type a5)1998 		virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
1999 			arg5_type a5)
2000 		{
2001 			(m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5);
2002 		}
2003 
getdest()2004 		virtual has_slots_interface* getdest() const
2005 		{
2006 			return m_pobject;
2007 		}
2008 
2009 	private:
2010 		dest_type* m_pobject;
2011 		void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
2012 			arg5_type);
2013 	};
2014 
2015 	template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
2016 	class arg4_type, class arg5_type, class arg6_type, class mt_policy>
2017 	class _connection6 : public _connection_base6<arg1_type, arg2_type,
2018 		arg3_type, arg4_type, arg5_type, arg6_type, mt_policy>
2019 	{
2020 	public:
_connection6()2021 		_connection6()
2022 		{
2023 			m_pobject = NULL;
2024 			m_pmemfun = NULL;
2025 		}
2026 
_connection6(dest_type * pobject,void (dest_type::* pmemfun)(arg1_type,arg2_type,arg3_type,arg4_type,arg5_type,arg6_type))2027 		_connection6(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
2028 			arg2_type, arg3_type, arg4_type, arg5_type, arg6_type))
2029 		{
2030 			m_pobject = pobject;
2031 			m_pmemfun = pmemfun;
2032 		}
2033 
~_connection6()2034 		virtual ~_connection6()
2035 		{
2036                 }
2037 
2038 		virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
clone()2039 			arg5_type, arg6_type, mt_policy>* clone()
2040 		{
2041 			return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
2042 				arg5_type, arg6_type, mt_policy>(*this);
2043 		}
2044 
2045 		virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
duplicate(has_slots_interface * pnewdest)2046 			arg5_type, arg6_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
2047 		{
2048 			return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
2049 				arg5_type, arg6_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
2050 		}
2051 
emit(arg1_type a1,arg2_type a2,arg3_type a3,arg4_type a4,arg5_type a5,arg6_type a6)2052 		virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
2053 			arg5_type a5, arg6_type a6)
2054 		{
2055 			(m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6);
2056 		}
2057 
getdest()2058 		virtual has_slots_interface* getdest() const
2059 		{
2060 			return m_pobject;
2061 		}
2062 
2063 	private:
2064 		dest_type* m_pobject;
2065 		void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
2066 			arg5_type, arg6_type);
2067 	};
2068 
2069 	template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
2070 	class arg4_type, class arg5_type, class arg6_type, class arg7_type, class mt_policy>
2071 	class _connection7 : public _connection_base7<arg1_type, arg2_type,
2072 		arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>
2073 	{
2074 	public:
_connection7()2075 		_connection7()
2076 		{
2077 			m_pobject = NULL;
2078 			m_pmemfun = NULL;
2079 		}
2080 
_connection7(dest_type * pobject,void (dest_type::* pmemfun)(arg1_type,arg2_type,arg3_type,arg4_type,arg5_type,arg6_type,arg7_type))2081 		_connection7(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
2082 			arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type))
2083 		{
2084 			m_pobject = pobject;
2085 			m_pmemfun = pmemfun;
2086 		}
2087 
~_connection7()2088 		virtual ~_connection7()
2089 		{
2090                 }
2091 
2092 		virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
clone()2093 			arg5_type, arg6_type, arg7_type, mt_policy>* clone()
2094 		{
2095 			return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
2096 				arg5_type, arg6_type, arg7_type, mt_policy>(*this);
2097 		}
2098 
2099 		virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
duplicate(has_slots_interface * pnewdest)2100 			arg5_type, arg6_type, arg7_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
2101 		{
2102 			return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
2103 				arg5_type, arg6_type, arg7_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
2104 		}
2105 
emit(arg1_type a1,arg2_type a2,arg3_type a3,arg4_type a4,arg5_type a5,arg6_type a6,arg7_type a7)2106 		virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
2107 			arg5_type a5, arg6_type a6, arg7_type a7)
2108 		{
2109 			(m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6, a7);
2110 		}
2111 
getdest()2112 		virtual has_slots_interface* getdest() const
2113 		{
2114 			return m_pobject;
2115 		}
2116 
2117 	private:
2118 		dest_type* m_pobject;
2119 		void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
2120 			arg5_type, arg6_type, arg7_type);
2121 	};
2122 
2123 	template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
2124 	class arg4_type, class arg5_type, class arg6_type, class arg7_type,
2125 	class arg8_type, class mt_policy>
2126 	class _connection8 : public _connection_base8<arg1_type, arg2_type,
2127 		arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>
2128 	{
2129 	public:
_connection8()2130 		_connection8()
2131 		{
2132 			m_pobject = NULL;
2133 			m_pmemfun = NULL;
2134 		}
2135 
_connection8(dest_type * pobject,void (dest_type::* pmemfun)(arg1_type,arg2_type,arg3_type,arg4_type,arg5_type,arg6_type,arg7_type,arg8_type))2136 		_connection8(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
2137 			arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
2138 			arg7_type, arg8_type))
2139 		{
2140 			m_pobject = pobject;
2141 			m_pmemfun = pmemfun;
2142 		}
2143 
~_connection8()2144 		virtual ~_connection8()
2145 		{
2146                 }
2147 
2148 		virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
clone()2149 			arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* clone()
2150 		{
2151 			return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
2152 				arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>(*this);
2153 		}
2154 
2155 		virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
duplicate(has_slots_interface * pnewdest)2156 			arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
2157 		{
2158 			return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
2159 				arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
2160 		}
2161 
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)2162 		virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
2163 			arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8)
2164 		{
2165 			(m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6, a7, a8);
2166 		}
2167 
getdest()2168 		virtual has_slots_interface* getdest() const
2169 		{
2170 			return m_pobject;
2171 		}
2172 
2173 	private:
2174 		dest_type* m_pobject;
2175 		void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
2176 			arg5_type, arg6_type, arg7_type, arg8_type);
2177 	};
2178 
2179 	template<class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
2180 	class signal0 : public _signal_base0<mt_policy>
2181 	{
2182 	public:
2183 		typedef _signal_base0<mt_policy> base;
2184 		typedef typename base::connections_list connections_list;
2185 		using base::m_connected_slots;
2186 
signal0()2187 		signal0()
2188 		{
2189 			;
2190 		}
2191 
signal0(const signal0<mt_policy> & s)2192 		signal0(const signal0<mt_policy>& s)
2193 			: _signal_base0<mt_policy>(s)
2194 		{
2195 			;
2196 		}
2197 
2198 		template<class desttype>
connect(desttype * pclass,void (desttype::* pmemfun)())2199 			void connect(desttype* pclass, void (desttype::*pmemfun)())
2200 		{
2201 			lock_block<mt_policy> lock(this);
2202 			_connection0<desttype, mt_policy>* conn =
2203 				new _connection0<desttype, mt_policy>(pclass, pmemfun);
2204 			m_connected_slots.push_back(conn);
2205 			pclass->signal_connect(this);
2206 		}
2207 
emit()2208 		void emit()
2209 		{
2210 			lock_block<mt_policy> lock(this);
2211 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2212 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2213 
2214 			while(it != itEnd)
2215 			{
2216 				itNext = it;
2217 				++itNext;
2218 
2219 				(*it)->emit();
2220 
2221 				it = itNext;
2222 			}
2223 		}
2224 
operator()2225 		void operator()()
2226 		{
2227 			lock_block<mt_policy> lock(this);
2228 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2229 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2230 
2231 			while(it != itEnd)
2232 			{
2233 				itNext = it;
2234 				++itNext;
2235 
2236 				(*it)->emit();
2237 
2238 				it = itNext;
2239 			}
2240 		}
2241 	};
2242 
2243 	template<class arg1_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
2244 	class signal1 : public _signal_base1<arg1_type, mt_policy>
2245 	{
2246 	public:
2247 		typedef _signal_base1<arg1_type, mt_policy> base;
2248 		typedef typename base::connections_list connections_list;
2249 		using base::m_connected_slots;
2250 
signal1()2251 		signal1()
2252 		{
2253 			;
2254 		}
2255 
signal1(const signal1<arg1_type,mt_policy> & s)2256 		signal1(const signal1<arg1_type, mt_policy>& s)
2257 			: _signal_base1<arg1_type, mt_policy>(s)
2258 		{
2259 			;
2260 		}
2261 
2262 		template<class desttype>
connect(desttype * pclass,void (desttype::* pmemfun)(arg1_type))2263 			void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type))
2264 		{
2265 			lock_block<mt_policy> lock(this);
2266 			_connection1<desttype, arg1_type, mt_policy>* conn =
2267 				new _connection1<desttype, arg1_type, mt_policy>(pclass, pmemfun);
2268 			m_connected_slots.push_back(conn);
2269 			pclass->signal_connect(this);
2270 		}
2271 
emit(arg1_type a1)2272 		void emit(arg1_type a1)
2273 		{
2274 			lock_block<mt_policy> lock(this);
2275 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2276 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2277 
2278 			while(it != itEnd)
2279 			{
2280 				itNext = it;
2281 				++itNext;
2282 
2283 				(*it)->emit(a1);
2284 
2285 				it = itNext;
2286 			}
2287 		}
2288 
operator()2289 		void operator()(arg1_type a1)
2290 		{
2291 			lock_block<mt_policy> lock(this);
2292 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2293 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2294 
2295 			while(it != itEnd)
2296 			{
2297 				itNext = it;
2298 				++itNext;
2299 
2300 				(*it)->emit(a1);
2301 
2302 				it = itNext;
2303 			}
2304 		}
2305 	};
2306 
2307 	template<class arg1_type, class arg2_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
2308 	class signal2 : public _signal_base2<arg1_type, arg2_type, mt_policy>
2309 	{
2310 	public:
2311 		typedef _signal_base2<arg1_type, arg2_type, mt_policy> base;
2312 		typedef typename base::connections_list connections_list;
2313 		using base::m_connected_slots;
2314 
signal2()2315 		signal2()
2316 		{
2317 			;
2318 		}
2319 
signal2(const signal2<arg1_type,arg2_type,mt_policy> & s)2320 		signal2(const signal2<arg1_type, arg2_type, mt_policy>& s)
2321 			: _signal_base2<arg1_type, arg2_type, mt_policy>(s)
2322 		{
2323 			;
2324 		}
2325 
2326 		template<class desttype>
connect(desttype * pclass,void (desttype::* pmemfun)(arg1_type,arg2_type))2327 			void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
2328 			arg2_type))
2329 		{
2330 			lock_block<mt_policy> lock(this);
2331 			_connection2<desttype, arg1_type, arg2_type, mt_policy>* conn = new
2332 				_connection2<desttype, arg1_type, arg2_type, mt_policy>(pclass, pmemfun);
2333 			m_connected_slots.push_back(conn);
2334 			pclass->signal_connect(this);
2335 		}
2336 
emit(arg1_type a1,arg2_type a2)2337 		void emit(arg1_type a1, arg2_type a2)
2338 		{
2339 			lock_block<mt_policy> lock(this);
2340 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2341 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2342 
2343 			while(it != itEnd)
2344 			{
2345 				itNext = it;
2346 				++itNext;
2347 
2348 				(*it)->emit(a1, a2);
2349 
2350 				it = itNext;
2351 			}
2352 		}
2353 
operator()2354 		void operator()(arg1_type a1, arg2_type a2)
2355 		{
2356 			lock_block<mt_policy> lock(this);
2357 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2358 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2359 
2360 			while(it != itEnd)
2361 			{
2362 				itNext = it;
2363 				++itNext;
2364 
2365 				(*it)->emit(a1, a2);
2366 
2367 				it = itNext;
2368 			}
2369 		}
2370 	};
2371 
2372 	template<class arg1_type, class arg2_type, class arg3_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
2373 	class signal3 : public _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>
2374 	{
2375 	public:
2376 		typedef _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy> base;
2377 		typedef typename base::connections_list connections_list;
2378 		using base::m_connected_slots;
2379 
signal3()2380 		signal3()
2381 		{
2382 			;
2383 		}
2384 
signal3(const signal3<arg1_type,arg2_type,arg3_type,mt_policy> & s)2385 		signal3(const signal3<arg1_type, arg2_type, arg3_type, mt_policy>& s)
2386 			: _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>(s)
2387 		{
2388 			;
2389 		}
2390 
2391 		template<class desttype>
connect(desttype * pclass,void (desttype::* pmemfun)(arg1_type,arg2_type,arg3_type))2392 			void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
2393 			arg2_type, arg3_type))
2394 		{
2395 			lock_block<mt_policy> lock(this);
2396 			_connection3<desttype, arg1_type, arg2_type, arg3_type, mt_policy>* conn =
2397 				new _connection3<desttype, arg1_type, arg2_type, arg3_type, mt_policy>(pclass,
2398 				pmemfun);
2399 			m_connected_slots.push_back(conn);
2400 			pclass->signal_connect(this);
2401 		}
2402 
emit(arg1_type a1,arg2_type a2,arg3_type a3)2403 		void emit(arg1_type a1, arg2_type a2, arg3_type a3)
2404 		{
2405 			lock_block<mt_policy> lock(this);
2406 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2407 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2408 
2409 			while(it != itEnd)
2410 			{
2411 				itNext = it;
2412 				++itNext;
2413 
2414 				(*it)->emit(a1, a2, a3);
2415 
2416 				it = itNext;
2417 			}
2418 		}
2419 
operator()2420 		void operator()(arg1_type a1, arg2_type a2, arg3_type a3)
2421 		{
2422 			lock_block<mt_policy> lock(this);
2423 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2424 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2425 
2426 			while(it != itEnd)
2427 			{
2428 				itNext = it;
2429 				++itNext;
2430 
2431 				(*it)->emit(a1, a2, a3);
2432 
2433 				it = itNext;
2434 			}
2435 		}
2436 	};
2437 
2438 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
2439 	class signal4 : public _signal_base4<arg1_type, arg2_type, arg3_type,
2440 		arg4_type, mt_policy>
2441 	{
2442 	public:
2443 		typedef _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy> base;
2444 		typedef typename base::connections_list connections_list;
2445 		using base::m_connected_slots;
2446 
signal4()2447 		signal4()
2448 		{
2449 			;
2450 		}
2451 
signal4(const signal4<arg1_type,arg2_type,arg3_type,arg4_type,mt_policy> & s)2452 		signal4(const signal4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>& s)
2453 			: _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>(s)
2454 		{
2455 			;
2456 		}
2457 
2458 		template<class desttype>
connect(desttype * pclass,void (desttype::* pmemfun)(arg1_type,arg2_type,arg3_type,arg4_type))2459 			void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
2460 			arg2_type, arg3_type, arg4_type))
2461 		{
2462 			lock_block<mt_policy> lock(this);
2463 			_connection4<desttype, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>*
2464 				conn = new _connection4<desttype, arg1_type, arg2_type, arg3_type,
2465 				arg4_type, mt_policy>(pclass, pmemfun);
2466 			m_connected_slots.push_back(conn);
2467 			pclass->signal_connect(this);
2468 		}
2469 
emit(arg1_type a1,arg2_type a2,arg3_type a3,arg4_type a4)2470 		void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4)
2471 		{
2472 			lock_block<mt_policy> lock(this);
2473 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2474 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2475 
2476 			while(it != itEnd)
2477 			{
2478 				itNext = it;
2479 				++itNext;
2480 
2481 				(*it)->emit(a1, a2, a3, a4);
2482 
2483 				it = itNext;
2484 			}
2485 		}
2486 
operator()2487 		void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4)
2488 		{
2489 			lock_block<mt_policy> lock(this);
2490 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2491 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2492 
2493 			while(it != itEnd)
2494 			{
2495 				itNext = it;
2496 				++itNext;
2497 
2498 				(*it)->emit(a1, a2, a3, a4);
2499 
2500 				it = itNext;
2501 			}
2502 		}
2503 	};
2504 
2505 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
2506 	class arg5_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
2507 	class signal5 : public _signal_base5<arg1_type, arg2_type, arg3_type,
2508 		arg4_type, arg5_type, mt_policy>
2509 	{
2510 	public:
2511 		typedef _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, mt_policy> base;
2512 		typedef typename base::connections_list connections_list;
2513 		using base::m_connected_slots;
2514 
signal5()2515 		signal5()
2516 		{
2517 			;
2518 		}
2519 
signal5(const signal5<arg1_type,arg2_type,arg3_type,arg4_type,arg5_type,mt_policy> & s)2520 		signal5(const signal5<arg1_type, arg2_type, arg3_type, arg4_type,
2521 			arg5_type, mt_policy>& s)
2522 			: _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type,
2523 			arg5_type, mt_policy>(s)
2524 		{
2525 			;
2526 		}
2527 
2528 		template<class desttype>
connect(desttype * pclass,void (desttype::* pmemfun)(arg1_type,arg2_type,arg3_type,arg4_type,arg5_type))2529 			void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
2530 			arg2_type, arg3_type, arg4_type, arg5_type))
2531 		{
2532 			lock_block<mt_policy> lock(this);
2533 			_connection5<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
2534 				arg5_type, mt_policy>* conn = new _connection5<desttype, arg1_type, arg2_type,
2535 				arg3_type, arg4_type, arg5_type, mt_policy>(pclass, pmemfun);
2536 			m_connected_slots.push_back(conn);
2537 			pclass->signal_connect(this);
2538 		}
2539 
emit(arg1_type a1,arg2_type a2,arg3_type a3,arg4_type a4,arg5_type a5)2540 		void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
2541 			arg5_type a5)
2542 		{
2543 			lock_block<mt_policy> lock(this);
2544 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2545 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2546 
2547 			while(it != itEnd)
2548 			{
2549 				itNext = it;
2550 				++itNext;
2551 
2552 				(*it)->emit(a1, a2, a3, a4, a5);
2553 
2554 				it = itNext;
2555 			}
2556 		}
2557 
operator()2558 		void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
2559 			arg5_type a5)
2560 		{
2561 			lock_block<mt_policy> lock(this);
2562 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2563 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2564 
2565 			while(it != itEnd)
2566 			{
2567 				itNext = it;
2568 				++itNext;
2569 
2570 				(*it)->emit(a1, a2, a3, a4, a5);
2571 
2572 				it = itNext;
2573 			}
2574 		}
2575 	};
2576 
2577 
2578 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
2579 	class arg5_type, class arg6_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
2580 	class signal6 : public _signal_base6<arg1_type, arg2_type, arg3_type,
2581 		arg4_type, arg5_type, arg6_type, mt_policy>
2582 	{
2583 	public:
2584 		typedef _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, mt_policy> base;
2585 		typedef typename base::connections_list connections_list;
2586 		using base::m_connected_slots;
2587 
signal6()2588 		signal6()
2589 		{
2590 			;
2591 		}
2592 
signal6(const signal6<arg1_type,arg2_type,arg3_type,arg4_type,arg5_type,arg6_type,mt_policy> & s)2593 		signal6(const signal6<arg1_type, arg2_type, arg3_type, arg4_type,
2594 			arg5_type, arg6_type, mt_policy>& s)
2595 			: _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type,
2596 			arg5_type, arg6_type, mt_policy>(s)
2597 		{
2598 			;
2599 		}
2600 
2601 		template<class desttype>
connect(desttype * pclass,void (desttype::* pmemfun)(arg1_type,arg2_type,arg3_type,arg4_type,arg5_type,arg6_type))2602 			void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
2603 			arg2_type, arg3_type, arg4_type, arg5_type, arg6_type))
2604 		{
2605 			lock_block<mt_policy> lock(this);
2606 			_connection6<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
2607 				arg5_type, arg6_type, mt_policy>* conn =
2608 				new _connection6<desttype, arg1_type, arg2_type, arg3_type,
2609 				arg4_type, arg5_type, arg6_type, mt_policy>(pclass, pmemfun);
2610 			m_connected_slots.push_back(conn);
2611 			pclass->signal_connect(this);
2612 		}
2613 
emit(arg1_type a1,arg2_type a2,arg3_type a3,arg4_type a4,arg5_type a5,arg6_type a6)2614 		void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
2615 			arg5_type a5, arg6_type a6)
2616 		{
2617 			lock_block<mt_policy> lock(this);
2618 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2619 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2620 
2621 			while(it != itEnd)
2622 			{
2623 				itNext = it;
2624 				++itNext;
2625 
2626 				(*it)->emit(a1, a2, a3, a4, a5, a6);
2627 
2628 				it = itNext;
2629 			}
2630 		}
2631 
operator()2632 		void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
2633 			arg5_type a5, arg6_type a6)
2634 		{
2635 			lock_block<mt_policy> lock(this);
2636 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2637 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2638 
2639 			while(it != itEnd)
2640 			{
2641 				itNext = it;
2642 				++itNext;
2643 
2644 				(*it)->emit(a1, a2, a3, a4, a5, a6);
2645 
2646 				it = itNext;
2647 			}
2648 		}
2649 	};
2650 
2651 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
2652 	class arg5_type, class arg6_type, class arg7_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
2653 	class signal7 : public _signal_base7<arg1_type, arg2_type, arg3_type,
2654 		arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>
2655 	{
2656 	public:
2657 		typedef _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type,
2658 			arg5_type, arg6_type, arg7_type, mt_policy> base;
2659 		typedef typename base::connections_list connections_list;
2660 		using base::m_connected_slots;
2661 
signal7()2662 		signal7()
2663 		{
2664 			;
2665 		}
2666 
signal7(const signal7<arg1_type,arg2_type,arg3_type,arg4_type,arg5_type,arg6_type,arg7_type,mt_policy> & s)2667 		signal7(const signal7<arg1_type, arg2_type, arg3_type, arg4_type,
2668 			arg5_type, arg6_type, arg7_type, mt_policy>& s)
2669 			: _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type,
2670 			arg5_type, arg6_type, arg7_type, mt_policy>(s)
2671 		{
2672 			;
2673 		}
2674 
2675 		template<class desttype>
connect(desttype * pclass,void (desttype::* pmemfun)(arg1_type,arg2_type,arg3_type,arg4_type,arg5_type,arg6_type,arg7_type))2676 			void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
2677 			arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
2678 			arg7_type))
2679 		{
2680 			lock_block<mt_policy> lock(this);
2681 			_connection7<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
2682 				arg5_type, arg6_type, arg7_type, mt_policy>* conn =
2683 				new _connection7<desttype, arg1_type, arg2_type, arg3_type,
2684 				arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>(pclass, pmemfun);
2685 			m_connected_slots.push_back(conn);
2686 			pclass->signal_connect(this);
2687 		}
2688 
emit(arg1_type a1,arg2_type a2,arg3_type a3,arg4_type a4,arg5_type a5,arg6_type a6,arg7_type a7)2689 		void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
2690 			arg5_type a5, arg6_type a6, arg7_type a7)
2691 		{
2692 			lock_block<mt_policy> lock(this);
2693 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2694 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2695 
2696 			while(it != itEnd)
2697 			{
2698 				itNext = it;
2699 				++itNext;
2700 
2701 				(*it)->emit(a1, a2, a3, a4, a5, a6, a7);
2702 
2703 				it = itNext;
2704 			}
2705 		}
2706 
operator()2707 		void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
2708 			arg5_type a5, arg6_type a6, arg7_type a7)
2709 		{
2710 			lock_block<mt_policy> lock(this);
2711 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2712 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2713 
2714 			while(it != itEnd)
2715 			{
2716 				itNext = it;
2717 				++itNext;
2718 
2719 				(*it)->emit(a1, a2, a3, a4, a5, a6, a7);
2720 
2721 				it = itNext;
2722 			}
2723 		}
2724 	};
2725 
2726 	template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
2727 	class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
2728 	class signal8 : public _signal_base8<arg1_type, arg2_type, arg3_type,
2729 		arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>
2730 	{
2731 	public:
2732 		typedef _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type,
2733 			arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> base;
2734 		typedef typename base::connections_list connections_list;
2735 		using base::m_connected_slots;
2736 
signal8()2737 		signal8()
2738 		{
2739 			;
2740 		}
2741 
signal8(const signal8<arg1_type,arg2_type,arg3_type,arg4_type,arg5_type,arg6_type,arg7_type,arg8_type,mt_policy> & s)2742 		signal8(const signal8<arg1_type, arg2_type, arg3_type, arg4_type,
2743 			arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>& s)
2744 			: _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type,
2745 			arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>(s)
2746 		{
2747 			;
2748 		}
2749 
2750 		template<class desttype>
connect(desttype * pclass,void (desttype::* pmemfun)(arg1_type,arg2_type,arg3_type,arg4_type,arg5_type,arg6_type,arg7_type,arg8_type))2751 			void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
2752 			arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
2753 			arg7_type, arg8_type))
2754 		{
2755 			lock_block<mt_policy> lock(this);
2756 			_connection8<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
2757 				arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* conn =
2758 				new _connection8<desttype, arg1_type, arg2_type, arg3_type,
2759 				arg4_type, arg5_type, arg6_type, arg7_type,
2760 				arg8_type, mt_policy>(pclass, pmemfun);
2761 			m_connected_slots.push_back(conn);
2762 			pclass->signal_connect(this);
2763 		}
2764 
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)2765 		void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
2766 			arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8)
2767 		{
2768 			lock_block<mt_policy> lock(this);
2769 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2770 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2771 
2772 			while(it != itEnd)
2773 			{
2774 				itNext = it;
2775 				++itNext;
2776 
2777 				(*it)->emit(a1, a2, a3, a4, a5, a6, a7, a8);
2778 
2779 				it = itNext;
2780 			}
2781 		}
2782 
operator()2783 		void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
2784 			arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8)
2785 		{
2786 			lock_block<mt_policy> lock(this);
2787 			typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
2788 			typename connections_list::const_iterator itEnd = m_connected_slots.end();
2789 
2790 			while(it != itEnd)
2791 			{
2792 				itNext = it;
2793 				++itNext;
2794 
2795 				(*it)->emit(a1, a2, a3, a4, a5, a6, a7, a8);
2796 
2797 				it = itNext;
2798 			}
2799 		}
2800 	};
2801 
2802 }; // namespace sigslot
2803 
2804 #endif // WEBRTC_BASE_SIGSLOT_H__
2805