Library of Assembled Shared Sources
callback_14.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 callback_x.tmpl.h
5 * by param_expander.py on Tue Oct 7 01:22:00 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/** @class lass::util::Callback14
53 * @ingroup Callback
54 * @brief callback with 14 parameter(s) but without returnvalue.
55 * @date 2002
56 * @author Bram de Greve [Bramz] (contact: bram@cocamware.com)
57 *
58 * It's a single object that can hold a reference to a free function or an
59 * object/(const) method pair. Once the callback is constructed, it works
60 * completely transparent. All it shows to the client is a function that
61 * takes one parameter but gives no returnvalue.
62 */
63
64
65
66#ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_CALLBACK_14_H
67#define LASS_GUARDIAN_OF_INCLUSION_UTIL_CALLBACK_14_H
68
69
70
71// --- OLD INTERFACES ----------------------------------------------------------
72
73#include "util_common.h"
74#include "shared_ptr.h"
75#include "impl/dispatcher_14.h"
76#include "callback_common.h"
77
78
79
80
81// --- NEW INTERFACES ----------------------------------------------------------
82
83namespace lass
84{
85namespace util
86{
87
88
89// THE CALLBACK:
90// This is the actuall class you use to hold callbacks:
91
92template
93<
94 typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12, typename P13, typename P14
95>
97{
98public:
99
101 typedef SharedPtr< impl::Dispatcher14<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14> > TDispatcherPtr;
102
103 // STRUCTORS
104
105 /** Default constructor, construct empty callback.
106 */
108 {
109 }
110
111 /** Construct function callback
112 */
113 template <typename FunctionType>
114 Callback14(FunctionType iFunction):
115 dispatcher_(new impl::Dispatcher14Function<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, FunctionType>(iFunction))
116 {
117 }
118
119 /** Construct object/method callback.
120 */
121 template <typename ObjectPtr, typename Method>
122 Callback14(ObjectPtr iObject, Method iMethod):
123 dispatcher_(new impl::Dispatcher14Method<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, ObjectPtr, Method>(iObject, iMethod))
124 {
125 }
126
127 /** copy constructor
128 */
129 Callback14(const TSelf& iOther):
130 dispatcher_(iOther.dispatcher_)
131 {
132 }
133
134 /** move constructor
135 */
136 Callback14(TSelf&& iOther) noexcept:
137 dispatcher_(std::move(iOther.dispatcher_))
138 {
139 }
140
141
142 // OPERATORS
143
144 /** assignment operator
145 */
146 TSelf& operator=(const TSelf& iOther)
147 {
148 TSelf temp(iOther);
149 swap(temp);
150 return *this;
151 }
152
153 /** move assignment operator
154 */
155 TSelf& operator=(TSelf&& iOther) noexcept
156 {
157 dispatcher_ = std::move(iOther.dispatcher_);
158 return *this;
159 }
160
161 /** THE operator. Executes the callback.
162 */
163 void operator()(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, typename util::CallTraits<P13>::TParam iP13, typename util::CallTraits<P14>::TParam iP14) const
164 {
165 if (!isEmpty())
166 {
167 dispatcher_->call(iP1, iP2, iP3, iP4, iP5, iP6, iP7, iP8, iP9, iP10, iP11, iP12, iP13, iP14);
168 }
169 }
170
171
172 // METHODS
173
174 /** Reset to empty callback.
175 */
176 void reset()
177 {
178 dispatcher_.reset();
179 }
180
181 /** Returns true if no callback dispatcher is assigned to this object.
182 */
183 bool isEmpty() const
184 {
185 return dispatcher_.isEmpty();
186 }
187
188 /** return this->isEmpty()
189 */
190 bool operator!() const
191 {
192 return dispatcher_.isEmpty();
193 }
194
195 /** return !this->isEmpty())
196 */
197 explicit operator bool() const
198 {
199 return !dispatcher_.isEmpty() ;
200 }
201
202 /** Swaps the dispatcher of this callback with the dispatcher of another.
203 */
204 void swap(TSelf& iOther)
205 {
206 dispatcher_.swap(iOther.dispatcher_);
207 }
208
209 /** return true if two callbacks call the same function/method,
210 * NEEDS RTTI!
211 */
212 bool operator==(const TSelf& iOther) const
213 {
214 if (dispatcher_ == iOther.dispatcher_)
215 {
216 return true;
217 }
218 return dispatcher_ && dispatcher_->isEquivalent(iOther.dispatcher_.get());
219 }
220
221 const TDispatcherPtr& dispatcher() const
222 {
223 return dispatcher_;
224 }
225
226private:
227
228 TDispatcherPtr dispatcher_;
229};
230
231
232
233/** return true if two callbacks are different
234 * @relates Callback14
235 */
236template<typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12, typename P13, typename P14>
241
242
243
244/** make a Callback14 from a function
245 * @relates Callback14
246 */
247template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12, typename P13, typename P14> inline
248Callback14<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14> makeCallback(void (*iFunction)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14))
249{
251}
252
253
254
255/** make a Callback14 from a callback
256 * @relates Callback14
257 */
258template <typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12, typename P13, typename P14> inline
263
264
265
266/** make a Callback14 from a object and method
267 * @relates Callback14
268 */
269template <typename ObjectPtr, typename Object, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12, typename P13, typename P14> inline
270Callback14<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14> makeCallback(ObjectPtr iObject, void (Object::*iMethod)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14))
271{
273}
274
275
276
277/** make a Callback14 from a object and const method
278 * @relates Callback14
279 */
280template <typename ObjectPtr, typename Object, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9, typename P10, typename P11, typename P12, typename P13, typename P14> inline
281Callback14<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14> makeCallback(ObjectPtr iObject, void (Object::*iMethod)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14) const)
282{
284}
285
286
287
288}
289
290}
291
292#define LASS_PRIM_HAVE_PY_EXPORT_TRAITS_CALLBACK_14
293#ifdef LASS_GUARDIAN_OF_INCLUSION_UTIL_CALLBACK_PYTHON_H
295#endif
296
297#endif // Guardian of Inclusion
298
299// EOF
TSelf & operator=(TSelf &&iOther) noexcept
move assignment operator
Callback14< P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14 > makeCallback(ObjectPtr iObject, void(Object::*iMethod)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14))
make a Callback14 from a object and method
void operator()(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, typename util::CallTraits< P13 >::TParam iP13, typename util::CallTraits< P14 >::TParam iP14) const
THE operator.
bool operator!() const
return this->isEmpty()
Callback14(TSelf &&iOther) noexcept
move constructor
Callback14(const TSelf &iOther)
copy constructor
const Callback14< P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14 > & makeCallback(const Callback14< P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14 > &iCallback)
make a Callback14 from a callback
void swap(TSelf &iOther)
Swaps the dispatcher of this callback with the dispatcher of another.
TSelf & operator=(const TSelf &iOther)
assignment operator
bool operator!=(const Callback14< P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14 > &iA, const Callback14< P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14 > &iB)
return true if two callbacks are different
Callback14()
Default constructor, construct empty callback.
Callback14< P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14 > makeCallback(void(*iFunction)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14))
make a Callback14 from a function
bool isEmpty() const
Returns true if no callback dispatcher is assigned to this object.
Callback14(ObjectPtr iObject, Method iMethod)
Construct object/method callback.
bool operator==(const TSelf &iOther) const
return true if two callbacks call the same function/method, NEEDS RTTI!
Callback14(FunctionType iFunction)
Construct function callback.
Callback14< P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14 > makeCallback(ObjectPtr iObject, void(Object::*iMethod)(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14) const)
make a Callback14 from a object and const method
void reset()
Reset to empty callback.
general utility, debug facilities, ...
Library for Assembled Shared Sources.
Definition config.h:53