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