Library of Assembled Shared Sources
 
Loading...
Searching...
No Matches
dispatcher_r_10.h
Go to the documentation of this file.
1/*
2 * *** ATTENTION! DO NOT MODIFY THIS FILE DIRECTLY! ***
3 *
4 * It has automatically been generated from dispatcher_r_x.tmpl.h
5 * by param_expander.py on Fri Aug 14 16:06:11 2026.
6 */
7
8/** @file
9 * @author Bram de Greve (bram@cocamware.com)
10 * @author Tom De Muer (tom@cocamware.com)
11 *
12 * *** BEGIN LICENSE INFORMATION ***
13 *
14 * The contents of this file are subject to the Common Public Attribution License
15 * Version 1.0 (the "License"); you may not use this file except in compliance with
16 * the License. You may obtain a copy of the License at
17 * http://lass.sourceforge.net/cpal-license. The License is based on the
18 * Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover
19 * use of software over a computer network and provide for limited attribution for
20 * the Original Developer. In addition, Exhibit A has been modified to be consistent
21 * with Exhibit B.
22 *
23 * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
24 * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
25 * language governing rights and limitations under the License.
26 *
27 * The Original Code is LASS - Library of Assembled Shared Sources.
28 *
29 * The Initial Developer of the Original Code is Bram de Greve and Tom De Muer.
30 * The Original Developer is the Initial Developer.
31 *
32 * All portions of the code written by the Initial Developer are:
33 * Copyright (C) 2004-2026 the Initial Developer.
34 * All Rights Reserved.
35 *
36 * Contributor(s):
37 *
38 * Alternatively, the contents of this file may be used under the terms of the
39 * GNU General Public License Version 2 or later (the GPL), in which case the
40 * provisions of GPL are applicable instead of those above. If you wish to allow use
41 * of your version of this file only under the terms of the GPL and not to allow
42 * others to use your version of this file under the CPAL, indicate your decision by
43 * deleting the provisions above and replace them with the notice and other
44 * provisions required by the GPL License. If you do not delete the provisions above,
45 * a recipient may use your version of this file under either the CPAL or the GPL.
46 *
47 * *** END LICENSE INFORMATION ***
48 */
49
50#ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_IMPL_DISPATCHER_R_10_H
51#define LASS_GUARDIAN_OF_INCLUSION_UTIL_IMPL_DISPATCHER_R_10_H
52
54#include "../callback_common.h"
55
56// --- NEW INTERFACES ----------------------------------------------------------
57
58namespace lass
59{
60namespace util
61{
62namespace impl
63{
64
65/** abstract base class of all dispatchers for lass::util::CallbackR10.
66 * @internal
67 * @sa CallbackR10
68 * @author Bram de Greve [Bramz]
69 */
70template
71<
72 typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10
73>
74class DispatcherR10: public TDispatcherAllocatorBase
75{
76public:
77
78 DispatcherR10() {}
79 virtual ~DispatcherR10() {}
80
81 R call(typename util::CallTraits<P1>::TParam iP1, typename util::CallTraits<P2>::TParam iP2, typename util::CallTraits<P3>::TParam iP3, typename util::CallTraits<P4>::TParam iP4, typename util::CallTraits<P5>::TParam iP5, typename util::CallTraits<P6>::TParam iP6, typename util::CallTraits<P7>::TParam iP7, typename util::CallTraits<P8>::TParam iP8, typename util::CallTraits<P9>::TParam iP9, typename util::CallTraits<P10>::TParam iP10) const
82 {
83 return doCall(iP1, iP2, iP3, iP4, iP5, iP6, iP7, iP8, iP9, iP10);
84 }
85 bool isEquivalent(const DispatcherR10<R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>* iOther) const
86 {
87 return doIsEquivalent(iOther);
88 }
89
90private:
91
92 virtual R doCall(typename util::CallTraits<P1>::TParam iP1, typename util::CallTraits<P2>::TParam iP2, typename util::CallTraits<P3>::TParam iP3, typename util::CallTraits<P4>::TParam iP4, typename util::CallTraits<P5>::TParam iP5, typename util::CallTraits<P6>::TParam iP6, typename util::CallTraits<P7>::TParam iP7, typename util::CallTraits<P8>::TParam iP8, typename util::CallTraits<P9>::TParam iP9, typename util::CallTraits<P10>::TParam iP10) const = 0;
93 virtual bool doIsEquivalent(const DispatcherR10<R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>* iOther) const = 0;
94
95 DispatcherR10(const DispatcherR10<R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>& iOther);
96 DispatcherR10& operator=(const DispatcherR10<R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>& iOther);
97};
98
99
100
101/** Dispatcher for lass::util::CallbackR10 to a function or equivalent callable entinty.
102 * @internal
103 * @sa CallbackR10
104 * @author Bram de Greve [Bramz]
105 */
106template
107<
108 typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10,
109 typename FunctionType,
110 typename Enable = void
111>
112class DispatcherR10Function: public DispatcherR10<R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>
113{
114public:
115
116 typedef FunctionType TFunction;
117 typedef DispatcherR10Function<R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, FunctionType, Enable> TSelf;
118
119 DispatcherR10Function(typename CallTraits<TFunction>::TParam iFunction):
120 function_(iFunction)
121 {
122 }
123
124 const TFunction& function() const
125 {
126 return function_;
127 }
128
129private:
130
131 R doCall(typename util::CallTraits<P1>::TParam iP1, typename util::CallTraits<P2>::TParam iP2, typename util::CallTraits<P3>::TParam iP3, typename util::CallTraits<P4>::TParam iP4, typename util::CallTraits<P5>::TParam iP5, typename util::CallTraits<P6>::TParam iP6, typename util::CallTraits<P7>::TParam iP7, typename util::CallTraits<P8>::TParam iP8, typename util::CallTraits<P9>::TParam iP9, typename util::CallTraits<P10>::TParam iP10) const override
132 {
133 if (!function_)
134 {
135 LASS_THROW_EX(EmptyCallback, "You've tried to call an empty CallbackR0. Can't return a value.");
136 }
137 return function_(iP1, iP2, iP3, iP4, iP5, iP6, iP7, iP8, iP9, iP10);
138 }
139
140 bool doIsEquivalent(const DispatcherR10<R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>* other) const override
141 {
142 if constexpr (impl::IsEqualityComparable<TFunction>::value)
143 {
144 return other && typeid( *other ) == typeid( TSelf )
145 && static_cast<const TSelf*>(other)->function_ == function_;
146 }
147 else
148 {
149 return false;
150 }
151 }
152
153 TFunction function_;
154};
155
156
157
158/** Dispatcher for lass::util::CallbackR10 to an object/method pair.
159 * @internal
160 * @sa CallbackR10
161 * @author Bram de Greve [Bramz]
162 */
163template
164<
165 typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10,
166 typename ObjectPtr, typename Method
167>
168class DispatcherR10Method: public DispatcherR10<R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>
169{
170public:
171
172 typedef DispatcherR10Method<R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, ObjectPtr, Method> TSelf;
173
174 DispatcherR10Method(typename CallTraits<ObjectPtr>::TParam iObject,
175 typename CallTraits<Method>::TParam iMethod):
176 object_(iObject),
177 method_(iMethod)
178 {
179 }
180
181private:
182
183 R doCall(typename util::CallTraits<P1>::TParam iP1, typename util::CallTraits<P2>::TParam iP2, typename util::CallTraits<P3>::TParam iP3, typename util::CallTraits<P4>::TParam iP4, typename util::CallTraits<P5>::TParam iP5, typename util::CallTraits<P6>::TParam iP6, typename util::CallTraits<P7>::TParam iP7, typename util::CallTraits<P8>::TParam iP8, typename util::CallTraits<P9>::TParam iP9, typename util::CallTraits<P10>::TParam iP10) const override
184 {
185 if (!object_ || !method_)
186 {
187 LASS_THROW_EX(EmptyCallback, "You've tried to call an empty CallbackR0. Can't return a value.");
188 }
189 return ((*object_).*method_)(iP1, iP2, iP3, iP4, iP5, iP6, iP7, iP8, iP9, iP10);
190 }
191
192 bool doIsEquivalent(const DispatcherR10<R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>* iOther) const override
193 {
194 const TSelf* other = dynamic_cast<const TSelf*>(iOther);
195 return other && object_ == other->object_ && method_ == other->method_;
196 }
197
198 ObjectPtr object_;
199 Method method_;
200};
201
202
203
204}
205
206}
207
208}
209
210#endif // Guardian of Inclusion
211
212
213// EOF
general utility, debug facilities, ...
Library for Assembled Shared Sources.
Definition config.h:53