diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-03-26 00:22:47 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-03-26 00:22:47 +0000 |
commit | d6fcf92f4dd68d16720b284d8018443e85c4e1be (patch) | |
tree | 2814f7efdcd886ab3832f5d54fd8b7f433cc3d85 /pregen/signals.h | |
parent | 469bbcf0701e1eb8a6670c23145b0da87357e178 (diff) | |
download | libbu++-d6fcf92f4dd68d16720b284d8018443e85c4e1be.tar.gz libbu++-d6fcf92f4dd68d16720b284d8018443e85c4e1be.tar.bz2 libbu++-d6fcf92f4dd68d16720b284d8018443e85c4e1be.tar.xz libbu++-d6fcf92f4dd68d16720b284d8018443e85c4e1be.zip |
Include the pregenerated signals.h file :)
Diffstat (limited to 'pregen/signals.h')
-rw-r--r-- | pregen/signals.h | 1208 |
1 files changed, 1208 insertions, 0 deletions
diff --git a/pregen/signals.h b/pregen/signals.h new file mode 100644 index 0000000..47ddad4 --- /dev/null +++ b/pregen/signals.h | |||
@@ -0,0 +1,1208 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | |||
8 | #ifndef BU_SIGNALS_H | ||
9 | #define BU_SIGNALS_H | ||
10 | |||
11 | #include "bu/util.h" | ||
12 | #include "bu/exceptionbase.h" | ||
13 | |||
14 | namespace Bu | ||
15 | { | ||
16 | subExceptionDecl( SignalException ); | ||
17 | |||
18 | #ifndef BU_SIGNAL_PARAM_COUNT_0 | ||
19 | #define BU_SIGNAL_PARAM_COUNT_0 | ||
20 | // | ||
21 | // 0 Parameter(s) | ||
22 | // | ||
23 | template<typename ret> | ||
24 | class _Slot0 | ||
25 | { | ||
26 | public: | ||
27 | _Slot0() { } | ||
28 | virtual ~_Slot0() { } | ||
29 | virtual ret operator()( )=0; | ||
30 | virtual _Slot0<ret> *clone() const=0; | ||
31 | }; | ||
32 | |||
33 | template<typename cls, typename ret> | ||
34 | class __Slot0 : public _Slot0<ret> | ||
35 | { | ||
36 | public: | ||
37 | __Slot0( cls *pCls, ret (cls::*pFnc)( ) ) : | ||
38 | pCls( pCls ), pFnc( pFnc ) { } | ||
39 | virtual ~__Slot0() { } | ||
40 | |||
41 | virtual ret operator()( ) | ||
42 | { | ||
43 | return (pCls->*pFnc)( ); | ||
44 | } | ||
45 | |||
46 | virtual _Slot0<ret> *clone() const | ||
47 | { | ||
48 | return new __Slot0<cls, ret>( pCls, pFnc ); | ||
49 | } | ||
50 | |||
51 | private: | ||
52 | cls *pCls; | ||
53 | ret (cls::*pFnc)( ); | ||
54 | }; | ||
55 | |||
56 | template<typename ret> | ||
57 | class __Slot0F : public _Slot0<ret> | ||
58 | { | ||
59 | public: | ||
60 | __Slot0F( ret (*pFnc)( ) ) : | ||
61 | pFnc( pFnc ) { } | ||
62 | virtual ~__Slot0F() { } | ||
63 | |||
64 | virtual ret operator()( ) | ||
65 | { | ||
66 | return (*pFnc)( ); | ||
67 | } | ||
68 | |||
69 | virtual _Slot0<ret> *clone() const | ||
70 | { | ||
71 | return new __Slot0F<ret>( pFnc ); | ||
72 | } | ||
73 | |||
74 | private: | ||
75 | ret (*pFnc)( ); | ||
76 | }; | ||
77 | |||
78 | template<typename ret> | ||
79 | class Signal0 | ||
80 | { | ||
81 | public: | ||
82 | Signal0() : pCb( NULL ) { } | ||
83 | Signal0( _Slot0<ret> *pCb ) : pCb( pCb ) { } | ||
84 | Signal0( const Signal0<ret> &rSrc ) : | ||
85 | pCb( (rSrc.pCb)?(rSrc.pCb->clone()):(NULL) ) { } | ||
86 | virtual ~Signal0() { delete pCb; pCb = NULL; } | ||
87 | |||
88 | ret operator()( ) | ||
89 | { | ||
90 | if( !pCb ) throw SignalException("Uninitialized signal called."); | ||
91 | return (*pCb)( ); | ||
92 | } | ||
93 | |||
94 | bool isSet() const { return pCb != NULL; } | ||
95 | operator bool() const { return isSet(); } | ||
96 | |||
97 | Signal0<ret> &operator=( const Signal0<ret> &rhs ) | ||
98 | { | ||
99 | pCb = rhs.pCb->clone(); | ||
100 | return *this; | ||
101 | } | ||
102 | |||
103 | private: | ||
104 | _Slot0<ret> *pCb; | ||
105 | }; | ||
106 | |||
107 | template<typename cls, typename ret> | ||
108 | Signal0<ret> slot( cls *pCls, ret (cls::*pFnc)( ) ) | ||
109 | { | ||
110 | if( !pCls || !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
111 | return Signal0<ret>( | ||
112 | new __Slot0<cls, ret>( pCls, pFnc ) | ||
113 | ); | ||
114 | } | ||
115 | |||
116 | template<typename ret> | ||
117 | Signal0<ret> slot( ret (*pFnc)( ) ) | ||
118 | { | ||
119 | if( !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
120 | return Signal0<ret>( | ||
121 | new __Slot0F<ret>( pFnc ) | ||
122 | ); | ||
123 | } | ||
124 | #endif // BU_SIGNAL_PARAM_COUNT_0 | ||
125 | |||
126 | #ifndef BU_SIGNAL_PARAM_COUNT_1 | ||
127 | #define BU_SIGNAL_PARAM_COUNT_1 | ||
128 | // | ||
129 | // 1 Parameter(s) | ||
130 | // | ||
131 | template<typename ret, typename p1t> | ||
132 | class _Slot1 | ||
133 | { | ||
134 | public: | ||
135 | _Slot1() { } | ||
136 | virtual ~_Slot1() { } | ||
137 | virtual ret operator()( p1t p1 )=0; | ||
138 | virtual _Slot1<ret, p1t> *clone() const=0; | ||
139 | }; | ||
140 | |||
141 | template<typename cls, typename ret, typename p1t> | ||
142 | class __Slot1 : public _Slot1<ret, p1t> | ||
143 | { | ||
144 | public: | ||
145 | __Slot1( cls *pCls, ret (cls::*pFnc)( p1t ) ) : | ||
146 | pCls( pCls ), pFnc( pFnc ) { } | ||
147 | virtual ~__Slot1() { } | ||
148 | |||
149 | virtual ret operator()( p1t p1 ) | ||
150 | { | ||
151 | return (pCls->*pFnc)( p1 ); | ||
152 | } | ||
153 | |||
154 | virtual _Slot1<ret, p1t> *clone() const | ||
155 | { | ||
156 | return new __Slot1<cls, ret, p1t>( pCls, pFnc ); | ||
157 | } | ||
158 | |||
159 | private: | ||
160 | cls *pCls; | ||
161 | ret (cls::*pFnc)( p1t ); | ||
162 | }; | ||
163 | |||
164 | template<typename ret, typename p1t> | ||
165 | class __Slot1F : public _Slot1<ret, p1t> | ||
166 | { | ||
167 | public: | ||
168 | __Slot1F( ret (*pFnc)( p1t ) ) : | ||
169 | pFnc( pFnc ) { } | ||
170 | virtual ~__Slot1F() { } | ||
171 | |||
172 | virtual ret operator()( p1t p1 ) | ||
173 | { | ||
174 | return (*pFnc)( p1 ); | ||
175 | } | ||
176 | |||
177 | virtual _Slot1<ret, p1t> *clone() const | ||
178 | { | ||
179 | return new __Slot1F<ret, p1t>( pFnc ); | ||
180 | } | ||
181 | |||
182 | private: | ||
183 | ret (*pFnc)( p1t ); | ||
184 | }; | ||
185 | |||
186 | template<typename ret, typename p1t> | ||
187 | class Signal1 | ||
188 | { | ||
189 | public: | ||
190 | Signal1() : pCb( NULL ) { } | ||
191 | Signal1( _Slot1<ret, p1t> *pCb ) : pCb( pCb ) { } | ||
192 | Signal1( const Signal1<ret, p1t> &rSrc ) : | ||
193 | pCb( (rSrc.pCb)?(rSrc.pCb->clone()):(NULL) ) { } | ||
194 | virtual ~Signal1() { delete pCb; pCb = NULL; } | ||
195 | |||
196 | ret operator()( p1t p1 ) | ||
197 | { | ||
198 | if( !pCb ) throw SignalException("Uninitialized signal called."); | ||
199 | return (*pCb)( p1 ); | ||
200 | } | ||
201 | |||
202 | bool isSet() const { return pCb != NULL; } | ||
203 | operator bool() const { return isSet(); } | ||
204 | |||
205 | Signal1<ret, p1t> &operator=( const Signal1<ret, p1t> &rhs ) | ||
206 | { | ||
207 | pCb = rhs.pCb->clone(); | ||
208 | return *this; | ||
209 | } | ||
210 | |||
211 | private: | ||
212 | _Slot1<ret, p1t> *pCb; | ||
213 | }; | ||
214 | |||
215 | template<typename cls, typename ret, typename p1t> | ||
216 | Signal1<ret, p1t> slot( cls *pCls, ret (cls::*pFnc)( p1t ) ) | ||
217 | { | ||
218 | if( !pCls || !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
219 | return Signal1<ret, p1t>( | ||
220 | new __Slot1<cls, ret, p1t>( pCls, pFnc ) | ||
221 | ); | ||
222 | } | ||
223 | |||
224 | template<typename ret, typename p1t> | ||
225 | Signal1<ret, p1t> slot( ret (*pFnc)( p1t ) ) | ||
226 | { | ||
227 | if( !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
228 | return Signal1<ret, p1t>( | ||
229 | new __Slot1F<ret, p1t>( pFnc ) | ||
230 | ); | ||
231 | } | ||
232 | #endif // BU_SIGNAL_PARAM_COUNT_1 | ||
233 | |||
234 | #ifndef BU_SIGNAL_PARAM_COUNT_2 | ||
235 | #define BU_SIGNAL_PARAM_COUNT_2 | ||
236 | // | ||
237 | // 2 Parameter(s) | ||
238 | // | ||
239 | template<typename ret, typename p1t, typename p2t> | ||
240 | class _Slot2 | ||
241 | { | ||
242 | public: | ||
243 | _Slot2() { } | ||
244 | virtual ~_Slot2() { } | ||
245 | virtual ret operator()( p1t p1, p2t p2 )=0; | ||
246 | virtual _Slot2<ret, p1t, p2t> *clone() const=0; | ||
247 | }; | ||
248 | |||
249 | template<typename cls, typename ret, typename p1t, typename p2t> | ||
250 | class __Slot2 : public _Slot2<ret, p1t, p2t> | ||
251 | { | ||
252 | public: | ||
253 | __Slot2( cls *pCls, ret (cls::*pFnc)( p1t, p2t ) ) : | ||
254 | pCls( pCls ), pFnc( pFnc ) { } | ||
255 | virtual ~__Slot2() { } | ||
256 | |||
257 | virtual ret operator()( p1t p1, p2t p2 ) | ||
258 | { | ||
259 | return (pCls->*pFnc)( p1, p2 ); | ||
260 | } | ||
261 | |||
262 | virtual _Slot2<ret, p1t, p2t> *clone() const | ||
263 | { | ||
264 | return new __Slot2<cls, ret, p1t, p2t>( pCls, pFnc ); | ||
265 | } | ||
266 | |||
267 | private: | ||
268 | cls *pCls; | ||
269 | ret (cls::*pFnc)( p1t, p2t ); | ||
270 | }; | ||
271 | |||
272 | template<typename ret, typename p1t, typename p2t> | ||
273 | class __Slot2F : public _Slot2<ret, p1t, p2t> | ||
274 | { | ||
275 | public: | ||
276 | __Slot2F( ret (*pFnc)( p1t, p2t ) ) : | ||
277 | pFnc( pFnc ) { } | ||
278 | virtual ~__Slot2F() { } | ||
279 | |||
280 | virtual ret operator()( p1t p1, p2t p2 ) | ||
281 | { | ||
282 | return (*pFnc)( p1, p2 ); | ||
283 | } | ||
284 | |||
285 | virtual _Slot2<ret, p1t, p2t> *clone() const | ||
286 | { | ||
287 | return new __Slot2F<ret, p1t, p2t>( pFnc ); | ||
288 | } | ||
289 | |||
290 | private: | ||
291 | ret (*pFnc)( p1t, p2t ); | ||
292 | }; | ||
293 | |||
294 | template<typename ret, typename p1t, typename p2t> | ||
295 | class Signal2 | ||
296 | { | ||
297 | public: | ||
298 | Signal2() : pCb( NULL ) { } | ||
299 | Signal2( _Slot2<ret, p1t, p2t> *pCb ) : pCb( pCb ) { } | ||
300 | Signal2( const Signal2<ret, p1t, p2t> &rSrc ) : | ||
301 | pCb( (rSrc.pCb)?(rSrc.pCb->clone()):(NULL) ) { } | ||
302 | virtual ~Signal2() { delete pCb; pCb = NULL; } | ||
303 | |||
304 | ret operator()( p1t p1, p2t p2 ) | ||
305 | { | ||
306 | if( !pCb ) throw SignalException("Uninitialized signal called."); | ||
307 | return (*pCb)( p1, p2 ); | ||
308 | } | ||
309 | |||
310 | bool isSet() const { return pCb != NULL; } | ||
311 | operator bool() const { return isSet(); } | ||
312 | |||
313 | Signal2<ret, p1t, p2t> &operator=( const Signal2<ret, p1t, p2t> &rhs ) | ||
314 | { | ||
315 | pCb = rhs.pCb->clone(); | ||
316 | return *this; | ||
317 | } | ||
318 | |||
319 | private: | ||
320 | _Slot2<ret, p1t, p2t> *pCb; | ||
321 | }; | ||
322 | |||
323 | template<typename cls, typename ret, typename p1t, typename p2t> | ||
324 | Signal2<ret, p1t, p2t> slot( cls *pCls, ret (cls::*pFnc)( p1t, p2t ) ) | ||
325 | { | ||
326 | if( !pCls || !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
327 | return Signal2<ret, p1t, p2t>( | ||
328 | new __Slot2<cls, ret, p1t, p2t>( pCls, pFnc ) | ||
329 | ); | ||
330 | } | ||
331 | |||
332 | template<typename ret, typename p1t, typename p2t> | ||
333 | Signal2<ret, p1t, p2t> slot( ret (*pFnc)( p1t, p2t ) ) | ||
334 | { | ||
335 | if( !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
336 | return Signal2<ret, p1t, p2t>( | ||
337 | new __Slot2F<ret, p1t, p2t>( pFnc ) | ||
338 | ); | ||
339 | } | ||
340 | #endif // BU_SIGNAL_PARAM_COUNT_2 | ||
341 | |||
342 | #ifndef BU_SIGNAL_PARAM_COUNT_3 | ||
343 | #define BU_SIGNAL_PARAM_COUNT_3 | ||
344 | // | ||
345 | // 3 Parameter(s) | ||
346 | // | ||
347 | template<typename ret, typename p1t, typename p2t, typename p3t> | ||
348 | class _Slot3 | ||
349 | { | ||
350 | public: | ||
351 | _Slot3() { } | ||
352 | virtual ~_Slot3() { } | ||
353 | virtual ret operator()( p1t p1, p2t p2, p3t p3 )=0; | ||
354 | virtual _Slot3<ret, p1t, p2t, p3t> *clone() const=0; | ||
355 | }; | ||
356 | |||
357 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t> | ||
358 | class __Slot3 : public _Slot3<ret, p1t, p2t, p3t> | ||
359 | { | ||
360 | public: | ||
361 | __Slot3( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t ) ) : | ||
362 | pCls( pCls ), pFnc( pFnc ) { } | ||
363 | virtual ~__Slot3() { } | ||
364 | |||
365 | virtual ret operator()( p1t p1, p2t p2, p3t p3 ) | ||
366 | { | ||
367 | return (pCls->*pFnc)( p1, p2, p3 ); | ||
368 | } | ||
369 | |||
370 | virtual _Slot3<ret, p1t, p2t, p3t> *clone() const | ||
371 | { | ||
372 | return new __Slot3<cls, ret, p1t, p2t, p3t>( pCls, pFnc ); | ||
373 | } | ||
374 | |||
375 | private: | ||
376 | cls *pCls; | ||
377 | ret (cls::*pFnc)( p1t, p2t, p3t ); | ||
378 | }; | ||
379 | |||
380 | template<typename ret, typename p1t, typename p2t, typename p3t> | ||
381 | class __Slot3F : public _Slot3<ret, p1t, p2t, p3t> | ||
382 | { | ||
383 | public: | ||
384 | __Slot3F( ret (*pFnc)( p1t, p2t, p3t ) ) : | ||
385 | pFnc( pFnc ) { } | ||
386 | virtual ~__Slot3F() { } | ||
387 | |||
388 | virtual ret operator()( p1t p1, p2t p2, p3t p3 ) | ||
389 | { | ||
390 | return (*pFnc)( p1, p2, p3 ); | ||
391 | } | ||
392 | |||
393 | virtual _Slot3<ret, p1t, p2t, p3t> *clone() const | ||
394 | { | ||
395 | return new __Slot3F<ret, p1t, p2t, p3t>( pFnc ); | ||
396 | } | ||
397 | |||
398 | private: | ||
399 | ret (*pFnc)( p1t, p2t, p3t ); | ||
400 | }; | ||
401 | |||
402 | template<typename ret, typename p1t, typename p2t, typename p3t> | ||
403 | class Signal3 | ||
404 | { | ||
405 | public: | ||
406 | Signal3() : pCb( NULL ) { } | ||
407 | Signal3( _Slot3<ret, p1t, p2t, p3t> *pCb ) : pCb( pCb ) { } | ||
408 | Signal3( const Signal3<ret, p1t, p2t, p3t> &rSrc ) : | ||
409 | pCb( (rSrc.pCb)?(rSrc.pCb->clone()):(NULL) ) { } | ||
410 | virtual ~Signal3() { delete pCb; pCb = NULL; } | ||
411 | |||
412 | ret operator()( p1t p1, p2t p2, p3t p3 ) | ||
413 | { | ||
414 | if( !pCb ) throw SignalException("Uninitialized signal called."); | ||
415 | return (*pCb)( p1, p2, p3 ); | ||
416 | } | ||
417 | |||
418 | bool isSet() const { return pCb != NULL; } | ||
419 | operator bool() const { return isSet(); } | ||
420 | |||
421 | Signal3<ret, p1t, p2t, p3t> &operator=( const Signal3<ret, p1t, p2t, p3t> &rhs ) | ||
422 | { | ||
423 | pCb = rhs.pCb->clone(); | ||
424 | return *this; | ||
425 | } | ||
426 | |||
427 | private: | ||
428 | _Slot3<ret, p1t, p2t, p3t> *pCb; | ||
429 | }; | ||
430 | |||
431 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t> | ||
432 | Signal3<ret, p1t, p2t, p3t> slot( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t ) ) | ||
433 | { | ||
434 | if( !pCls || !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
435 | return Signal3<ret, p1t, p2t, p3t>( | ||
436 | new __Slot3<cls, ret, p1t, p2t, p3t>( pCls, pFnc ) | ||
437 | ); | ||
438 | } | ||
439 | |||
440 | template<typename ret, typename p1t, typename p2t, typename p3t> | ||
441 | Signal3<ret, p1t, p2t, p3t> slot( ret (*pFnc)( p1t, p2t, p3t ) ) | ||
442 | { | ||
443 | if( !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
444 | return Signal3<ret, p1t, p2t, p3t>( | ||
445 | new __Slot3F<ret, p1t, p2t, p3t>( pFnc ) | ||
446 | ); | ||
447 | } | ||
448 | #endif // BU_SIGNAL_PARAM_COUNT_3 | ||
449 | |||
450 | #ifndef BU_SIGNAL_PARAM_COUNT_4 | ||
451 | #define BU_SIGNAL_PARAM_COUNT_4 | ||
452 | // | ||
453 | // 4 Parameter(s) | ||
454 | // | ||
455 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t> | ||
456 | class _Slot4 | ||
457 | { | ||
458 | public: | ||
459 | _Slot4() { } | ||
460 | virtual ~_Slot4() { } | ||
461 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4 )=0; | ||
462 | virtual _Slot4<ret, p1t, p2t, p3t, p4t> *clone() const=0; | ||
463 | }; | ||
464 | |||
465 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t> | ||
466 | class __Slot4 : public _Slot4<ret, p1t, p2t, p3t, p4t> | ||
467 | { | ||
468 | public: | ||
469 | __Slot4( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t ) ) : | ||
470 | pCls( pCls ), pFnc( pFnc ) { } | ||
471 | virtual ~__Slot4() { } | ||
472 | |||
473 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4 ) | ||
474 | { | ||
475 | return (pCls->*pFnc)( p1, p2, p3, p4 ); | ||
476 | } | ||
477 | |||
478 | virtual _Slot4<ret, p1t, p2t, p3t, p4t> *clone() const | ||
479 | { | ||
480 | return new __Slot4<cls, ret, p1t, p2t, p3t, p4t>( pCls, pFnc ); | ||
481 | } | ||
482 | |||
483 | private: | ||
484 | cls *pCls; | ||
485 | ret (cls::*pFnc)( p1t, p2t, p3t, p4t ); | ||
486 | }; | ||
487 | |||
488 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t> | ||
489 | class __Slot4F : public _Slot4<ret, p1t, p2t, p3t, p4t> | ||
490 | { | ||
491 | public: | ||
492 | __Slot4F( ret (*pFnc)( p1t, p2t, p3t, p4t ) ) : | ||
493 | pFnc( pFnc ) { } | ||
494 | virtual ~__Slot4F() { } | ||
495 | |||
496 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4 ) | ||
497 | { | ||
498 | return (*pFnc)( p1, p2, p3, p4 ); | ||
499 | } | ||
500 | |||
501 | virtual _Slot4<ret, p1t, p2t, p3t, p4t> *clone() const | ||
502 | { | ||
503 | return new __Slot4F<ret, p1t, p2t, p3t, p4t>( pFnc ); | ||
504 | } | ||
505 | |||
506 | private: | ||
507 | ret (*pFnc)( p1t, p2t, p3t, p4t ); | ||
508 | }; | ||
509 | |||
510 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t> | ||
511 | class Signal4 | ||
512 | { | ||
513 | public: | ||
514 | Signal4() : pCb( NULL ) { } | ||
515 | Signal4( _Slot4<ret, p1t, p2t, p3t, p4t> *pCb ) : pCb( pCb ) { } | ||
516 | Signal4( const Signal4<ret, p1t, p2t, p3t, p4t> &rSrc ) : | ||
517 | pCb( (rSrc.pCb)?(rSrc.pCb->clone()):(NULL) ) { } | ||
518 | virtual ~Signal4() { delete pCb; pCb = NULL; } | ||
519 | |||
520 | ret operator()( p1t p1, p2t p2, p3t p3, p4t p4 ) | ||
521 | { | ||
522 | if( !pCb ) throw SignalException("Uninitialized signal called."); | ||
523 | return (*pCb)( p1, p2, p3, p4 ); | ||
524 | } | ||
525 | |||
526 | bool isSet() const { return pCb != NULL; } | ||
527 | operator bool() const { return isSet(); } | ||
528 | |||
529 | Signal4<ret, p1t, p2t, p3t, p4t> &operator=( const Signal4<ret, p1t, p2t, p3t, p4t> &rhs ) | ||
530 | { | ||
531 | pCb = rhs.pCb->clone(); | ||
532 | return *this; | ||
533 | } | ||
534 | |||
535 | private: | ||
536 | _Slot4<ret, p1t, p2t, p3t, p4t> *pCb; | ||
537 | }; | ||
538 | |||
539 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t> | ||
540 | Signal4<ret, p1t, p2t, p3t, p4t> slot( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t ) ) | ||
541 | { | ||
542 | if( !pCls || !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
543 | return Signal4<ret, p1t, p2t, p3t, p4t>( | ||
544 | new __Slot4<cls, ret, p1t, p2t, p3t, p4t>( pCls, pFnc ) | ||
545 | ); | ||
546 | } | ||
547 | |||
548 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t> | ||
549 | Signal4<ret, p1t, p2t, p3t, p4t> slot( ret (*pFnc)( p1t, p2t, p3t, p4t ) ) | ||
550 | { | ||
551 | if( !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
552 | return Signal4<ret, p1t, p2t, p3t, p4t>( | ||
553 | new __Slot4F<ret, p1t, p2t, p3t, p4t>( pFnc ) | ||
554 | ); | ||
555 | } | ||
556 | #endif // BU_SIGNAL_PARAM_COUNT_4 | ||
557 | |||
558 | #ifndef BU_SIGNAL_PARAM_COUNT_5 | ||
559 | #define BU_SIGNAL_PARAM_COUNT_5 | ||
560 | // | ||
561 | // 5 Parameter(s) | ||
562 | // | ||
563 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t> | ||
564 | class _Slot5 | ||
565 | { | ||
566 | public: | ||
567 | _Slot5() { } | ||
568 | virtual ~_Slot5() { } | ||
569 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5 )=0; | ||
570 | virtual _Slot5<ret, p1t, p2t, p3t, p4t, p5t> *clone() const=0; | ||
571 | }; | ||
572 | |||
573 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t> | ||
574 | class __Slot5 : public _Slot5<ret, p1t, p2t, p3t, p4t, p5t> | ||
575 | { | ||
576 | public: | ||
577 | __Slot5( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t ) ) : | ||
578 | pCls( pCls ), pFnc( pFnc ) { } | ||
579 | virtual ~__Slot5() { } | ||
580 | |||
581 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5 ) | ||
582 | { | ||
583 | return (pCls->*pFnc)( p1, p2, p3, p4, p5 ); | ||
584 | } | ||
585 | |||
586 | virtual _Slot5<ret, p1t, p2t, p3t, p4t, p5t> *clone() const | ||
587 | { | ||
588 | return new __Slot5<cls, ret, p1t, p2t, p3t, p4t, p5t>( pCls, pFnc ); | ||
589 | } | ||
590 | |||
591 | private: | ||
592 | cls *pCls; | ||
593 | ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t ); | ||
594 | }; | ||
595 | |||
596 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t> | ||
597 | class __Slot5F : public _Slot5<ret, p1t, p2t, p3t, p4t, p5t> | ||
598 | { | ||
599 | public: | ||
600 | __Slot5F( ret (*pFnc)( p1t, p2t, p3t, p4t, p5t ) ) : | ||
601 | pFnc( pFnc ) { } | ||
602 | virtual ~__Slot5F() { } | ||
603 | |||
604 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5 ) | ||
605 | { | ||
606 | return (*pFnc)( p1, p2, p3, p4, p5 ); | ||
607 | } | ||
608 | |||
609 | virtual _Slot5<ret, p1t, p2t, p3t, p4t, p5t> *clone() const | ||
610 | { | ||
611 | return new __Slot5F<ret, p1t, p2t, p3t, p4t, p5t>( pFnc ); | ||
612 | } | ||
613 | |||
614 | private: | ||
615 | ret (*pFnc)( p1t, p2t, p3t, p4t, p5t ); | ||
616 | }; | ||
617 | |||
618 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t> | ||
619 | class Signal5 | ||
620 | { | ||
621 | public: | ||
622 | Signal5() : pCb( NULL ) { } | ||
623 | Signal5( _Slot5<ret, p1t, p2t, p3t, p4t, p5t> *pCb ) : pCb( pCb ) { } | ||
624 | Signal5( const Signal5<ret, p1t, p2t, p3t, p4t, p5t> &rSrc ) : | ||
625 | pCb( (rSrc.pCb)?(rSrc.pCb->clone()):(NULL) ) { } | ||
626 | virtual ~Signal5() { delete pCb; pCb = NULL; } | ||
627 | |||
628 | ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5 ) | ||
629 | { | ||
630 | if( !pCb ) throw SignalException("Uninitialized signal called."); | ||
631 | return (*pCb)( p1, p2, p3, p4, p5 ); | ||
632 | } | ||
633 | |||
634 | bool isSet() const { return pCb != NULL; } | ||
635 | operator bool() const { return isSet(); } | ||
636 | |||
637 | Signal5<ret, p1t, p2t, p3t, p4t, p5t> &operator=( const Signal5<ret, p1t, p2t, p3t, p4t, p5t> &rhs ) | ||
638 | { | ||
639 | pCb = rhs.pCb->clone(); | ||
640 | return *this; | ||
641 | } | ||
642 | |||
643 | private: | ||
644 | _Slot5<ret, p1t, p2t, p3t, p4t, p5t> *pCb; | ||
645 | }; | ||
646 | |||
647 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t> | ||
648 | Signal5<ret, p1t, p2t, p3t, p4t, p5t> slot( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t ) ) | ||
649 | { | ||
650 | if( !pCls || !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
651 | return Signal5<ret, p1t, p2t, p3t, p4t, p5t>( | ||
652 | new __Slot5<cls, ret, p1t, p2t, p3t, p4t, p5t>( pCls, pFnc ) | ||
653 | ); | ||
654 | } | ||
655 | |||
656 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t> | ||
657 | Signal5<ret, p1t, p2t, p3t, p4t, p5t> slot( ret (*pFnc)( p1t, p2t, p3t, p4t, p5t ) ) | ||
658 | { | ||
659 | if( !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
660 | return Signal5<ret, p1t, p2t, p3t, p4t, p5t>( | ||
661 | new __Slot5F<ret, p1t, p2t, p3t, p4t, p5t>( pFnc ) | ||
662 | ); | ||
663 | } | ||
664 | #endif // BU_SIGNAL_PARAM_COUNT_5 | ||
665 | |||
666 | #ifndef BU_SIGNAL_PARAM_COUNT_6 | ||
667 | #define BU_SIGNAL_PARAM_COUNT_6 | ||
668 | // | ||
669 | // 6 Parameter(s) | ||
670 | // | ||
671 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t> | ||
672 | class _Slot6 | ||
673 | { | ||
674 | public: | ||
675 | _Slot6() { } | ||
676 | virtual ~_Slot6() { } | ||
677 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6 )=0; | ||
678 | virtual _Slot6<ret, p1t, p2t, p3t, p4t, p5t, p6t> *clone() const=0; | ||
679 | }; | ||
680 | |||
681 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t> | ||
682 | class __Slot6 : public _Slot6<ret, p1t, p2t, p3t, p4t, p5t, p6t> | ||
683 | { | ||
684 | public: | ||
685 | __Slot6( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t ) ) : | ||
686 | pCls( pCls ), pFnc( pFnc ) { } | ||
687 | virtual ~__Slot6() { } | ||
688 | |||
689 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6 ) | ||
690 | { | ||
691 | return (pCls->*pFnc)( p1, p2, p3, p4, p5, p6 ); | ||
692 | } | ||
693 | |||
694 | virtual _Slot6<ret, p1t, p2t, p3t, p4t, p5t, p6t> *clone() const | ||
695 | { | ||
696 | return new __Slot6<cls, ret, p1t, p2t, p3t, p4t, p5t, p6t>( pCls, pFnc ); | ||
697 | } | ||
698 | |||
699 | private: | ||
700 | cls *pCls; | ||
701 | ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t ); | ||
702 | }; | ||
703 | |||
704 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t> | ||
705 | class __Slot6F : public _Slot6<ret, p1t, p2t, p3t, p4t, p5t, p6t> | ||
706 | { | ||
707 | public: | ||
708 | __Slot6F( ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t ) ) : | ||
709 | pFnc( pFnc ) { } | ||
710 | virtual ~__Slot6F() { } | ||
711 | |||
712 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6 ) | ||
713 | { | ||
714 | return (*pFnc)( p1, p2, p3, p4, p5, p6 ); | ||
715 | } | ||
716 | |||
717 | virtual _Slot6<ret, p1t, p2t, p3t, p4t, p5t, p6t> *clone() const | ||
718 | { | ||
719 | return new __Slot6F<ret, p1t, p2t, p3t, p4t, p5t, p6t>( pFnc ); | ||
720 | } | ||
721 | |||
722 | private: | ||
723 | ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t ); | ||
724 | }; | ||
725 | |||
726 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t> | ||
727 | class Signal6 | ||
728 | { | ||
729 | public: | ||
730 | Signal6() : pCb( NULL ) { } | ||
731 | Signal6( _Slot6<ret, p1t, p2t, p3t, p4t, p5t, p6t> *pCb ) : pCb( pCb ) { } | ||
732 | Signal6( const Signal6<ret, p1t, p2t, p3t, p4t, p5t, p6t> &rSrc ) : | ||
733 | pCb( (rSrc.pCb)?(rSrc.pCb->clone()):(NULL) ) { } | ||
734 | virtual ~Signal6() { delete pCb; pCb = NULL; } | ||
735 | |||
736 | ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6 ) | ||
737 | { | ||
738 | if( !pCb ) throw SignalException("Uninitialized signal called."); | ||
739 | return (*pCb)( p1, p2, p3, p4, p5, p6 ); | ||
740 | } | ||
741 | |||
742 | bool isSet() const { return pCb != NULL; } | ||
743 | operator bool() const { return isSet(); } | ||
744 | |||
745 | Signal6<ret, p1t, p2t, p3t, p4t, p5t, p6t> &operator=( const Signal6<ret, p1t, p2t, p3t, p4t, p5t, p6t> &rhs ) | ||
746 | { | ||
747 | pCb = rhs.pCb->clone(); | ||
748 | return *this; | ||
749 | } | ||
750 | |||
751 | private: | ||
752 | _Slot6<ret, p1t, p2t, p3t, p4t, p5t, p6t> *pCb; | ||
753 | }; | ||
754 | |||
755 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t> | ||
756 | Signal6<ret, p1t, p2t, p3t, p4t, p5t, p6t> slot( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t ) ) | ||
757 | { | ||
758 | if( !pCls || !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
759 | return Signal6<ret, p1t, p2t, p3t, p4t, p5t, p6t>( | ||
760 | new __Slot6<cls, ret, p1t, p2t, p3t, p4t, p5t, p6t>( pCls, pFnc ) | ||
761 | ); | ||
762 | } | ||
763 | |||
764 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t> | ||
765 | Signal6<ret, p1t, p2t, p3t, p4t, p5t, p6t> slot( ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t ) ) | ||
766 | { | ||
767 | if( !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
768 | return Signal6<ret, p1t, p2t, p3t, p4t, p5t, p6t>( | ||
769 | new __Slot6F<ret, p1t, p2t, p3t, p4t, p5t, p6t>( pFnc ) | ||
770 | ); | ||
771 | } | ||
772 | #endif // BU_SIGNAL_PARAM_COUNT_6 | ||
773 | |||
774 | #ifndef BU_SIGNAL_PARAM_COUNT_7 | ||
775 | #define BU_SIGNAL_PARAM_COUNT_7 | ||
776 | // | ||
777 | // 7 Parameter(s) | ||
778 | // | ||
779 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t> | ||
780 | class _Slot7 | ||
781 | { | ||
782 | public: | ||
783 | _Slot7() { } | ||
784 | virtual ~_Slot7() { } | ||
785 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7 )=0; | ||
786 | virtual _Slot7<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t> *clone() const=0; | ||
787 | }; | ||
788 | |||
789 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t> | ||
790 | class __Slot7 : public _Slot7<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t> | ||
791 | { | ||
792 | public: | ||
793 | __Slot7( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t ) ) : | ||
794 | pCls( pCls ), pFnc( pFnc ) { } | ||
795 | virtual ~__Slot7() { } | ||
796 | |||
797 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7 ) | ||
798 | { | ||
799 | return (pCls->*pFnc)( p1, p2, p3, p4, p5, p6, p7 ); | ||
800 | } | ||
801 | |||
802 | virtual _Slot7<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t> *clone() const | ||
803 | { | ||
804 | return new __Slot7<cls, ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t>( pCls, pFnc ); | ||
805 | } | ||
806 | |||
807 | private: | ||
808 | cls *pCls; | ||
809 | ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t ); | ||
810 | }; | ||
811 | |||
812 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t> | ||
813 | class __Slot7F : public _Slot7<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t> | ||
814 | { | ||
815 | public: | ||
816 | __Slot7F( ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t ) ) : | ||
817 | pFnc( pFnc ) { } | ||
818 | virtual ~__Slot7F() { } | ||
819 | |||
820 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7 ) | ||
821 | { | ||
822 | return (*pFnc)( p1, p2, p3, p4, p5, p6, p7 ); | ||
823 | } | ||
824 | |||
825 | virtual _Slot7<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t> *clone() const | ||
826 | { | ||
827 | return new __Slot7F<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t>( pFnc ); | ||
828 | } | ||
829 | |||
830 | private: | ||
831 | ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t ); | ||
832 | }; | ||
833 | |||
834 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t> | ||
835 | class Signal7 | ||
836 | { | ||
837 | public: | ||
838 | Signal7() : pCb( NULL ) { } | ||
839 | Signal7( _Slot7<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t> *pCb ) : pCb( pCb ) { } | ||
840 | Signal7( const Signal7<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t> &rSrc ) : | ||
841 | pCb( (rSrc.pCb)?(rSrc.pCb->clone()):(NULL) ) { } | ||
842 | virtual ~Signal7() { delete pCb; pCb = NULL; } | ||
843 | |||
844 | ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7 ) | ||
845 | { | ||
846 | if( !pCb ) throw SignalException("Uninitialized signal called."); | ||
847 | return (*pCb)( p1, p2, p3, p4, p5, p6, p7 ); | ||
848 | } | ||
849 | |||
850 | bool isSet() const { return pCb != NULL; } | ||
851 | operator bool() const { return isSet(); } | ||
852 | |||
853 | Signal7<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t> &operator=( const Signal7<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t> &rhs ) | ||
854 | { | ||
855 | pCb = rhs.pCb->clone(); | ||
856 | return *this; | ||
857 | } | ||
858 | |||
859 | private: | ||
860 | _Slot7<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t> *pCb; | ||
861 | }; | ||
862 | |||
863 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t> | ||
864 | Signal7<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t> slot( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t ) ) | ||
865 | { | ||
866 | if( !pCls || !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
867 | return Signal7<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t>( | ||
868 | new __Slot7<cls, ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t>( pCls, pFnc ) | ||
869 | ); | ||
870 | } | ||
871 | |||
872 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t> | ||
873 | Signal7<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t> slot( ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t ) ) | ||
874 | { | ||
875 | if( !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
876 | return Signal7<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t>( | ||
877 | new __Slot7F<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t>( pFnc ) | ||
878 | ); | ||
879 | } | ||
880 | #endif // BU_SIGNAL_PARAM_COUNT_7 | ||
881 | |||
882 | #ifndef BU_SIGNAL_PARAM_COUNT_8 | ||
883 | #define BU_SIGNAL_PARAM_COUNT_8 | ||
884 | // | ||
885 | // 8 Parameter(s) | ||
886 | // | ||
887 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t> | ||
888 | class _Slot8 | ||
889 | { | ||
890 | public: | ||
891 | _Slot8() { } | ||
892 | virtual ~_Slot8() { } | ||
893 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7, p8t p8 )=0; | ||
894 | virtual _Slot8<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t> *clone() const=0; | ||
895 | }; | ||
896 | |||
897 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t> | ||
898 | class __Slot8 : public _Slot8<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t> | ||
899 | { | ||
900 | public: | ||
901 | __Slot8( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t ) ) : | ||
902 | pCls( pCls ), pFnc( pFnc ) { } | ||
903 | virtual ~__Slot8() { } | ||
904 | |||
905 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7, p8t p8 ) | ||
906 | { | ||
907 | return (pCls->*pFnc)( p1, p2, p3, p4, p5, p6, p7, p8 ); | ||
908 | } | ||
909 | |||
910 | virtual _Slot8<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t> *clone() const | ||
911 | { | ||
912 | return new __Slot8<cls, ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t>( pCls, pFnc ); | ||
913 | } | ||
914 | |||
915 | private: | ||
916 | cls *pCls; | ||
917 | ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t ); | ||
918 | }; | ||
919 | |||
920 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t> | ||
921 | class __Slot8F : public _Slot8<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t> | ||
922 | { | ||
923 | public: | ||
924 | __Slot8F( ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t ) ) : | ||
925 | pFnc( pFnc ) { } | ||
926 | virtual ~__Slot8F() { } | ||
927 | |||
928 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7, p8t p8 ) | ||
929 | { | ||
930 | return (*pFnc)( p1, p2, p3, p4, p5, p6, p7, p8 ); | ||
931 | } | ||
932 | |||
933 | virtual _Slot8<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t> *clone() const | ||
934 | { | ||
935 | return new __Slot8F<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t>( pFnc ); | ||
936 | } | ||
937 | |||
938 | private: | ||
939 | ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t ); | ||
940 | }; | ||
941 | |||
942 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t> | ||
943 | class Signal8 | ||
944 | { | ||
945 | public: | ||
946 | Signal8() : pCb( NULL ) { } | ||
947 | Signal8( _Slot8<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t> *pCb ) : pCb( pCb ) { } | ||
948 | Signal8( const Signal8<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t> &rSrc ) : | ||
949 | pCb( (rSrc.pCb)?(rSrc.pCb->clone()):(NULL) ) { } | ||
950 | virtual ~Signal8() { delete pCb; pCb = NULL; } | ||
951 | |||
952 | ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7, p8t p8 ) | ||
953 | { | ||
954 | if( !pCb ) throw SignalException("Uninitialized signal called."); | ||
955 | return (*pCb)( p1, p2, p3, p4, p5, p6, p7, p8 ); | ||
956 | } | ||
957 | |||
958 | bool isSet() const { return pCb != NULL; } | ||
959 | operator bool() const { return isSet(); } | ||
960 | |||
961 | Signal8<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t> &operator=( const Signal8<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t> &rhs ) | ||
962 | { | ||
963 | pCb = rhs.pCb->clone(); | ||
964 | return *this; | ||
965 | } | ||
966 | |||
967 | private: | ||
968 | _Slot8<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t> *pCb; | ||
969 | }; | ||
970 | |||
971 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t> | ||
972 | Signal8<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t> slot( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t ) ) | ||
973 | { | ||
974 | if( !pCls || !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
975 | return Signal8<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t>( | ||
976 | new __Slot8<cls, ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t>( pCls, pFnc ) | ||
977 | ); | ||
978 | } | ||
979 | |||
980 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t> | ||
981 | Signal8<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t> slot( ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t ) ) | ||
982 | { | ||
983 | if( !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
984 | return Signal8<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t>( | ||
985 | new __Slot8F<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t>( pFnc ) | ||
986 | ); | ||
987 | } | ||
988 | #endif // BU_SIGNAL_PARAM_COUNT_8 | ||
989 | |||
990 | #ifndef BU_SIGNAL_PARAM_COUNT_9 | ||
991 | #define BU_SIGNAL_PARAM_COUNT_9 | ||
992 | // | ||
993 | // 9 Parameter(s) | ||
994 | // | ||
995 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t, typename p9t> | ||
996 | class _Slot9 | ||
997 | { | ||
998 | public: | ||
999 | _Slot9() { } | ||
1000 | virtual ~_Slot9() { } | ||
1001 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7, p8t p8, p9t p9 )=0; | ||
1002 | virtual _Slot9<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t> *clone() const=0; | ||
1003 | }; | ||
1004 | |||
1005 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t, typename p9t> | ||
1006 | class __Slot9 : public _Slot9<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t> | ||
1007 | { | ||
1008 | public: | ||
1009 | __Slot9( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t ) ) : | ||
1010 | pCls( pCls ), pFnc( pFnc ) { } | ||
1011 | virtual ~__Slot9() { } | ||
1012 | |||
1013 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7, p8t p8, p9t p9 ) | ||
1014 | { | ||
1015 | return (pCls->*pFnc)( p1, p2, p3, p4, p5, p6, p7, p8, p9 ); | ||
1016 | } | ||
1017 | |||
1018 | virtual _Slot9<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t> *clone() const | ||
1019 | { | ||
1020 | return new __Slot9<cls, ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t>( pCls, pFnc ); | ||
1021 | } | ||
1022 | |||
1023 | private: | ||
1024 | cls *pCls; | ||
1025 | ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t ); | ||
1026 | }; | ||
1027 | |||
1028 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t, typename p9t> | ||
1029 | class __Slot9F : public _Slot9<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t> | ||
1030 | { | ||
1031 | public: | ||
1032 | __Slot9F( ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t ) ) : | ||
1033 | pFnc( pFnc ) { } | ||
1034 | virtual ~__Slot9F() { } | ||
1035 | |||
1036 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7, p8t p8, p9t p9 ) | ||
1037 | { | ||
1038 | return (*pFnc)( p1, p2, p3, p4, p5, p6, p7, p8, p9 ); | ||
1039 | } | ||
1040 | |||
1041 | virtual _Slot9<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t> *clone() const | ||
1042 | { | ||
1043 | return new __Slot9F<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t>( pFnc ); | ||
1044 | } | ||
1045 | |||
1046 | private: | ||
1047 | ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t ); | ||
1048 | }; | ||
1049 | |||
1050 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t, typename p9t> | ||
1051 | class Signal9 | ||
1052 | { | ||
1053 | public: | ||
1054 | Signal9() : pCb( NULL ) { } | ||
1055 | Signal9( _Slot9<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t> *pCb ) : pCb( pCb ) { } | ||
1056 | Signal9( const Signal9<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t> &rSrc ) : | ||
1057 | pCb( (rSrc.pCb)?(rSrc.pCb->clone()):(NULL) ) { } | ||
1058 | virtual ~Signal9() { delete pCb; pCb = NULL; } | ||
1059 | |||
1060 | ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7, p8t p8, p9t p9 ) | ||
1061 | { | ||
1062 | if( !pCb ) throw SignalException("Uninitialized signal called."); | ||
1063 | return (*pCb)( p1, p2, p3, p4, p5, p6, p7, p8, p9 ); | ||
1064 | } | ||
1065 | |||
1066 | bool isSet() const { return pCb != NULL; } | ||
1067 | operator bool() const { return isSet(); } | ||
1068 | |||
1069 | Signal9<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t> &operator=( const Signal9<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t> &rhs ) | ||
1070 | { | ||
1071 | pCb = rhs.pCb->clone(); | ||
1072 | return *this; | ||
1073 | } | ||
1074 | |||
1075 | private: | ||
1076 | _Slot9<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t> *pCb; | ||
1077 | }; | ||
1078 | |||
1079 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t, typename p9t> | ||
1080 | Signal9<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t> slot( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t ) ) | ||
1081 | { | ||
1082 | if( !pCls || !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
1083 | return Signal9<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t>( | ||
1084 | new __Slot9<cls, ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t>( pCls, pFnc ) | ||
1085 | ); | ||
1086 | } | ||
1087 | |||
1088 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t, typename p9t> | ||
1089 | Signal9<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t> slot( ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t ) ) | ||
1090 | { | ||
1091 | if( !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
1092 | return Signal9<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t>( | ||
1093 | new __Slot9F<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t>( pFnc ) | ||
1094 | ); | ||
1095 | } | ||
1096 | #endif // BU_SIGNAL_PARAM_COUNT_9 | ||
1097 | |||
1098 | #ifndef BU_SIGNAL_PARAM_COUNT_10 | ||
1099 | #define BU_SIGNAL_PARAM_COUNT_10 | ||
1100 | // | ||
1101 | // 10 Parameter(s) | ||
1102 | // | ||
1103 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t, typename p9t, typename p10t> | ||
1104 | class _Slot10 | ||
1105 | { | ||
1106 | public: | ||
1107 | _Slot10() { } | ||
1108 | virtual ~_Slot10() { } | ||
1109 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7, p8t p8, p9t p9, p10t p10 )=0; | ||
1110 | virtual _Slot10<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t> *clone() const=0; | ||
1111 | }; | ||
1112 | |||
1113 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t, typename p9t, typename p10t> | ||
1114 | class __Slot10 : public _Slot10<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t> | ||
1115 | { | ||
1116 | public: | ||
1117 | __Slot10( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t ) ) : | ||
1118 | pCls( pCls ), pFnc( pFnc ) { } | ||
1119 | virtual ~__Slot10() { } | ||
1120 | |||
1121 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7, p8t p8, p9t p9, p10t p10 ) | ||
1122 | { | ||
1123 | return (pCls->*pFnc)( p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 ); | ||
1124 | } | ||
1125 | |||
1126 | virtual _Slot10<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t> *clone() const | ||
1127 | { | ||
1128 | return new __Slot10<cls, ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t>( pCls, pFnc ); | ||
1129 | } | ||
1130 | |||
1131 | private: | ||
1132 | cls *pCls; | ||
1133 | ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t ); | ||
1134 | }; | ||
1135 | |||
1136 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t, typename p9t, typename p10t> | ||
1137 | class __Slot10F : public _Slot10<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t> | ||
1138 | { | ||
1139 | public: | ||
1140 | __Slot10F( ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t ) ) : | ||
1141 | pFnc( pFnc ) { } | ||
1142 | virtual ~__Slot10F() { } | ||
1143 | |||
1144 | virtual ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7, p8t p8, p9t p9, p10t p10 ) | ||
1145 | { | ||
1146 | return (*pFnc)( p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 ); | ||
1147 | } | ||
1148 | |||
1149 | virtual _Slot10<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t> *clone() const | ||
1150 | { | ||
1151 | return new __Slot10F<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t>( pFnc ); | ||
1152 | } | ||
1153 | |||
1154 | private: | ||
1155 | ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t ); | ||
1156 | }; | ||
1157 | |||
1158 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t, typename p9t, typename p10t> | ||
1159 | class Signal10 | ||
1160 | { | ||
1161 | public: | ||
1162 | Signal10() : pCb( NULL ) { } | ||
1163 | Signal10( _Slot10<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t> *pCb ) : pCb( pCb ) { } | ||
1164 | Signal10( const Signal10<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t> &rSrc ) : | ||
1165 | pCb( (rSrc.pCb)?(rSrc.pCb->clone()):(NULL) ) { } | ||
1166 | virtual ~Signal10() { delete pCb; pCb = NULL; } | ||
1167 | |||
1168 | ret operator()( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5, p6t p6, p7t p7, p8t p8, p9t p9, p10t p10 ) | ||
1169 | { | ||
1170 | if( !pCb ) throw SignalException("Uninitialized signal called."); | ||
1171 | return (*pCb)( p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 ); | ||
1172 | } | ||
1173 | |||
1174 | bool isSet() const { return pCb != NULL; } | ||
1175 | operator bool() const { return isSet(); } | ||
1176 | |||
1177 | Signal10<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t> &operator=( const Signal10<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t> &rhs ) | ||
1178 | { | ||
1179 | pCb = rhs.pCb->clone(); | ||
1180 | return *this; | ||
1181 | } | ||
1182 | |||
1183 | private: | ||
1184 | _Slot10<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t> *pCb; | ||
1185 | }; | ||
1186 | |||
1187 | template<typename cls, typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t, typename p9t, typename p10t> | ||
1188 | Signal10<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t> slot( cls *pCls, ret (cls::*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t ) ) | ||
1189 | { | ||
1190 | if( !pCls || !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
1191 | return Signal10<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t>( | ||
1192 | new __Slot10<cls, ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t>( pCls, pFnc ) | ||
1193 | ); | ||
1194 | } | ||
1195 | |||
1196 | template<typename ret, typename p1t, typename p2t, typename p3t, typename p4t, typename p5t, typename p6t, typename p7t, typename p8t, typename p9t, typename p10t> | ||
1197 | Signal10<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t> slot( ret (*pFnc)( p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t ) ) | ||
1198 | { | ||
1199 | if( !pFnc ) throw SignalException("NULL pointer in slot()."); | ||
1200 | return Signal10<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t>( | ||
1201 | new __Slot10F<ret, p1t, p2t, p3t, p4t, p5t, p6t, p7t, p8t, p9t, p10t>( pFnc ) | ||
1202 | ); | ||
1203 | } | ||
1204 | #endif // BU_SIGNAL_PARAM_COUNT_10 | ||
1205 | |||
1206 | }; | ||
1207 | |||
1208 | #endif | ||