~ubuntu-branches/debian/experimental/kopete/experimental

« back to all changes in this revision

Viewing changes to protocols/jabber/libjingle/talk/base/sigslot.h

  • Committer: Package Import Robot
  • Author(s): Maximiliano Curia
  • Date: 2015-02-24 11:32:57 UTC
  • mfrom: (1.1.41 vivid)
  • Revision ID: package-import@ubuntu.com-20150224113257-gnupg4v7lzz18ij0
Tags: 4:14.12.2-1
* New upstream release (14.12.2).
* Bump Standards-Version to 3.9.6, no changes needed.

Show diffs side-by-side

added added

removed removed

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