Library of Assembled Shared Sources
dispatcher_12.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_x.tmpl.h
5 * by param_expander.py on Tue Oct 7 01:22:01 2025.
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-2025 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
51
52#ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_IMPL_DISPATCHER_12_H
53#define LASS_GUARDIAN_OF_INCLUSION_UTIL_IMPL_DISPATCHER_12_H
54
57
58// --- NEW INTERFACES ----------------------------------------------------------
59
60namespace lass
61{
62namespace util
63{
64namespace impl
65{
66
67/** abstract base class of all dispatchers for lass::util::Callback12.
68 * @internal
69 * @sa Callback0
70 * @author Bram de Greve [Bramz]
71 */
72template
73<
74 typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12
75>
76class Dispatcher12: public TDispatcherAllocatorBase
77{
78public:
79
80 Dispatcher12() {}
81 virtual ~Dispatcher12() {}
82
83 void 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, typename util::CallTraits<P11>::TParam iP11, typename util::CallTraits<P12>::TParam iP12) const
84 {
85 doCall(iP1, iP2, iP3, iP4, iP5, iP6, iP7, iP8, iP9, iP10, iP11, iP12);
86 }
87 bool isEquivalent(const Dispatcher12<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>* iOther) const
88 {
89 return doIsEquivalent(iOther);
90 }
91
92private:
93
94 virtual void 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, typename util::CallTraits<P11>::TParam iP11, typename util::CallTraits<P12>::TParam iP12) const = 0;
95 virtual bool doIsEquivalent(const Dispatcher12<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>* iOther) const = 0;
96
97 Dispatcher12(const Dispatcher12<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>& iOther);
98 Dispatcher12& operator=(const Dispatcher12<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>& iOther);
99};
100
101
102
103/** Dispatcher for lass::util::Callback12 to a free function:
104 * @internal
105 * @sa Callback0
106 * @author Bram de Greve [Bramz]
107 */
108template
109<
110 typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12,
111 typename FunctionType,
112 typename Enable = void
113>
114class Dispatcher12Function: public Dispatcher12<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>
115{
116public:
117
118 typedef FunctionType TFunction;
119 typedef Dispatcher12Function<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, FunctionType, Enable> TSelf;
120
121 Dispatcher12Function(typename CallTraits<TFunction>::TParam iFunction):
122 function_(iFunction)
123 {
124 }
125
126 const TFunction& function() const
127 {
128 return function_;
129 }
130
131private:
132
133 void 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, typename util::CallTraits<P11>::TParam iP11, typename util::CallTraits<P12>::TParam iP12) const override
134 {
135 if (!function_)
136 {
137 return;
138 }
139 function_(iP1, iP2, iP3, iP4, iP5, iP6, iP7, iP8, iP9, iP10, iP11, iP12);
140 }
141
142 bool doIsEquivalent(const Dispatcher12<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>* other) const override
143 {
144 if constexpr (impl::IsEqualityComparable<TFunction>::value)
145 {
146 return other && typeid( *other ) == typeid( TSelf )
147 && static_cast<const TSelf*>(other)->function_ == function_;
148 }
149 else
150 {
151 return false;
152 }
153 }
154
155 TFunction function_;
156};
157
158
159
160#if !LASS_HAVE_LAMBDA_OPERATOR_NOT
161
162/** Dispatcher for lass::util::Callback12 to a callable that does not support operator!
163 * @internal
164 * @sa Callback0
165 * @author Bram de Greve [Bramz]
166 *
167 * With C++11, lambdas can also be used as callables. But the MSVC compiler did not support
168 * the unary ! operator. This was fixed in VS 2019 version 16.2.
169 * https://twitter.com/lunasorcery/status/1092870113374687232
170 */
171template
172<
173 typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12,
174 typename FunctionType
175>
176class Dispatcher12Function
177 <
178 P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12,
179 FunctionType,
180 typename meta::EnableIf<!HasOperatorNot<FunctionType>::value>::Type
181 >
182 : public Dispatcher12<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>
183{
184public:
185
186 Dispatcher12Function(typename CallTraits<FunctionType>::TParam iFunction):
187 function_(iFunction)
188 {
189 }
190
191 const TFunction& function() const
192 {
193 return function_;
194 }
195
196private:
197
198 void 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, typename util::CallTraits<P11>::TParam iP11, typename util::CallTraits<P12>::TParam iP12) const override
199 {
200 function_(iP1, iP2, iP3, iP4, iP5, iP6, iP7, iP8, iP9, iP10, iP11, iP12);
201 }
202
203 bool doIsEquivalent(const Dispatcher12<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>* /*iOther*/) const override
204 {
205 return false;
206 }
207
208 FunctionType function_;
209};
210
211#endif
212
213
214
215/** Dispatcher for lass::util::Callback12 to an object/method pair.
216 * @internal
217 * @sa Callback0
218 * @author Bram de Greve [Bramz]
219 */
220template
221<
222 typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12,
223 typename ObjectPtr, typename Method
224>
225class Dispatcher12Method: public Dispatcher12<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>
226{
227public:
228
229 typedef Dispatcher12Method<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, ObjectPtr, Method> TSelf;
230
231 Dispatcher12Method(typename CallTraits<ObjectPtr>::TParam iObject,
232 typename CallTraits<Method>::TParam iMethod):
233 object_(iObject),
234 method_(iMethod)
235 {
236 }
237
238private:
239
240 void 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, typename util::CallTraits<P11>::TParam iP11, typename util::CallTraits<P12>::TParam iP12) const override
241 {
242 if (!object_ || !method_)
243 {
244 return;
245 }
246 ((*object_).*method_)(iP1, iP2, iP3, iP4, iP5, iP6, iP7, iP8, iP9, iP10, iP11, iP12);
247 }
248
249 bool doIsEquivalent(const Dispatcher12<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>* iOther) const override
250 {
251 const TSelf* other = dynamic_cast<const TSelf*>(iOther);
252 return other && object_ == other->object_ && method_ == other->method_;
253 }
254
255 ObjectPtr object_;
256 Method method_;
257};
258
259
260
261}
262
263}
264
265}
266
267#endif // Guardian of Inclusion
268
269
270// EOF
library for template meta programming
Definition bool.h:76
general utility, debug facilities, ...
Library for Assembled Shared Sources.
Definition config.h:53