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