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