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