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