/[H8]/trunk/test-server/sigslot.h
ViewVC logotype

Annotation of /trunk/test-server/sigslot.h

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20