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