GCC Code Coverage Report


Directory: src/gate/
File: src/gate/delegates.hpp
Date: 2026-03-20 22:56:14
Exec Total Coverage
Lines: 249 271 91.9%
Functions: 292 462 63.2%
Branches: 141 300 47.0%

Line Branch Exec Source
1 /* GATE PROJECT LICENSE:
2 +----------------------------------------------------------------------------+
3 | Copyright (c) 2018-2026, Stefan Meislinger <sm@opengate.at> |
4 | All rights reserved. |
5 | |
6 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met:|
8 | |
9 | 1. Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. |
11 | 2. Redistributions in binary form must reproduce the above copyright |
12 | notice, this list of conditions and the following disclaimer in the |
13 | documentation and/or other materials provided with the distribution. |
14 | |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"|
16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
25 | THE POSSIBILITY OF SUCH DAMAGE. |
26 +----------------------------------------------------------------------------+
27 */
28
29 /** @file
30 * @brief Generic encapsulation of callbacks for functions and objects
31 * @ingroup gatecore_cpp
32 */
33
34 #ifndef GATE_DELEGATES_HPP_INCLUDED
35 #define GATE_DELEGATES_HPP_INCLUDED
36
37 #include "gate/gate_core_api.hpp"
38 #include "gate/gatetypes.hpp"
39 #include "gate/memalloc.hpp"
40 #include "gate/arrays.hpp"
41 #include "gate/typetraits.hpp"
42 #include "gate/debugging.h"
43
44 #include "gate/delegates.h"
45
46 namespace gate
47 {
48
49 typedef gate_delegate_t delegate_t;
50
51 typedef gate_va_list_carrier_t va_list_carrier_t;
52
53 namespace details
54 {
55 #if !defined(GATE_COMPILER_SUPPORTS_CPP_PARTIAL_TEMPLATE_SPECIALIZATION)
56
57 template<class T> struct VaArgGetter
58 {
59 static T get(va_list_carrier_t& args)
60 {
61 if (traits::IsReferenceType<T>::value)
62 {
63 void* ptr = va_arg(args.data, void*);
64 traits::RemoveReference<T>::type_t* ptr_arg = static_cast<traits::RemoveReference<T>::type_t*>(ptr);
65 return *ptr_arg;
66 }
67 else
68 {
69 if (sizeof(T) < sizeof(int))
70 {
71 int intref = va_arg(args.data, int);
72 traits::RemoveReference<T>::type_t* ptr_arg = reinterpret_cast<T*>(ptr);
73 return *ptr_arg;
74 }
75 else
76 {
77 T arg = va_arg(args.data, T);
78 return arg;
79 }
80 }
81 }
82 };
83
84 template<class T> struct VaArgBuilder
85 {
86 static T get(T value)
87 {
88 return value;
89 }
90 };
91
92 #else
93 template<class T, bool use_int, bool is_ref> struct VaArgGetterImpl;
94
95 template<class T> struct VaArgGetterImpl<T, true, false>
96 {
97 12 static T get(va_list_carrier_t& args)
98 {
99 12 int intref = va_arg(args.data, int);
100 12 return *reinterpret_cast<typename traits::RemoveReference<T>::type_t*>(&intref);
101 }
102 };
103
104 template<class T> struct VaArgGetterImpl<T, true, true>
105 {
106 3 static T get(va_list_carrier_t args)
107 {
108 3 T tref = *reinterpret_cast<typename traits::RemoveReference<T>::type_t*>(va_arg(args.data, int*));
109 3 return tref;
110 }
111 };
112
113 template<class T> struct VaArgGetterImpl<T, false, false>
114 {
115 546 static T get(va_list_carrier_t& args)
116 {
117 546 T tref = va_arg(args.data, T);
118 546 return tref;
119 }
120 };
121
122 template<class T> struct VaArgGetterImpl<T, false, true>
123 {
124 182 static T get(va_list_carrier_t& args)
125 {
126 182 T tref = *(va_arg(args.data, typename traits::RemoveReference<T>::type_t*));
127 182 return tref;
128 }
129 };
130
131 template<class T> struct VaArgGetter : public VaArgGetterImpl < T, sizeof(T) < sizeof(int), traits::IsReference<T>::value >
132 {
133 };
134
135 template<class T, bool is_ref> struct VaArgBuilderImpl;
136 template<class T> struct VaArgBuilderImpl<T, true>
137 {
138 191 static typename traits::RemoveReference<T>::type_t* get(T value)
139 {
140 191 return &value;
141 }
142 };
143 template<class T> struct VaArgBuilderImpl<T, false>
144 {
145 558 static T get(T value)
146 {
147 558 return value;
148 }
149 };
150
151 template<class T> struct VaArgBuilder : public VaArgBuilderImpl< T, traits::IsReference<T>::value >
152 {
153 };
154
155 #endif
156
157 } // end of namespace details
158
159
160 /// @brief
161 class GATE_CORE_CPP_API Delegate : public SafeBoolBase<Delegate>
162 {
163 protected:
164 delegate_t impl;
165
166 Delegate();
167 Delegate(gate_delegate_dispatcher_t dispatcher, void* obj_ptr, void* function_ptr, size_t function_ptr_size);
168
169 static result_t handle_exception();
170 void translate_result(result_t result) const;
171
172 835 template<class T> static T next_va_arg(va_list_carrier_t& args)
173 {
174 835 return details::VaArgGetter<T>::get(args);
175 }
176
177 public:
178 ~Delegate();
179 delegate_t const* c_impl() const;
180 bool operator!() const;
181 bool operator==(Delegate const& src) const;
182 bool operator!=(Delegate const& src) const;
183
184 };
185
186
187 /// @brief
188 /// @tparam RETTYPE
189 template<class RETTYPE>
190 class GATE_CORE_CPP_TEMPLATE_API TDelegate0 : public Delegate
191 {
192 protected:
193 template<class FUNC>
194 struct function_dispatcher
195 {
196 10 static gate_result_t GATE_CALL impl(gate_delegate_t const* delegate_ptr, gate_va_list_carrier_t* args)
197 {
198 10 FUNC& func = *gate::union_cast<FUNC*>(&delegate_ptr->function_storage);
199
1/2
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
10 ExceptionInfo xcptStatus;
200
5/12
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
12 GATEXX_TRY_CATCHINFO(xcptStatus, {
201 func();
202 });
203 10 return xcptStatus.result_code;
204 }
205 };
206
207 template<class O>
208 struct method_dispatcher
209 {
210 2 static gate_result_t GATE_CALL impl(gate_delegate_t const* delegate_ptr, gate_va_list_carrier_t* args)
211 {
212 typedef RETTYPE(O::* method_t)();
213 2 O* obj = static_cast<O*>(delegate_ptr->object_ptr);
214 2 method_t& method = *gate::union_cast<method_t*>(&delegate_ptr->function_storage);
215
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 ExceptionInfo xcptStatus;
216
3/10
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
2 GATEXX_TRY_CATCHINFO(xcptStatus, {
217 (obj->*method)();
218 });
219 2 return xcptStatus.result_code;
220 }
221 };
222
223 public:
224 1 TDelegate0()
225 1 {
226 1 }
227
228 15 template<class FUNC> TDelegate0(FUNC funcptr)
229 15 : Delegate(&function_dispatcher<FUNC>::impl, NULL, &funcptr, sizeof(funcptr))
230 {
231 15 }
232
233 3 template<class O> TDelegate0(O* obj_ptr, void(O::* method)())
234 3 : Delegate(&method_dispatcher<O>::impl, obj_ptr, &method, sizeof(method))
235 {
236 3 }
237
238 1 VoidResult tryInvoke() const
239 {
240
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 return makeResult(gate_delegate_invoke(this->c_impl()));
241 }
242 8 void invoke() const
243 {
244 8 this->translate_result(gate_delegate_invoke(this->c_impl()));
245 7 }
246 4 void operator()() const
247 {
248 4 this->invoke();
249 3 }
250 };
251 typedef TDelegate0<void> Delegate0;
252
253
254
255 /// @brief
256 /// @tparam A1
257 template<class A1>
258 class GATE_CORE_CPP_TEMPLATE_API Delegate1 : public Delegate
259 {
260 protected:
261 template<class FUNC>
262 struct function_dispatcher
263 {
264 19 static gate_result_t GATE_CALL impl(gate_delegate_t const* delegate_ptr, gate_va_list_carrier_t* args)
265 {
266 19 FUNC& func = *gate::union_cast<FUNC*>(&delegate_ptr->function_storage);
267
1/2
✓ Branch 1 taken 11 times.
✗ Branch 2 not taken.
19 ExceptionInfo xcptStatus;
268
6/10
✓ Branch 1 taken 11 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 2 times.
✓ Branch 7 taken 9 times.
✗ Branch 8 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 2 times.
✗ Branch 16 not taken.
23 GATEXX_TRY_CATCHINFO(xcptStatus, {
269 A1 arg1 = Delegate::next_va_arg<A1>(*args);
270 func(arg1);
271 });
272 19 return xcptStatus.result_code;
273 }
274 };
275
276 template<class O>
277 struct method_dispatcher
278 {
279 2 static gate_result_t GATE_CALL impl(gate_delegate_t const* delegate_ptr, gate_va_list_carrier_t* args)
280 {
281 typedef void(O::* method_t)(A1);
282 2 O* obj = static_cast<O*>(delegate_ptr->object_ptr);
283 2 method_t& method = *gate::union_cast<method_t*>(&delegate_ptr->function_storage);
284
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 ExceptionInfo xcptStatus;
285
4/12
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 2 times.
✗ Branch 10 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
2 GATEXX_TRY_CATCHINFO(xcptStatus, {
286 A1 arg1 = Delegate::next_va_arg<A1>(*args);
287 (obj->*method)(arg1);
288 });
289 2 return xcptStatus.result_code;
290 }
291 };
292
293 public:
294 Delegate1()
295 {
296 }
297
298 23 template<class FUNC> Delegate1(FUNC funcptr)
299 23 : Delegate(&function_dispatcher<FUNC>::impl, NULL, &funcptr, sizeof(funcptr))
300 {
301 23 }
302
303 3 template<class O> Delegate1(O* obj_ptr, void(O::* method)(A1))
304 3 : Delegate(&method_dispatcher<O>::impl, obj_ptr, &method, sizeof(method))
305 {
306 3 }
307
308 1 VoidResult tryInvoke(A1 arg1) const
309 {
310 2 return makeResult(gate_delegate_invoke(this->c_impl(),
311 details::VaArgBuilder<A1>::get(arg1)
312
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 ));
313 }
314 21 void invoke(A1 arg1) const
315 {
316 21 translate_result(gate_delegate_invoke(this->c_impl(),
317 details::VaArgBuilder<A1>::get(arg1)
318 ));
319 19 }
320 8 void operator()(A1 arg1) const
321 {
322 8 this->invoke(arg1);
323 6 }
324 };
325
326
327
328 /// @brief
329 /// @tparam A1
330 /// @tparam A2
331 template<class A1, class A2>
332 class GATE_CORE_CPP_TEMPLATE_API Delegate2 : public Delegate
333 {
334 protected:
335 template<class FUNC>
336 struct function_dispatcher
337 {
338 172 static gate_result_t GATE_CALL impl(gate_delegate_t const* delegate_ptr, gate_va_list_carrier_t* args)
339 {
340 172 FUNC& func = *gate::union_cast<FUNC*>(&delegate_ptr->function_storage);
341
1/2
✓ Branch 1 taken 86 times.
✗ Branch 2 not taken.
172 ExceptionInfo xcptStatus;
342
7/12
✓ Branch 1 taken 86 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 86 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 84 times.
✓ Branch 8 taken 2 times.
✓ Branch 10 taken 84 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 2 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 2 times.
✗ Branch 19 not taken.
176 GATEXX_TRY_CATCHINFO(xcptStatus, {
343 A1 arg1 = Delegate::next_va_arg<A1>(*args);
344 A2 arg2 = Delegate::next_va_arg<A2>(*args);
345 func(arg1, arg2);
346 });
347 172 return xcptStatus.result_code;
348 }
349 };
350
351 template<class O>
352 struct method_dispatcher
353 {
354 25 static gate_result_t GATE_CALL impl(gate_delegate_t const* delegate_ptr, gate_va_list_carrier_t* args)
355 {
356 typedef void(O::* method_t)(A1, A2);
357 25 O* obj = static_cast<O*>(delegate_ptr->object_ptr);
358 25 method_t& method = *gate::union_cast<method_t*>(&delegate_ptr->function_storage);
359
1/2
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
25 ExceptionInfo xcptStatus;
360
5/14
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 15 times.
✓ Branch 9 taken 15 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 15 times.
✗ Branch 13 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
25 GATEXX_TRY_CATCHINFO(xcptStatus, {
361 A1 arg1 = Delegate::next_va_arg<A1>(*args);
362 A2 arg2 = Delegate::next_va_arg<A2>(*args);
363 (obj->*method)(arg1, arg2);
364 });
365 25 return xcptStatus.result_code;
366 }
367 };
368
369 public:
370 Delegate2()
371 {
372 }
373
374 132 template<class FUNC> Delegate2(FUNC funcptr)
375 132 : Delegate(&function_dispatcher<FUNC>::impl, NULL, &funcptr, sizeof(funcptr))
376 {
377 132 }
378
379 24 template<class O> Delegate2(O* obj_ptr, void(O::* method)(A1, A2))
380 24 : Delegate(&method_dispatcher<O>::impl, obj_ptr, &method, sizeof(method))
381 {
382 24 }
383
384 1 VoidResult tryInvoke(A1 arg1, A2 arg2) const
385 {
386 2 return makeResult(gate_delegate_invoke(this->c_impl(),
387 details::VaArgBuilder<A1>::get(arg1),
388 details::VaArgBuilder<A2>::get(arg2)
389
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 ));
390 }
391 192 void invoke(A1 arg1, A2 arg2) const
392 {
393 192 translate_result(gate_delegate_invoke(&this->impl,
394 details::VaArgBuilder<A1>::get(arg1),
395 details::VaArgBuilder<A2>::get(arg2)
396 ));
397 190 }
398 20 void operator()(A1 arg1, A2 arg2) const
399 {
400 20 this->invoke(arg1, arg2);
401 18 }
402 };
403
404
405 /// @brief
406 /// @tparam A1
407 /// @tparam A2
408 /// @tparam A3
409 template<class A1, class A2, class A3>
410 class GATE_CORE_CPP_TEMPLATE_API Delegate3 : public Delegate
411 {
412 protected:
413 template<class FUNC>
414 struct function_dispatcher
415 {
416 66 static gate_result_t GATE_CALL impl(gate_delegate_t const* delegate_ptr, gate_va_list_carrier_t* args)
417 {
418 66 FUNC& func = *gate::union_cast<FUNC*>(&delegate_ptr->function_storage);
419
1/2
✓ Branch 1 taken 33 times.
✗ Branch 2 not taken.
66 ExceptionInfo xcptStatus;
420
8/14
✓ Branch 1 taken 33 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 33 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 33 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 31 times.
✓ Branch 11 taken 2 times.
✓ Branch 13 taken 31 times.
✗ Branch 14 not taken.
✓ Branch 18 taken 2 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 2 times.
✗ Branch 22 not taken.
70 GATEXX_TRY_CATCHINFO(xcptStatus, {
421 A1 arg1 = Delegate::next_va_arg<A1>(*args);
422 A2 arg2 = Delegate::next_va_arg<A2>(*args);
423 A3 arg3 = Delegate::next_va_arg<A3>(*args);
424 func(arg1, arg2, arg3);
425 });
426 66 return xcptStatus.result_code;
427 }
428 };
429
430 template<class O>
431 struct method_dispatcher
432 {
433 6 static gate_result_t GATE_CALL impl(gate_delegate_t const* delegate_ptr, gate_va_list_carrier_t* args)
434 {
435 typedef void(O::* method_t)(A1, A2, A3);
436 6 O* obj = static_cast<O*>(delegate_ptr->object_ptr);
437 6 method_t& method = *gate::union_cast<method_t*>(&delegate_ptr->function_storage);
438
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
6 ExceptionInfo xcptStatus;
439
6/16
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 4 times.
✓ Branch 12 taken 4 times.
✗ Branch 13 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
6 GATEXX_TRY_CATCHINFO(xcptStatus, {
440 A1 arg1 = Delegate::next_va_arg<A1>(*args);
441 A2 arg2 = Delegate::next_va_arg<A2>(*args);
442 A3 arg3 = Delegate::next_va_arg<A3>(*args);
443 (obj->*method)(arg1, arg2, arg3);
444 });
445 6 return xcptStatus.result_code;
446 }
447 };
448
449 public:
450 Delegate3()
451 {
452 }
453
454 10 template<class FUNC> Delegate3(FUNC funcptr)
455 10 : Delegate(&function_dispatcher<FUNC>::impl, NULL, &funcptr, sizeof(funcptr))
456 {
457 10 }
458
459 8 template<class O> Delegate3(O* obj_ptr, void(O::* method)(A1, A2, A3))
460 8 : Delegate(&method_dispatcher<O>::impl, obj_ptr, &method, sizeof(method))
461 {
462 8 }
463
464 1 VoidResult tryInvoke(A1 arg1, A2 arg2, A3 arg3) const
465 {
466 2 return makeResult(gate_delegate_invoke(this->c_impl(),
467 details::VaArgBuilder<A1>::get(arg1),
468 details::VaArgBuilder<A2>::get(arg2),
469 details::VaArgBuilder<A3>::get(arg3)
470
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 ));
471 }
472 72 void invoke(A1 arg1, A2 arg2, A3 arg3) const
473 {
474 72 translate_result(gate_delegate_invoke(&this->impl,
475 details::VaArgBuilder<A1>::get(arg1),
476 details::VaArgBuilder<A2>::get(arg2),
477 details::VaArgBuilder<A3>::get(arg3)
478 ));
479 70 }
480 14 void operator()(A1 arg1, A2 arg2, A3 arg3) const
481 {
482 14 this->invoke(arg1, arg2, arg3);
483 12 }
484 };
485
486
487 /// @brief
488 /// @tparam A1
489 /// @tparam A2
490 /// @tparam A3
491 /// @tparam A4
492 template<class A1, class A2, class A3, class A4>
493 class GATE_CORE_CPP_TEMPLATE_API Delegate4 : public Delegate
494 {
495 protected:
496 template<class FUNC>
497 struct function_dispatcher
498 {
499 6 static gate_result_t GATE_CALL impl(gate_delegate_t const* delegate_ptr, gate_va_list_carrier_t* args)
500 {
501 6 FUNC& func = *gate::union_cast<FUNC*>(&delegate_ptr->function_storage);
502
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
6 ExceptionInfo xcptStatus;
503
9/16
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✓ Branch 14 taken 2 times.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 21 taken 2 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 2 times.
✗ Branch 25 not taken.
10 GATEXX_TRY_CATCHINFO(xcptStatus, {
504 A1 arg1 = Delegate::next_va_arg<A1>(*args);
505 A2 arg2 = Delegate::next_va_arg<A2>(*args);
506 A3 arg3 = Delegate::next_va_arg<A3>(*args);
507 A4 arg4 = Delegate::next_va_arg<A4>(*args);
508 func(arg1, arg2, arg3, arg4);
509 });
510 6 return xcptStatus.result_code;
511 }
512 };
513 template<class O>
514 struct method_dispatcher
515 {
516 2 static gate_result_t GATE_CALL impl(gate_delegate_t const* delegate_ptr, gate_va_list_carrier_t* args)
517 {
518 typedef void(O::* method_t)(A1, A2, A3, A4);
519 2 O* obj = static_cast<O*>(delegate_ptr->object_ptr);
520 2 method_t& method = *gate::union_cast<method_t*>(&delegate_ptr->function_storage);
521
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 ExceptionInfo xcptStatus;
522
7/18
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
✓ Branch 15 taken 2 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 2 times.
✗ Branch 19 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 GATEXX_TRY_CATCHINFO(xcptStatus, {
523 A1 arg1 = Delegate::next_va_arg<A1>(*args);
524 A2 arg2 = Delegate::next_va_arg<A2>(*args);
525 A3 arg3 = Delegate::next_va_arg<A3>(*args);
526 A4 arg4 = Delegate::next_va_arg<A4>(*args);
527 (obj->*method)(arg1, arg2, arg3, arg4);
528 });
529 2 return xcptStatus.result_code;
530 }
531 };
532
533 public:
534 Delegate4()
535 {
536 }
537
538 4 template<class FUNC> Delegate4(FUNC funcptr)
539 4 : Delegate(&function_dispatcher<FUNC>::impl, NULL, &funcptr, sizeof(funcptr))
540 {
541 4 }
542
543 2 template<class O> Delegate4(O* obj_ptr, void(O::* method)(A1, A2, A3, A4))
544 2 : Delegate(&method_dispatcher<O>::impl, obj_ptr, &method, sizeof(method))
545 {
546 2 }
547
548 1 VoidResult tryInvoke(A1 arg1, A2 arg2, A3 arg3, A4 arg4) const
549 {
550 2 return makeResult(gate_delegate_invoke(this->c_impl(),
551 details::VaArgBuilder<A1>::get(arg1),
552 details::VaArgBuilder<A2>::get(arg2),
553 details::VaArgBuilder<A3>::get(arg3),
554 details::VaArgBuilder<A4>::get(arg4)
555
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 ));
556 }
557 8 void invoke(A1 arg1, A2 arg2, A3 arg3, A4 arg4) const
558 {
559 8 translate_result(gate_delegate_invoke(&this->impl,
560 details::VaArgBuilder<A1>::get(arg1),
561 details::VaArgBuilder<A2>::get(arg2),
562 details::VaArgBuilder<A3>::get(arg3),
563 details::VaArgBuilder<A4>::get(arg4)
564 ));
565 6 }
566 8 void operator()(A1 arg1, A2 arg2, A3 arg3, A4 arg4) const
567 {
568 8 this->invoke(arg1, arg2, arg3, arg4);
569 6 }
570 };
571
572
573 /// @brief
574 /// @tparam A1
575 /// @tparam A2
576 /// @tparam A3
577 /// @tparam A4
578 /// @tparam A5
579 template<class A1, class A2, class A3, class A4, class A5>
580 class GATE_CORE_CPP_TEMPLATE_API Delegate5 : public Delegate
581 {
582 protected:
583 template<class FUNC>
584 struct function_dispatcher
585 {
586 6 static gate_result_t GATE_CALL impl(gate_delegate_t const* delegate_ptr, gate_va_list_carrier_t* args)
587 {
588 6 FUNC& func = *gate::union_cast<FUNC*>(&delegate_ptr->function_storage);
589
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
6 ExceptionInfo xcptStatus;
590
10/18
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 3 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✓ Branch 17 taken 2 times.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 24 taken 2 times.
✗ Branch 25 not taken.
✓ Branch 27 taken 2 times.
✗ Branch 28 not taken.
10 GATEXX_TRY_CATCHINFO(xcptStatus, {
591 A1 arg1 = Delegate::next_va_arg<A1>(*args);
592 A2 arg2 = Delegate::next_va_arg<A2>(*args);
593 A3 arg3 = Delegate::next_va_arg<A3>(*args);
594 A4 arg4 = Delegate::next_va_arg<A4>(*args);
595 A5 arg5 = Delegate::next_va_arg<A5>(*args);
596 func(arg1, arg2, arg3, arg4, arg5);
597 });
598 6 return xcptStatus.result_code;
599 }
600 };
601
602 template<class O>
603 struct method_dispatcher
604 {
605 2 static gate_result_t GATE_CALL impl(gate_delegate_t const* delegate_ptr, gate_va_list_carrier_t* args)
606 {
607 typedef void(O::* method_t)(A1, A2, A3, A4, A5);
608 2 O* obj = static_cast<O*>(delegate_ptr->object_ptr);
609 2 method_t& method = *gate::union_cast<method_t*>(&delegate_ptr->function_storage);
610
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 ExceptionInfo xcptStatus;
611
8/20
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 2 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 2 times.
✓ Branch 18 taken 2 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 2 times.
✗ Branch 22 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 GATEXX_TRY_CATCHINFO(xcptStatus, {
612 A1 arg1 = Delegate::next_va_arg<A1>(*args);
613 A2 arg2 = Delegate::next_va_arg<A2>(*args);
614 A3 arg3 = Delegate::next_va_arg<A3>(*args);
615 A4 arg4 = Delegate::next_va_arg<A4>(*args);
616 A5 arg5 = Delegate::next_va_arg<A5>(*args);
617 (obj->*method)(arg1, arg2, arg3, arg4, arg5);
618 });
619 2 return xcptStatus.result_code;
620 }
621 };
622
623 public:
624 Delegate5()
625 {
626 }
627
628 4 template<class FUNC> Delegate5(FUNC funcptr)
629 4 : Delegate(&function_dispatcher<FUNC>::impl, NULL, &funcptr, sizeof(funcptr))
630 {
631 4 }
632
633 2 template<class O> Delegate5(O* obj_ptr, void(O::* method)(A1, A2, A3, A4, A5))
634 2 : Delegate(&method_dispatcher<O>::impl, obj_ptr, &method, sizeof(method))
635 {
636 2 }
637
638 1 VoidResult tryInvoke(A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5) const
639 {
640 2 return makeResult(gate_delegate_invoke(this->c_impl(),
641 details::VaArgBuilder<A1>::get(arg1),
642 details::VaArgBuilder<A2>::get(arg2),
643 details::VaArgBuilder<A3>::get(arg3),
644 details::VaArgBuilder<A4>::get(arg4),
645 details::VaArgBuilder<A5>::get(arg5)
646
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 ));
647 }
648 8 void invoke(A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5) const
649 {
650 8 translate_result(gate_delegate_invoke(&this->impl,
651 details::VaArgBuilder<A1>::get(arg1),
652 details::VaArgBuilder<A2>::get(arg2),
653 details::VaArgBuilder<A3>::get(arg3),
654 details::VaArgBuilder<A4>::get(arg4),
655 details::VaArgBuilder<A5>::get(arg5)
656 ));
657 6 }
658 8 void operator()(A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5) const
659 {
660 8 this->invoke(arg1, arg2, arg3, arg4, arg5);
661 6 }
662 };
663
664
665
666 /// @brief
667 /// @tparam A1
668 /// @tparam A2
669 /// @tparam A3
670 /// @tparam A4
671 /// @tparam A5
672 /// @tparam A6
673 template<class A1, class A2, class A3, class A4, class A5, class A6>
674 class GATE_CORE_CPP_TEMPLATE_API Delegate6 : public Delegate
675 {
676 protected:
677 template<class FUNC>
678 struct function_dispatcher
679 {
680 12 static gate_result_t GATE_CALL impl(gate_delegate_t const* delegate_ptr, gate_va_list_carrier_t* args)
681 {
682 12 FUNC& func = *gate::union_cast<FUNC*>(&delegate_ptr->function_storage);
683
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
12 ExceptionInfo xcptStatus;
684
11/20
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 6 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 6 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✓ Branch 20 taken 2 times.
✓ Branch 22 taken 4 times.
✗ Branch 23 not taken.
✓ Branch 27 taken 2 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 2 times.
✗ Branch 31 not taken.
16 GATEXX_TRY_CATCHINFO(xcptStatus, {
685 A1 arg1 = Delegate::next_va_arg<A1>(*args);
686 A2 arg2 = Delegate::next_va_arg<A2>(*args);
687 A3 arg3 = Delegate::next_va_arg<A3>(*args);
688 A4 arg4 = Delegate::next_va_arg<A4>(*args);
689 A5 arg5 = Delegate::next_va_arg<A5>(*args);
690 A6 arg6 = Delegate::next_va_arg<A6>(*args);
691 func(arg1, arg2, arg3, arg4, arg5, arg6);
692 });
693 12 return xcptStatus.result_code;
694 }
695 };
696
697 template<class O>
698 struct method_dispatcher
699 {
700 2 static gate_result_t GATE_CALL impl(gate_delegate_t const* delegate_ptr, gate_va_list_carrier_t* args)
701 {
702 typedef void(O::* method_t)(A1, A2, A3, A4, A5, A6);
703 2 O* obj = static_cast<O*>(delegate_ptr->object_ptr);
704 2 method_t& method = *gate::union_cast<method_t*>(&delegate_ptr->function_storage);
705
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 ExceptionInfo xcptStatus;
706
9/22
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 2 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 2 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 2 times.
✓ Branch 21 taken 2 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 2 times.
✗ Branch 25 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
2 GATEXX_TRY_CATCHINFO(xcptStatus, {
707 A1 arg1 = Delegate::next_va_arg<A1>(*args);
708 A2 arg2 = Delegate::next_va_arg<A2>(*args);
709 A3 arg3 = Delegate::next_va_arg<A3>(*args);
710 A4 arg4 = Delegate::next_va_arg<A4>(*args);
711 A5 arg5 = Delegate::next_va_arg<A5>(*args);
712 A6 arg6 = Delegate::next_va_arg<A6>(*args);
713 (obj->*method)(arg1, arg2, arg3, arg4, arg5, arg6);
714 });
715 2 return xcptStatus.result_code;
716 }
717 };
718
719 public:
720 Delegate6()
721 {
722 }
723
724 8 template<class FUNC> Delegate6(FUNC funcptr)
725 8 : Delegate(&function_dispatcher<FUNC>::impl, NULL, &funcptr, sizeof(funcptr))
726 {
727 8 }
728
729 2 template<class O> Delegate6(O* obj_ptr, void(O::* method)(A1, A2, A3, A4, A5, A6))
730 2 : Delegate(&method_dispatcher<O>::impl, obj_ptr, &method, sizeof(method))
731 {
732 2 }
733
734 1 VoidResult tryInvoke(A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5, A6 arg6) const
735 {
736 2 return makeResult(gate_delegate_invoke(this->c_impl(),
737 details::VaArgBuilder<A1>::get(arg1),
738 details::VaArgBuilder<A2>::get(arg2),
739 details::VaArgBuilder<A3>::get(arg3),
740 details::VaArgBuilder<A4>::get(arg4),
741 details::VaArgBuilder<A5>::get(arg5),
742 details::VaArgBuilder<A6>::get(arg6)
743
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 ));
744 }
745 14 void invoke(A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5, A6 arg6) const
746 {
747 20 translate_result(gate_delegate_invoke(&this->impl,
748 details::VaArgBuilder<A1>::get(arg1),
749 6 details::VaArgBuilder<A2>::get(arg2),
750 6 details::VaArgBuilder<A3>::get(arg3),
751 details::VaArgBuilder<A4>::get(arg4),
752 details::VaArgBuilder<A5>::get(arg5),
753 details::VaArgBuilder<A6>::get(arg6)
754 ));
755 12 }
756 14 void operator()(A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5, A6 arg6) const
757 {
758 14 this->invoke(arg1, arg2, arg3, arg4, arg5, arg6);
759 12 }
760 };
761
762
763
764
765 /// @brief
766 class GATE_CORE_CPP_API MulticastDelegateBase
767 {
768 protected:
769
770 35 template<class T> static void addSlot(SlotList<T>& lst, T const& item)
771 {
772 35 lst.add(item);
773 35 }
774 1 template<class T> static bool_t removeSlot(SlotList<T>& lst, T const& item)
775 {
776
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 for (typename SlotList<T>::iterator it(lst.begin()), itend(lst.end()); it != itend; ++it)
777 {
778
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 if ((*it) == item)
779 {
780
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 lst.remove(it);
781 1 return true;
782 }
783 }
784 return false;
785 }
786 template<class T> static void clearSlots(SlotList<T>& lst)
787 {
788 lst.clear();
789 }
790
791 };
792
793
794
795 /// @brief
796 class GATE_CORE_CPP_API MulticastDelegate0 : protected MulticastDelegateBase
797 {
798 public:
799 typedef MulticastDelegate0 self_t;
800 typedef Delegate0 delegator_t;
801 typedef SlotList<delegator_t> list_t;
802
803 private:
804 list_t impl;
805
806 public:
807 void invoke() const;
808 void operator()() const;
809
810 void clear();
811 self_t& operator+=(delegator_t const& del);
812 self_t& operator-=(delegator_t const& del);
813 };
814
815
816
817 /// @brief
818 /// @tparam A1
819 template<class A1>
820 class GATE_CORE_CPP_TEMPLATE_API MulticastDelegate1 : protected MulticastDelegateBase
821 {
822 public:
823 typedef MulticastDelegate1<A1> self_t;
824 typedef Delegate1<A1> delegator_t;
825 typedef SlotList<delegator_t> list_t;
826
827 private:
828 list_t impl;
829
830 public:
831 1 void invoke(A1 a1) const
832 {
833
2/2
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
2 for (typename list_t::const_iterator it(this->impl.begin()), itend(this->impl.end()); it != itend; ++it)
834 {
835
1/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 GATEXX_TRY_IGNORE({
836 (*it)(a1);
837 })
838 }
839 1 }
840 1 void operator()(A1 a1) const { this->invoke(a1); }
841
842 void clear() { clearSlots(this->impl); }
843 1 self_t& operator+=(delegator_t const& del) { addSlot(this->impl, del); return *this; }
844 self_t& operator-=(delegator_t const& del) { removeSlot(this->impl, del); return *this; }
845 };
846
847
848
849 /// @brief
850 /// @tparam A1
851 /// @tparam A2
852 template<class A1, class A2>
853 class GATE_CORE_CPP_TEMPLATE_API MulticastDelegate2 : protected MulticastDelegateBase
854 {
855 public:
856 typedef MulticastDelegate2<A1, A2> self_t;
857 typedef Delegate2<A1, A2> delegator_t;
858 typedef SlotList<delegator_t> list_t;
859
860 private:
861 list_t impl;
862
863 public:
864 15 void invoke(A1 a1, A2 a2) const
865 {
866
2/2
✓ Branch 3 taken 11 times.
✓ Branch 4 taken 13 times.
28 for (typename list_t::const_iterator it(this->impl.begin()), itend(this->impl.end()); it != itend; ++it)
867 {
868
1/4
✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
13 GATEXX_TRY_IGNORE({
869 (*it)(a1, a2);
870 });
871 }
872 15 }
873 1 void operator()(A1 a1, A2 a2) const { this->invoke(a1, a2); }
874
875 void clear() { clearSlots(this->impl); }
876 21 self_t& operator+=(delegator_t const& del) { addSlot(this->impl, del); return *this; }
877 self_t& operator-=(delegator_t const& del) { removeSlot(this->impl, del); return *this; }
878 };
879
880
881 /// @brief
882 /// @tparam A1
883 /// @tparam A2
884 /// @tparam A3
885 template<class A1, class A2, class A3>
886 class GATE_CORE_CPP_TEMPLATE_API MulticastDelegate3 : protected MulticastDelegateBase
887 {
888 public:
889 typedef MulticastDelegate3<A1, A2, A3> self_t;
890 typedef Delegate3<A1, A2, A3> delegator_t;
891 typedef SlotList<delegator_t> list_t;
892
893 private:
894 list_t impl;
895
896 public:
897 1 void invoke(A1 a1, A2 a2, A3 a3) const
898 {
899
2/2
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
2 for (typename list_t::const_iterator it(this->impl.begin()), itend(this->impl.end()); it != itend; ++it)
900 {
901
1/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 GATEXX_TRY_IGNORE({
902 (*it)(a1, a2, a3);
903 });
904 }
905 1 }
906 1 void operator()(A1 a1, A2 a2, A3 a3) const { this->invoke(a1, a2, a3); }
907
908 void clear() { clearSlots(this->impl); }
909 1 self_t& operator+=(delegator_t const& del) { addSlot(this->impl, del); return *this; }
910 self_t& operator-=(delegator_t const& del) { removeSlot(this->impl, del); return *this; }
911 };
912
913
914 /// @brief
915 /// @tparam A1
916 /// @tparam A2
917 /// @tparam A3
918 /// @tparam A4
919 template<class A1, class A2, class A3, class A4>
920 class GATE_CORE_CPP_TEMPLATE_API MulticastDelegate4 : protected MulticastDelegateBase
921 {
922 public:
923 typedef MulticastDelegate4<A1, A2, A3, A4> self_t;
924 typedef Delegate4<A1, A2, A3, A4> delegator_t;
925 typedef SlotList<delegator_t> list_t;
926
927 private:
928 list_t impl;
929
930 public:
931 1 void invoke(A1 a1, A2 a2, A3 a3, A4 a4) const
932 {
933
2/2
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
2 for (typename list_t::const_iterator it(this->impl.begin()), itend(this->impl.end()); it != itend; ++it)
934 {
935
1/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 GATEXX_TRY_IGNORE({
936 (*it)(a1, a2, a3, a4);
937 });
938 }
939 1 }
940 1 void operator()(A1 a1, A2 a2, A3 a3, A4 a4) const { this->invoke(a1, a2, a3, a4); }
941
942 void clear() { clearSlots(this->impl); }
943 1 self_t& operator+=(delegator_t const& del) { addSlot(this->impl, del); return *this; }
944 self_t& operator-=(delegator_t const& del) { removeSlot(this->impl, del); return *this; }
945 };
946
947
948 /// @brief
949 /// @tparam A1
950 /// @tparam A2
951 /// @tparam A3
952 /// @tparam A4
953 /// @tparam A5
954 template<class A1, class A2, class A3, class A4, class A5>
955 class GATE_CORE_CPP_TEMPLATE_API MulticastDelegate5 : protected MulticastDelegateBase
956 {
957 public:
958 typedef MulticastDelegate5<A1, A2, A3, A4, A5> self_t;
959 typedef Delegate5<A1, A2, A3, A4, A5> delegator_t;
960 typedef SlotList<delegator_t> list_t;
961
962 private:
963 list_t impl;
964
965 public:
966 1 void invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
967 {
968
2/2
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
2 for (typename list_t::const_iterator it(this->impl.begin()), itend(this->impl.end()); it != itend; ++it)
969 {
970
1/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 GATEXX_TRY_IGNORE({
971 (*it)(a1, a2, a3, a4, a5);
972 });
973 }
974 1 }
975 1 void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const { this->invoke(a1, a2, a3, a4, a5); }
976
977 void clear() { clearSlots(this->impl); }
978 1 self_t& operator+=(delegator_t const& del) { addSlot(this->impl, del); return *this; }
979 self_t& operator-=(delegator_t const& del) { removeSlot(this->impl, del); return *this; }
980 };
981
982
983 /// @brief
984 /// @tparam A1
985 /// @tparam A2
986 /// @tparam A3
987 /// @tparam A4
988 /// @tparam A5
989 /// @tparam A6
990 template<class A1, class A2, class A3, class A4, class A5, class A6>
991 class GATE_CORE_CPP_TEMPLATE_API MulticastDelegate6 : protected MulticastDelegateBase
992 {
993 public:
994 typedef MulticastDelegate6<A1, A2, A3, A4, A5, A6> self_t;
995 typedef Delegate6<A1, A2, A3, A4, A5, A6> delegator_t;
996 typedef SlotList<delegator_t> list_t;
997
998 private:
999 list_t impl;
1000
1001 public:
1002 4 void invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
1003 {
1004
2/2
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
8 for (typename list_t::const_iterator it(this->impl.begin()), itend(this->impl.end()); it != itend; ++it)
1005 {
1006
1/4
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
4 GATEXX_TRY_IGNORE({
1007 (*it)(a1, a2, a3, a4, a5, a6);
1008 });
1009 }
1010 4 }
1011 4 void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const { this->invoke(a1, a2, a3, a4, a5, a6); }
1012
1013 void clear() { clearSlots(this->impl); }
1014 4 self_t& operator+=(delegator_t const& del) { addSlot(this->impl, del); return *this; }
1015 1 self_t& operator-=(delegator_t const& del) { removeSlot(this->impl, del); return *this; }
1016 };
1017
1018
1019
1020 } // end of namespace gate
1021
1022 #endif
1023