diff options
Diffstat (limited to 'src/signals.h')
-rw-r--r-- | src/signals.h | 592 |
1 files changed, 592 insertions, 0 deletions
diff --git a/src/signals.h b/src/signals.h new file mode 100644 index 0000000..722f928 --- /dev/null +++ b/src/signals.h | |||
@@ -0,0 +1,592 @@ | |||
1 | #ifndef BU_OBJECT_SIGNALS_H | ||
2 | #define BU_OBJECT_SIGNALS_H | ||
3 | |||
4 | #include "bu/util.h" | ||
5 | |||
6 | namespace Bu | ||
7 | { | ||
8 | // | ||
9 | // 0 Parameters | ||
10 | // | ||
11 | |||
12 | template<typename ret> | ||
13 | class _Slot0 | ||
14 | { | ||
15 | public: | ||
16 | _Slot0() { } | ||
17 | virtual ~_Slot0() { } | ||
18 | |||
19 | virtual ret operator()()=0; | ||
20 | |||
21 | virtual _Slot0<ret> *clone() const=0; | ||
22 | }; | ||
23 | |||
24 | template<typename cls, typename ret> | ||
25 | class __Slot0 : public _Slot0<ret> | ||
26 | { | ||
27 | public: | ||
28 | __Slot0( cls *pCls, ret (cls::*pFnc)() ) : | ||
29 | pCls( pCls ), pFnc( pFnc ) { } | ||
30 | virtual ~__Slot0() { } | ||
31 | |||
32 | virtual ret operator()() | ||
33 | { | ||
34 | return (pCls->*pFnc)(); | ||
35 | } | ||
36 | |||
37 | virtual _Slot0<ret> *clone() const | ||
38 | { | ||
39 | return new __Slot0<cls, ret>( pCls, pFnc ); | ||
40 | } | ||
41 | |||
42 | private: | ||
43 | cls *pCls; | ||
44 | ret (cls::*pFnc)(); | ||
45 | }; | ||
46 | |||
47 | template<typename ret> | ||
48 | class __Slot0F : public _Slot0<ret> | ||
49 | { | ||
50 | public: | ||
51 | __Slot0F( ret (*pFnc)() ) : | ||
52 | pFnc( pFnc ) { } | ||
53 | virtual ~__Slot0F() { } | ||
54 | |||
55 | virtual ret operator()() | ||
56 | { | ||
57 | return (*pFnc)(); | ||
58 | } | ||
59 | |||
60 | virtual _Slot0<ret> *clone() const | ||
61 | { | ||
62 | return new __Slot0F<ret>( pFnc ); | ||
63 | } | ||
64 | |||
65 | private: | ||
66 | ret (*pFnc)(); | ||
67 | }; | ||
68 | |||
69 | template<typename ret> | ||
70 | class Signal0 | ||
71 | { | ||
72 | public: | ||
73 | Signal0() : pCb( NULL ) { } | ||
74 | Signal0( _Slot0<ret> *pCb ) : pCb( pCb ) { } | ||
75 | Signal0( const Signal0<ret> &rSrc ) : | ||
76 | pCb( rSrc.pCb->clone() ) { } | ||
77 | |||
78 | virtual ~Signal0() { delete pCb; pCb = NULL; } | ||
79 | |||
80 | ret operator()() | ||
81 | { | ||
82 | return (*pCb)(); | ||
83 | } | ||
84 | |||
85 | private: | ||
86 | _Slot0<ret> *pCb; | ||
87 | }; | ||
88 | |||
89 | template<typename cls, typename ret> | ||
90 | Signal0<ret> slot( cls *pCls, ret (cls::*pFnc)() ) | ||
91 | { | ||
92 | return Signal0<ret>( | ||
93 | new __Slot0<cls, ret>( pCls, pFnc ) | ||
94 | ); | ||
95 | } | ||
96 | |||
97 | template<typename ret> | ||
98 | Signal0<ret> slot( ret (*pFnc)() ) | ||
99 | { | ||
100 | return Signal0<ret>( | ||
101 | new __Slot0F<ret>( pFnc ) | ||
102 | ); | ||
103 | } | ||
104 | |||
105 | // | ||
106 | // 1 Parameter | ||
107 | // | ||
108 | |||
109 | template<typename ret, typename p1t> | ||
110 | class _Slot1 | ||
111 | { | ||
112 | public: | ||
113 | _Slot1() { } | ||
114 | virtual ~_Slot1() { } | ||
115 | |||
116 | virtual ret operator()( p1t p1 )=0; | ||
117 | |||
118 | virtual _Slot1<ret, p1t> *clone() const=0; | ||
119 | }; | ||
120 | |||
121 | template<typename cls, typename ret, typename p1t> | ||
122 | class __Slot1 : public _Slot1<ret, p1t> | ||
123 | { | ||
124 | public: | ||
125 | __Slot1( cls *pCls, ret (cls::*pFnc)( p1t ) ) : | ||
126 | pCls( pCls ), pFnc( pFnc ) { } | ||
127 | virtual ~__Slot1() { } | ||
128 | |||
129 | virtual ret operator()( p1t p1 ) | ||
130 | { | ||
131 | return (pCls->*pFnc)( p1 ); | ||
132 | } | ||
133 | |||
134 | virtual _Slot1<ret, p1t> *clone() const | ||
135 | { | ||
136 | return new __Slot1<cls, ret, p1t>( pCls, pFnc ); | ||
137 | } | ||
138 | |||
139 | private: | ||
140 | cls *pCls; | ||
141 | ret (cls::*pFnc)( p1t ); | ||
142 | }; | ||
143 | |||
144 | template<typename ret, typename p1t> | ||
145 | class __Slot1F : public _Slot1<ret, p1t> | ||
146 | { | ||
147 | public: | ||
148 | __Slot1F( ret (*pFnc)( p1t ) ) : | ||
149 | pFnc( pFnc ) { } | ||
150 | virtual ~__Slot1F() { } | ||
151 | |||
152 | virtual ret operator()( p1t p1 ) | ||
153 | { | ||
154 | return (*pFnc)( p1 ); | ||
155 | } | ||
156 | |||
157 | virtual _Slot1<ret, p1t> *clone() const | ||
158 | { | ||
159 | return new __Slot1F<ret, p1t>( pFnc ); | ||
160 | } | ||
161 | |||
162 | private: | ||
163 | ret (*pFnc)( p1t p1 ); | ||
164 | }; | ||
165 | |||
166 | template<typename ret, typename p1t> | ||
167 | class Signal1 | ||
168 | { | ||
169 | public: | ||
170 | Signal1() : pCb( NULL ) { } | ||
171 | Signal1( _Slot1<ret, p1t> *pCb ) : pCb( pCb ) { } | ||
172 | Signal1( const Signal1<ret, p1t> &rSrc ) : | ||
173 | pCb( rSrc.pCb->clone() ) { } | ||
174 | |||
175 | virtual ~Signal1() { delete pCb; pCb = NULL; } | ||
176 | |||
177 | ret operator()( p1t p1 ) | ||
178 | { | ||
179 | return (*pCb)( p1 ); | ||
180 | } | ||
181 | |||
182 | private: | ||
183 | _Slot1<ret, p1t> *pCb; | ||
184 | }; | ||
185 | |||
186 | template<typename cls, typename ret, typename p1t> | ||
187 | Signal1<ret, p1t> slot( cls *pCls, ret (cls::*pFnc)( p1t ) ) | ||
188 | { | ||
189 | return Signal1<ret, p1t>( | ||
190 | new __Slot1<cls, ret, p1t>( pCls, pFnc ) | ||
191 | ); | ||
192 | } | ||
193 | |||
194 | template<typename ret, typename p1t> | ||
195 | Signal1<ret, p1t> slot( ret (*pFnc)( p1t ) ) | ||
196 | { | ||
197 | return Signal1<ret, p1t>( | ||
198 | new __Slot1F<ret, p1t>( pFnc ) | ||
199 | ); | ||
200 | } | ||
201 | |||
202 | // | ||
203 | // 2 Parameters | ||
204 | // | ||
205 | |||
206 | template<typename ret, typename p1t, typename p2t> | ||
207 | class _Slot2 | ||
208 | { | ||
209 | public: | ||
210 | _Slot2() { } | ||
211 | virtual ~_Slot2() { } | ||
212 | |||
213 | virtual ret operator()( p1t p1, p2t p2 )=0; | ||
214 | |||
215 | virtual _Slot2<ret, p1t, p2t> *clone() const=0; | ||
216 | }; | ||
217 | |||
218 | template<typename cls, typename ret, typename p1t, typename p2t> | ||
219 | class __Slot2 : public _Slot2<ret, p1t, p2t> | ||
220 | { | ||
221 | public: | ||
222 | __Slot2( cls *pCls, ret (cls::*pFnc)( p1t, p2t ) ) : | ||
223 | pCls( pCls ), pFnc( pFnc ) { } | ||
224 | virtual ~__Slot2() { } | ||
225 | |||
226 | virtual ret operator()( p1t p1, p2t p2 ) | ||
227 | { | ||
228 | return (pCls->*pFnc)( p1, p2 ); | ||
229 | } | ||
230 | |||
231 | virtual _Slot2<ret, p1t, p2t> *clone() const | ||
232 | { | ||
233 | return new __Slot2<cls, ret, p1t, p2t>( pCls, pFnc ); | ||
234 | } | ||
235 | |||
236 | private: | ||
237 | cls *pCls; | ||
238 | ret (cls::*pFnc)( p1t, p2t ); | ||
239 | }; | ||
240 | |||
241 | template<typename ret, typename p1t, typename p2t> | ||
242 | class __Slot2F : public _Slot2<ret, p1t, p2t> | ||
243 | { | ||
244 | public: | ||
245 | __Slot2F( ret (*pFnc)( p1t, p2t ) ) : | ||
246 | pFnc( pFnc ) { } | ||
247 | virtual ~__Slot2F() { } | ||
248 | |||
249 | virtual ret operator()( p1t p1, p2t p2 ) | ||
250 | { | ||
251 | return (*pFnc)( p1, p2 ); | ||
252 | } | ||
253 | |||
254 | virtual _Slot2<ret, p1t, p2t> *clone() const | ||
255 | { | ||
256 | return new __Slot2F<ret, p1t, p2t>( pFnc ); | ||
257 | } | ||
258 | |||
259 | private: | ||
260 | ret (*pFnc)( p1t, p2t ); | ||
261 | }; | ||
262 | |||
263 | template<typename ret, typename p1t, typename p2t> | ||
264 | class Signal2 | ||
265 | { | ||
266 | public: | ||
267 | Signal2() : pCb( NULL ) { } | ||
268 | Signal2( _Slot2<ret, p1t, p2t> *pCb ) : pCb( pCb ) { } | ||
269 | Signal2( const Signal2<ret, p1t, p2t> &rSrc ) : | ||
270 | pCb( rSrc.pCb->clone() ) { } | ||
271 | |||
272 | virtual ~Signal2() { delete pCb; pCb = NULL; } | ||
273 | |||
274 | ret operator()( p1t p1, p2t p2 ) | ||
275 | { | ||
276 | return (*pCb)( p1, p2 ); | ||
277 | } | ||
278 | |||
279 | private: | ||
280 | _Slot2<ret, p1t, p2t> *pCb; | ||
281 | }; | ||
282 | |||
283 | template<typename cls, typename ret, typename p1t, typename p2t> | ||
284 | Signal2<ret, p1t, p2t> slot( cls *pCls, ret (cls::*pFnc)( p1t, p2t ) ) | ||
285 | { | ||
286 | return Signal2<ret, p1t, p2t>( | ||
287 | new __Slot2<cls, ret, p1t, p2t>( pCls, pFnc ) | ||
288 | ); | ||
289 | } | ||
290 | |||
291 | template<typename ret, typename p1t, typename p2t> | ||
292 | Signal2<ret, p1t, p2t> slot( ret (*pFnc)( p1t, p2t ) ) | ||
293 | { | ||
294 | return Signal2<ret, p1t, p2t>( | ||
295 | new __Slot2F<ret, p1t, p2t>( pFnc ) | ||
296 | ); | ||
297 | } | ||
298 | |||
299 | // | ||
300 | // 3 Parameters | ||
301 | // | ||
302 | |||
303 | template<typename ret, typename p1t, typename p2t, typename p3t> | ||
304 | class _Slot3 | ||
305 | { | ||
306 | public: | ||
307 | _Slot3() { } | ||
308 | virtual ~_Slot3() { } | ||
309 | |||
310 | virtual ret operator()( p1t p1, p2t p2, p3t p3 )=0; | ||
311 | |||
312 | virtual _Slot3<ret, p1t, p2t, p3t> *clone() const=0; | ||
313 | }; | ||
314 | |||
315 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t> | ||
316 | class __Slot3 : public _Slot3<ret, p1t, p2t, p3t> | ||
317 | { | ||
318 | public: | ||
319 | __Slot3( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t ) ) : | ||
320 | pCls( pCls ), pFnc( pFnc ) { } | ||
321 | virtual ~__Slot3() { } | ||
322 | |||
323 | virtual ret operator()( p1t p1, p2t p2, p3t p3 ) | ||
324 | { | ||
325 | return (pCls->*pFnc)( p1, p2, p3 ); | ||
326 | } | ||
327 | |||
328 | virtual _Slot3<ret, p1t, p2t, p3t> *clone() const | ||
329 | { | ||
330 | return new __Slot3<cls, ret, p1t, p2t, p3t>( pCls, pFnc ); | ||
331 | } | ||
332 | |||
333 | private: | ||
334 | cls *pCls; | ||
335 | ret (cls::*pFnc)( p1t, p2t, p3t ); | ||
336 | }; | ||
337 | |||
338 | template<typename ret, typename p1t, typename p2t, typename p3t> | ||
339 | class __Slot3F : public _Slot3<ret, p1t, p2t, p3t> | ||
340 | { | ||
341 | public: | ||
342 | __Slot3F( ret (*pFnc)( p1t, p2t, p3t ) ) : | ||
343 | pFnc( pFnc ) { } | ||
344 | virtual ~__Slot3F() { } | ||
345 | |||
346 | virtual ret operator()( p1t p1, p2t p2, p3t p3 ) | ||
347 | { | ||
348 | return (*pFnc)( p1, p2, p3 ); | ||
349 | } | ||
350 | |||
351 | virtual _Slot3<ret, p1t, p2t, p3t> *clone() const | ||
352 | { | ||
353 | return new __Slot3F<ret, p1t, p2t, p3t>( pFnc ); | ||
354 | } | ||
355 | |||
356 | private: | ||
357 | ret (*pFnc)( p1t, p2t, p3t ); | ||
358 | }; | ||
359 | |||
360 | template<typename ret, typename p1t, typename p2t, typename p3t> | ||
361 | class Signal3 | ||
362 | { | ||
363 | public: | ||
364 | Signal3() : pCb( NULL ) { } | ||
365 | Signal3( _Slot3<ret, p1t, p2t, p3t> *pCb ) : pCb( pCb ) { } | ||
366 | Signal3( const Signal3<ret, p1t, p2t, p3t> &rSrc ) : | ||
367 | pCb( rSrc.pCb->clone() ) { } | ||
368 | |||
369 | virtual ~Signal3() { delete pCb; pCb = NULL; } | ||
370 | |||
371 | ret operator()( p1t p1, p2t p2, p3t p3 ) | ||
372 | { | ||
373 | return (*pCb)( p1, p2, p3 ); | ||
374 | } | ||
375 | |||
376 | private: | ||
377 | _Slot3<ret, p1t, p2t, p3t> *pCb; | ||
378 | }; | ||
379 | |||
380 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t> | ||
381 | Signal3<ret, p1t, p2t, p3t> slot( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t ) ) | ||
382 | { | ||
383 | return Signal3<ret, p1t, p2t, p3t>( | ||
384 | new __Slot3<cls, ret, p1t, p2t, p3t>( pCls, pFnc ) | ||
385 | ); | ||
386 | } | ||
387 | |||
388 | template<typename ret, typename p1t, typename p2t, typename p3t> | ||
389 | Signal3<ret, p1t, p2t, p3t> slot( ret (*pFnc)( p1t, p2t, p3t ) ) | ||
390 | { | ||
391 | return Signal3<ret, p1t, p2t, p3t>( | ||
392 | new __Slot3F<ret, p1t, p2t, p3t>( pFnc ) | ||
393 | ); | ||
394 | } | ||
395 | |||
396 | // | ||
397 | // 4 Parameters | ||
398 | // | ||
399 | |||
400 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t> | ||
401 | class _Slot4 | ||
402 | { | ||
403 | public: | ||
404 | _Slot4() { } | ||
405 | virtual ~_Slot4() { } | ||
406 | |||
407 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4 )=0; | ||
408 | |||
409 | virtual _Slot4<ret, p1t, p2t, p3t, p4t> *clone() const=0; | ||
410 | }; | ||
411 | |||
412 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t> | ||
413 | class __Slot4 : public _Slot4<ret, p1t, p2t, p3t, p4t> | ||
414 | { | ||
415 | public: | ||
416 | __Slot4( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t ) ) : | ||
417 | pCls( pCls ), pFnc( pFnc ) { } | ||
418 | virtual ~__Slot4() { } | ||
419 | |||
420 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4 ) | ||
421 | { | ||
422 | return (pCls->*pFnc)( p1, p2, p3, p4 ); | ||
423 | } | ||
424 | |||
425 | virtual _Slot4<ret, p1t, p2t, p3t, p4t> *clone() const | ||
426 | { | ||
427 | return new __Slot4<cls, ret, p1t, p2t, p3t, p4t>( pCls, pFnc ); | ||
428 | } | ||
429 | |||
430 | private: | ||
431 | cls *pCls; | ||
432 | ret (cls::*pFnc)( p1t, p2t, p3t, p4t ); | ||
433 | }; | ||
434 | |||
435 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t> | ||
436 | class __Slot4F : public _Slot4<ret, p1t, p2t, p3t, p4t> | ||
437 | { | ||
438 | public: | ||
439 | __Slot4F( ret (*pFnc)( p1t, p2t, p3t, p4t ) ) : | ||
440 | pFnc( pFnc ) { } | ||
441 | virtual ~__Slot4F() { } | ||
442 | |||
443 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4 ) | ||
444 | { | ||
445 | return (*pFnc)( p1, p2, p3, p4 ); | ||
446 | } | ||
447 | |||
448 | virtual _Slot4<ret, p1t, p2t, p3t, p4t> *clone() const | ||
449 | { | ||
450 | return new __Slot4F<ret, p1t, p2t, p3t, p4t>( pFnc ); | ||
451 | } | ||
452 | |||
453 | private: | ||
454 | ret (*pFnc)( p1t, p2t, p3t, p4t ); | ||
455 | }; | ||
456 | |||
457 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t> | ||
458 | class Signal4 | ||
459 | { | ||
460 | public: | ||
461 | Signal4() : pCb( NULL ) { } | ||
462 | Signal4( _Slot4<ret, p1t, p2t, p3t, p4t> *pCb ) : pCb( pCb ) { } | ||
463 | Signal4( const Signal4<ret, p1t, p2t, p3t, p4t> &rSrc ) : | ||
464 | pCb( rSrc.pCb->clone() ) { } | ||
465 | |||
466 | virtual ~Signal4() { delete pCb; pCb = NULL; } | ||
467 | |||
468 | ret operator()( p1t p1, p2t p2, p3t p3, p4t p4 ) | ||
469 | { | ||
470 | return (*pCb)( p1, p2, p3, p4 ); | ||
471 | } | ||
472 | |||
473 | private: | ||
474 | _Slot4<ret, p1t, p2t, p3t, p4t> *pCb; | ||
475 | }; | ||
476 | |||
477 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t> | ||
478 | Signal4<ret, p1t, p2t, p3t, p4t> slot( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t ) ) | ||
479 | { | ||
480 | return Signal4<ret, p1t, p2t, p3t, p4t>( | ||
481 | new __Slot4<cls, ret, p1t, p2t, p3t, p4t>( pCls, pFnc ) | ||
482 | ); | ||
483 | } | ||
484 | |||
485 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t> | ||
486 | Signal4<ret, p1t, p2t, p3t, p4t> slot( ret (*pFnc)( p1t, p2t, p3t, p4t ) ) | ||
487 | { | ||
488 | return Signal4<ret, p1t, p2t, p3t, p4t>( | ||
489 | new __Slot4F<ret, p1t, p2t, p3t, p4t>( pFnc ) | ||
490 | ); | ||
491 | } | ||
492 | |||
493 | // | ||
494 | // 5 Parameters | ||
495 | // | ||
496 | |||
497 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t> | ||
498 | class _Slot5 | ||
499 | { | ||
500 | public: | ||
501 | _Slot5() { } | ||
502 | virtual ~_Slot5() { } | ||
503 | |||
504 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5 )=0; | ||
505 | |||
506 | virtual _Slot5<ret, p1t, p2t, p3t, p4t, p5t> *clone() const=0; | ||
507 | }; | ||
508 | |||
509 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t> | ||
510 | class __Slot5 : public _Slot5<ret, p1t, p2t, p3t, p4t, p5t> | ||
511 | { | ||
512 | public: | ||
513 | __Slot5( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t ) ) : | ||
514 | pCls( pCls ), pFnc( pFnc ) { } | ||
515 | virtual ~__Slot5() { } | ||
516 | |||
517 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5 ) | ||
518 | { | ||
519 | return (pCls->*pFnc)( p1, p2, p3, p4, p5 ); | ||
520 | } | ||
521 | |||
522 | virtual _Slot5<ret, p1t, p2t, p3t, p4t, p5t> *clone() const | ||
523 | { | ||
524 | return new __Slot5<cls, ret, p1t, p2t, p3t, p4t, p5t>( pCls, pFnc ); | ||
525 | } | ||
526 | |||
527 | private: | ||
528 | cls *pCls; | ||
529 | ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t ); | ||
530 | }; | ||
531 | |||
532 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t> | ||
533 | class __Slot5F : public _Slot5<ret, p1t, p2t, p3t, p4t, p5t> | ||
534 | { | ||
535 | public: | ||
536 | __Slot5F( ret (*pFnc)( p1t, p2t, p3t, p4t, p5t ) ) : | ||
537 | pFnc( pFnc ) { } | ||
538 | virtual ~__Slot5F() { } | ||
539 | |||
540 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5 ) | ||
541 | { | ||
542 | return (*pFnc)( p1, p2, p3, p4, p5 ); | ||
543 | } | ||
544 | |||
545 | virtual _Slot5<ret, p1t, p2t, p3t, p4t, p5t> *clone() const | ||
546 | { | ||
547 | return new __Slot5F<ret, p1t, p2t, p3t, p4t, p5t>( pFnc ); | ||
548 | } | ||
549 | |||
550 | private: | ||
551 | ret (*pFnc)( p1t, p2t, p3t, p4t, p5t ); | ||
552 | }; | ||
553 | |||
554 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t> | ||
555 | class Signal5 | ||
556 | { | ||
557 | public: | ||
558 | Signal5() : pCb( NULL ) { } | ||
559 | Signal5( _Slot5<ret, p1t, p2t, p3t, p4t, p5t> *pCb ) : pCb( pCb ) { } | ||
560 | Signal5( const Signal5<ret, p1t, p2t, p3t, p4t, p5t> &rSrc ) : | ||
561 | pCb( rSrc.pCb->clone() ) { } | ||
562 | |||
563 | virtual ~Signal5() { delete pCb; pCb = NULL; } | ||
564 | |||
565 | ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5 ) | ||
566 | { | ||
567 | return (*pCb)( p1, p2, p3, p4, p5 ); | ||
568 | } | ||
569 | |||
570 | private: | ||
571 | _Slot5<ret, p1t, p2t, p3t, p4t, p5t> *pCb; | ||
572 | }; | ||
573 | |||
574 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t> | ||
575 | Signal5<ret, p1t, p2t, p3t, p4t, p5t> slot( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t ) ) | ||
576 | { | ||
577 | return Signal5<ret, p1t, p2t, p3t, p4t, p5t>( | ||
578 | new __Slot5<cls, ret, p1t, p2t, p3t, p4t, p5t>( pCls, pFnc ) | ||
579 | ); | ||
580 | } | ||
581 | |||
582 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t> | ||
583 | Signal5<ret, p1t, p2t, p3t, p4t, p5t> slot( ret (*pFnc)( p1t, p2t, p3t, p4t, p5t ) ) | ||
584 | { | ||
585 | return Signal5<ret, p1t, p2t, p3t, p4t, p5t>( | ||
586 | new __Slot5F<ret, p1t, p2t, p3t, p4t, p5t>( pFnc ) | ||
587 | ); | ||
588 | } | ||
589 | |||
590 | }; | ||
591 | |||
592 | #endif | ||