mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
<>
Date:
Fri Oct 28 11:17:30 2016 +0100
Revision:
149:156823d33999
Child:
151:5eaa88a5bcc7
This updates the lib to the mbed lib v128

NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1 /* mbed Microcontroller Library
<> 149:156823d33999 2 * Copyright (c) 2006-2015 ARM Limited
<> 149:156823d33999 3 *
<> 149:156823d33999 4 * Licensed under the Apache License, Version 2.0 (the "License");
<> 149:156823d33999 5 * you may not use this file except in compliance with the License.
<> 149:156823d33999 6 * You may obtain a copy of the License at
<> 149:156823d33999 7 *
<> 149:156823d33999 8 * http://www.apache.org/licenses/LICENSE-2.0
<> 149:156823d33999 9 *
<> 149:156823d33999 10 * Unless required by applicable law or agreed to in writing, software
<> 149:156823d33999 11 * distributed under the License is distributed on an "AS IS" BASIS,
<> 149:156823d33999 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 149:156823d33999 13 * See the License for the specific language governing permissions and
<> 149:156823d33999 14 * limitations under the License.
<> 149:156823d33999 15 */
<> 149:156823d33999 16 #ifndef MBED_CALLBACK_H
<> 149:156823d33999 17 #define MBED_CALLBACK_H
<> 149:156823d33999 18
<> 149:156823d33999 19 #include <string.h>
<> 149:156823d33999 20 #include <stdint.h>
<> 149:156823d33999 21 #include <new>
<> 149:156823d33999 22 #include "platform/mbed_assert.h"
<> 149:156823d33999 23 #include "platform/toolchain.h"
<> 149:156823d33999 24
<> 149:156823d33999 25 namespace mbed {
<> 149:156823d33999 26 /** \addtogroup platform */
<> 149:156823d33999 27 /** @{*/
<> 149:156823d33999 28
<> 149:156823d33999 29
<> 149:156823d33999 30 /** Callback class based on template specialization
<> 149:156823d33999 31 *
<> 149:156823d33999 32 * @Note Synchronization level: Not protected
<> 149:156823d33999 33 */
<> 149:156823d33999 34 template <typename F>
<> 149:156823d33999 35 class Callback;
<> 149:156823d33999 36
<> 149:156823d33999 37 // Internal sfinae declarations
<> 149:156823d33999 38 //
<> 149:156823d33999 39 // These are used to eliminate overloads based on type attributes
<> 149:156823d33999 40 // 1. Does a function object have a call operator
<> 149:156823d33999 41 // 2. Does a function object fit in the available storage
<> 149:156823d33999 42 //
<> 149:156823d33999 43 // These eliminations are handled cleanly by the compiler and avoid
<> 149:156823d33999 44 // massive and misleading error messages when confronted with an
<> 149:156823d33999 45 // invalid type (or worse, runtime failures)
<> 149:156823d33999 46 namespace detail {
<> 149:156823d33999 47 struct nil {};
<> 149:156823d33999 48
<> 149:156823d33999 49 template <bool B, typename R = nil>
<> 149:156823d33999 50 struct enable_if { typedef R type; };
<> 149:156823d33999 51
<> 149:156823d33999 52 template <typename R>
<> 149:156823d33999 53 struct enable_if<false, R> {};
<> 149:156823d33999 54
<> 149:156823d33999 55 template <typename M, M>
<> 149:156823d33999 56 struct is_type {
<> 149:156823d33999 57 static const bool value = true;
<> 149:156823d33999 58 };
<> 149:156823d33999 59 }
<> 149:156823d33999 60
<> 149:156823d33999 61 /** Callback class based on template specialization
<> 149:156823d33999 62 *
<> 149:156823d33999 63 * @Note Synchronization level: Not protected
<> 149:156823d33999 64 */
<> 149:156823d33999 65 template <typename R>
<> 149:156823d33999 66 class Callback<R()> {
<> 149:156823d33999 67 public:
<> 149:156823d33999 68 /** Create a Callback with a static function
<> 149:156823d33999 69 * @param func Static function to attach
<> 149:156823d33999 70 */
<> 149:156823d33999 71 Callback(R (*func)() = 0) {
<> 149:156823d33999 72 if (!func) {
<> 149:156823d33999 73 _ops = 0;
<> 149:156823d33999 74 } else {
<> 149:156823d33999 75 generate(func);
<> 149:156823d33999 76 }
<> 149:156823d33999 77 }
<> 149:156823d33999 78
<> 149:156823d33999 79 /** Attach a Callback
<> 149:156823d33999 80 * @param func The Callback to attach
<> 149:156823d33999 81 */
<> 149:156823d33999 82 Callback(const Callback<R()> &func) {
<> 149:156823d33999 83 if (func._ops) {
<> 149:156823d33999 84 func._ops->move(this, &func);
<> 149:156823d33999 85 }
<> 149:156823d33999 86 _ops = func._ops;
<> 149:156823d33999 87 }
<> 149:156823d33999 88
<> 149:156823d33999 89 /** Create a Callback with a member function
<> 149:156823d33999 90 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 91 * @param method Member function to attach
<> 149:156823d33999 92 */
<> 149:156823d33999 93 template<typename T>
<> 149:156823d33999 94 Callback(T *obj, R (T::*method)()) {
<> 149:156823d33999 95 generate(method_context<T, R (T::*)()>(obj, method));
<> 149:156823d33999 96 }
<> 149:156823d33999 97
<> 149:156823d33999 98 /** Create a Callback with a member function
<> 149:156823d33999 99 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 100 * @param method Member function to attach
<> 149:156823d33999 101 */
<> 149:156823d33999 102 template<typename T>
<> 149:156823d33999 103 Callback(const T *obj, R (T::*method)() const) {
<> 149:156823d33999 104 generate(method_context<const T, R (T::*)() const>(obj, method));
<> 149:156823d33999 105 }
<> 149:156823d33999 106
<> 149:156823d33999 107 /** Create a Callback with a member function
<> 149:156823d33999 108 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 109 * @param method Member function to attach
<> 149:156823d33999 110 */
<> 149:156823d33999 111 template<typename T>
<> 149:156823d33999 112 Callback(volatile T *obj, R (T::*method)() volatile) {
<> 149:156823d33999 113 generate(method_context<volatile T, R (T::*)() volatile>(obj, method));
<> 149:156823d33999 114 }
<> 149:156823d33999 115
<> 149:156823d33999 116 /** Create a Callback with a member function
<> 149:156823d33999 117 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 118 * @param method Member function to attach
<> 149:156823d33999 119 */
<> 149:156823d33999 120 template<typename T>
<> 149:156823d33999 121 Callback(const volatile T *obj, R (T::*method)() const volatile) {
<> 149:156823d33999 122 generate(method_context<const volatile T, R (T::*)() const volatile>(obj, method));
<> 149:156823d33999 123 }
<> 149:156823d33999 124
<> 149:156823d33999 125 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 126 * @param func Static function to attach
<> 149:156823d33999 127 * @param arg Pointer argument to function
<> 149:156823d33999 128 */
<> 149:156823d33999 129 Callback(R (*func)(void*), void *arg) {
<> 149:156823d33999 130 generate(function_context<R (*)(void*), void>(func, arg));
<> 149:156823d33999 131 }
<> 149:156823d33999 132
<> 149:156823d33999 133 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 134 * @param func Static function to attach
<> 149:156823d33999 135 * @param arg Pointer argument to function
<> 149:156823d33999 136 */
<> 149:156823d33999 137 Callback(R (*func)(const void*), const void *arg) {
<> 149:156823d33999 138 generate(function_context<R (*)(const void*), const void>(func, arg));
<> 149:156823d33999 139 }
<> 149:156823d33999 140
<> 149:156823d33999 141 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 142 * @param func Static function to attach
<> 149:156823d33999 143 * @param arg Pointer argument to function
<> 149:156823d33999 144 */
<> 149:156823d33999 145 Callback(R (*func)(volatile void*), volatile void *arg) {
<> 149:156823d33999 146 generate(function_context<R (*)(volatile void*), volatile void>(func, arg));
<> 149:156823d33999 147 }
<> 149:156823d33999 148
<> 149:156823d33999 149 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 150 * @param func Static function to attach
<> 149:156823d33999 151 * @param arg Pointer argument to function
<> 149:156823d33999 152 */
<> 149:156823d33999 153 Callback(R (*func)(const volatile void*), const volatile void *arg) {
<> 149:156823d33999 154 generate(function_context<R (*)(const volatile void*), const volatile void>(func, arg));
<> 149:156823d33999 155 }
<> 149:156823d33999 156
<> 149:156823d33999 157 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 158 * @param func Static function to attach
<> 149:156823d33999 159 * @param arg Pointer argument to function
<> 149:156823d33999 160 */
<> 149:156823d33999 161 template<typename T>
<> 149:156823d33999 162 Callback(R (*func)(T*), T *arg) {
<> 149:156823d33999 163 generate(function_context<R (*)(T*), T>(func, arg));
<> 149:156823d33999 164 }
<> 149:156823d33999 165
<> 149:156823d33999 166 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 167 * @param func Static function to attach
<> 149:156823d33999 168 * @param arg Pointer argument to function
<> 149:156823d33999 169 */
<> 149:156823d33999 170 template<typename T>
<> 149:156823d33999 171 Callback(R (*func)(const T*), const T *arg) {
<> 149:156823d33999 172 generate(function_context<R (*)(const T*), const T>(func, arg));
<> 149:156823d33999 173 }
<> 149:156823d33999 174
<> 149:156823d33999 175 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 176 * @param func Static function to attach
<> 149:156823d33999 177 * @param arg Pointer argument to function
<> 149:156823d33999 178 */
<> 149:156823d33999 179 template<typename T>
<> 149:156823d33999 180 Callback(R (*func)(volatile T*), volatile T *arg) {
<> 149:156823d33999 181 generate(function_context<R (*)(volatile T*), volatile T>(func, arg));
<> 149:156823d33999 182 }
<> 149:156823d33999 183
<> 149:156823d33999 184 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 185 * @param func Static function to attach
<> 149:156823d33999 186 * @param arg Pointer argument to function
<> 149:156823d33999 187 */
<> 149:156823d33999 188 template<typename T>
<> 149:156823d33999 189 Callback(R (*func)(const volatile T*), const volatile T *arg) {
<> 149:156823d33999 190 generate(function_context<R (*)(const volatile T*), const volatile T>(func, arg));
<> 149:156823d33999 191 }
<> 149:156823d33999 192
<> 149:156823d33999 193 /** Create a Callback with a function object
<> 149:156823d33999 194 * @param func Function object to attach
<> 149:156823d33999 195 * @note The function object is limited to a single word of storage
<> 149:156823d33999 196 */
<> 149:156823d33999 197 template <typename F>
<> 149:156823d33999 198 Callback(F f, typename detail::enable_if<
<> 149:156823d33999 199 detail::is_type<R (F::*)(), &F::operator()>::value &&
<> 149:156823d33999 200 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 201 >::type = detail::nil()) {
<> 149:156823d33999 202 generate(f);
<> 149:156823d33999 203 }
<> 149:156823d33999 204
<> 149:156823d33999 205 /** Create a Callback with a function object
<> 149:156823d33999 206 * @param func Function object to attach
<> 149:156823d33999 207 * @note The function object is limited to a single word of storage
<> 149:156823d33999 208 */
<> 149:156823d33999 209 template <typename F>
<> 149:156823d33999 210 Callback(const F f, typename detail::enable_if<
<> 149:156823d33999 211 detail::is_type<R (F::*)() const, &F::operator()>::value &&
<> 149:156823d33999 212 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 213 >::type = detail::nil()) {
<> 149:156823d33999 214 generate(f);
<> 149:156823d33999 215 }
<> 149:156823d33999 216
<> 149:156823d33999 217 /** Create a Callback with a function object
<> 149:156823d33999 218 * @param func Function object to attach
<> 149:156823d33999 219 * @note The function object is limited to a single word of storage
<> 149:156823d33999 220 */
<> 149:156823d33999 221 template <typename F>
<> 149:156823d33999 222 Callback(volatile F f, typename detail::enable_if<
<> 149:156823d33999 223 detail::is_type<R (F::*)() volatile, &F::operator()>::value &&
<> 149:156823d33999 224 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 225 >::type = detail::nil()) {
<> 149:156823d33999 226 generate(f);
<> 149:156823d33999 227 }
<> 149:156823d33999 228
<> 149:156823d33999 229 /** Create a Callback with a function object
<> 149:156823d33999 230 * @param func Function object to attach
<> 149:156823d33999 231 * @note The function object is limited to a single word of storage
<> 149:156823d33999 232 */
<> 149:156823d33999 233 template <typename F>
<> 149:156823d33999 234 Callback(const volatile F f, typename detail::enable_if<
<> 149:156823d33999 235 detail::is_type<R (F::*)() const volatile, &F::operator()>::value &&
<> 149:156823d33999 236 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 237 >::type = detail::nil()) {
<> 149:156823d33999 238 generate(f);
<> 149:156823d33999 239 }
<> 149:156823d33999 240
<> 149:156823d33999 241 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 242 * @param obj Pointer to object to bind to function
<> 149:156823d33999 243 * @param func Static function to attach
<> 149:156823d33999 244 * @deprecated
<> 149:156823d33999 245 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 246 */
<> 149:156823d33999 247 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 248 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 249 Callback(void *obj, R (*func)(void*)) {
<> 149:156823d33999 250 new (this) Callback(func, obj);
<> 149:156823d33999 251 }
<> 149:156823d33999 252
<> 149:156823d33999 253 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 254 * @param obj Pointer to object to bind to function
<> 149:156823d33999 255 * @param func Static function to attach
<> 149:156823d33999 256 * @deprecated
<> 149:156823d33999 257 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 258 */
<> 149:156823d33999 259 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 260 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 261 Callback(const void *obj, R (*func)(const void*)) {
<> 149:156823d33999 262 new (this) Callback(func, obj);
<> 149:156823d33999 263 }
<> 149:156823d33999 264
<> 149:156823d33999 265 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 266 * @param obj Pointer to object to bind to function
<> 149:156823d33999 267 * @param func Static function to attach
<> 149:156823d33999 268 * @deprecated
<> 149:156823d33999 269 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 270 */
<> 149:156823d33999 271 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 272 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 273 Callback(volatile void *obj, R (*func)(volatile void*)) {
<> 149:156823d33999 274 new (this) Callback(func, obj);
<> 149:156823d33999 275 }
<> 149:156823d33999 276
<> 149:156823d33999 277 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 278 * @param obj Pointer to object to bind to function
<> 149:156823d33999 279 * @param func Static function to attach
<> 149:156823d33999 280 * @deprecated
<> 149:156823d33999 281 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 282 */
<> 149:156823d33999 283 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 284 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 285 Callback(const volatile void *obj, R (*func)(const volatile void*)) {
<> 149:156823d33999 286 new (this) Callback(func, obj);
<> 149:156823d33999 287 }
<> 149:156823d33999 288
<> 149:156823d33999 289 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 290 * @param obj Pointer to object to bind to function
<> 149:156823d33999 291 * @param func Static function to attach
<> 149:156823d33999 292 * @deprecated
<> 149:156823d33999 293 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 294 */
<> 149:156823d33999 295 template<typename T>
<> 149:156823d33999 296 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 297 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 298 Callback(T *obj, R (*func)(T*)) {
<> 149:156823d33999 299 new (this) Callback(func, obj);
<> 149:156823d33999 300 }
<> 149:156823d33999 301
<> 149:156823d33999 302 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 303 * @param obj Pointer to object to bind to function
<> 149:156823d33999 304 * @param func Static function to attach
<> 149:156823d33999 305 * @deprecated
<> 149:156823d33999 306 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 307 */
<> 149:156823d33999 308 template<typename T>
<> 149:156823d33999 309 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 310 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 311 Callback(const T *obj, R (*func)(const T*)) {
<> 149:156823d33999 312 new (this) Callback(func, obj);
<> 149:156823d33999 313 }
<> 149:156823d33999 314
<> 149:156823d33999 315 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 316 * @param obj Pointer to object to bind to function
<> 149:156823d33999 317 * @param func Static function to attach
<> 149:156823d33999 318 * @deprecated
<> 149:156823d33999 319 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 320 */
<> 149:156823d33999 321 template<typename T>
<> 149:156823d33999 322 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 323 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 324 Callback(volatile T *obj, R (*func)(volatile T*)) {
<> 149:156823d33999 325 new (this) Callback(func, obj);
<> 149:156823d33999 326 }
<> 149:156823d33999 327
<> 149:156823d33999 328 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 329 * @param obj Pointer to object to bind to function
<> 149:156823d33999 330 * @param func Static function to attach
<> 149:156823d33999 331 * @deprecated
<> 149:156823d33999 332 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 333 */
<> 149:156823d33999 334 template<typename T>
<> 149:156823d33999 335 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 336 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 337 Callback(const volatile T *obj, R (*func)(const volatile T*)) {
<> 149:156823d33999 338 new (this) Callback(func, obj);
<> 149:156823d33999 339 }
<> 149:156823d33999 340
<> 149:156823d33999 341 /** Destroy a callback
<> 149:156823d33999 342 */
<> 149:156823d33999 343 ~Callback() {
<> 149:156823d33999 344 if (_ops) {
<> 149:156823d33999 345 _ops->dtor(this);
<> 149:156823d33999 346 }
<> 149:156823d33999 347 }
<> 149:156823d33999 348
<> 149:156823d33999 349 /** Attach a static function
<> 149:156823d33999 350 * @param func Static function to attach
<> 149:156823d33999 351 */
<> 149:156823d33999 352 void attach(R (*func)()) {
<> 149:156823d33999 353 this->~Callback();
<> 149:156823d33999 354 new (this) Callback(func);
<> 149:156823d33999 355 }
<> 149:156823d33999 356
<> 149:156823d33999 357 /** Attach a Callback
<> 149:156823d33999 358 * @param func The Callback to attach
<> 149:156823d33999 359 */
<> 149:156823d33999 360 void attach(const Callback<R()> &func) {
<> 149:156823d33999 361 this->~Callback();
<> 149:156823d33999 362 new (this) Callback(func);
<> 149:156823d33999 363 }
<> 149:156823d33999 364
<> 149:156823d33999 365 /** Attach a member function
<> 149:156823d33999 366 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 367 * @param method Member function to attach
<> 149:156823d33999 368 */
<> 149:156823d33999 369 template<typename T>
<> 149:156823d33999 370 void attach(T *obj, R (T::*method)()) {
<> 149:156823d33999 371 this->~Callback();
<> 149:156823d33999 372 new (this) Callback(obj, method);
<> 149:156823d33999 373 }
<> 149:156823d33999 374
<> 149:156823d33999 375 /** Attach a member function
<> 149:156823d33999 376 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 377 * @param method Member function to attach
<> 149:156823d33999 378 */
<> 149:156823d33999 379 template<typename T>
<> 149:156823d33999 380 void attach(const T *obj, R (T::*method)() const) {
<> 149:156823d33999 381 this->~Callback();
<> 149:156823d33999 382 new (this) Callback(obj, method);
<> 149:156823d33999 383 }
<> 149:156823d33999 384
<> 149:156823d33999 385 /** Attach a member function
<> 149:156823d33999 386 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 387 * @param method Member function to attach
<> 149:156823d33999 388 */
<> 149:156823d33999 389 template<typename T>
<> 149:156823d33999 390 void attach(volatile T *obj, R (T::*method)() volatile) {
<> 149:156823d33999 391 this->~Callback();
<> 149:156823d33999 392 new (this) Callback(obj, method);
<> 149:156823d33999 393 }
<> 149:156823d33999 394
<> 149:156823d33999 395 /** Attach a member function
<> 149:156823d33999 396 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 397 * @param method Member function to attach
<> 149:156823d33999 398 */
<> 149:156823d33999 399 template<typename T>
<> 149:156823d33999 400 void attach(const volatile T *obj, R (T::*method)() const volatile) {
<> 149:156823d33999 401 this->~Callback();
<> 149:156823d33999 402 new (this) Callback(obj, method);
<> 149:156823d33999 403 }
<> 149:156823d33999 404
<> 149:156823d33999 405 /** Attach a static function with a bound pointer
<> 149:156823d33999 406 * @param func Static function to attach
<> 149:156823d33999 407 * @param arg Pointer argument to function
<> 149:156823d33999 408 */
<> 149:156823d33999 409 void attach(R (*func)(void*), void *arg) {
<> 149:156823d33999 410 this->~Callback();
<> 149:156823d33999 411 new (this) Callback(func, arg);
<> 149:156823d33999 412 }
<> 149:156823d33999 413
<> 149:156823d33999 414 /** Attach a static function with a bound pointer
<> 149:156823d33999 415 * @param func Static function to attach
<> 149:156823d33999 416 * @param arg Pointer argument to function
<> 149:156823d33999 417 */
<> 149:156823d33999 418 void attach(R (*func)(const void*), const void *arg) {
<> 149:156823d33999 419 this->~Callback();
<> 149:156823d33999 420 new (this) Callback(func, arg);
<> 149:156823d33999 421 }
<> 149:156823d33999 422
<> 149:156823d33999 423 /** Attach a static function with a bound pointer
<> 149:156823d33999 424 * @param func Static function to attach
<> 149:156823d33999 425 * @param arg Pointer argument to function
<> 149:156823d33999 426 */
<> 149:156823d33999 427 void attach(R (*func)(volatile void*), volatile void *arg) {
<> 149:156823d33999 428 this->~Callback();
<> 149:156823d33999 429 new (this) Callback(func, arg);
<> 149:156823d33999 430 }
<> 149:156823d33999 431
<> 149:156823d33999 432 /** Attach a static function with a bound pointer
<> 149:156823d33999 433 * @param func Static function to attach
<> 149:156823d33999 434 * @param arg Pointer argument to function
<> 149:156823d33999 435 */
<> 149:156823d33999 436 void attach(R (*func)(const volatile void*), const volatile void *arg) {
<> 149:156823d33999 437 this->~Callback();
<> 149:156823d33999 438 new (this) Callback(func, arg);
<> 149:156823d33999 439 }
<> 149:156823d33999 440
<> 149:156823d33999 441 /** Attach a static function with a bound pointer
<> 149:156823d33999 442 * @param func Static function to attach
<> 149:156823d33999 443 * @param arg Pointer argument to function
<> 149:156823d33999 444 */
<> 149:156823d33999 445 template <typename T>
<> 149:156823d33999 446 void attach(R (*func)(T*), T *arg) {
<> 149:156823d33999 447 this->~Callback();
<> 149:156823d33999 448 new (this) Callback(func, arg);
<> 149:156823d33999 449 }
<> 149:156823d33999 450
<> 149:156823d33999 451 /** Attach a static function with a bound pointer
<> 149:156823d33999 452 * @param func Static function to attach
<> 149:156823d33999 453 * @param arg Pointer argument to function
<> 149:156823d33999 454 */
<> 149:156823d33999 455 template <typename T>
<> 149:156823d33999 456 void attach(R (*func)(const T*), const T *arg) {
<> 149:156823d33999 457 this->~Callback();
<> 149:156823d33999 458 new (this) Callback(func, arg);
<> 149:156823d33999 459 }
<> 149:156823d33999 460
<> 149:156823d33999 461 /** Attach a static function with a bound pointer
<> 149:156823d33999 462 * @param func Static function to attach
<> 149:156823d33999 463 * @param arg Pointer argument to function
<> 149:156823d33999 464 */
<> 149:156823d33999 465 template <typename T>
<> 149:156823d33999 466 void attach(R (*func)(volatile T*), volatile T *arg) {
<> 149:156823d33999 467 this->~Callback();
<> 149:156823d33999 468 new (this) Callback(func, arg);
<> 149:156823d33999 469 }
<> 149:156823d33999 470
<> 149:156823d33999 471 /** Attach a static function with a bound pointer
<> 149:156823d33999 472 * @param func Static function to attach
<> 149:156823d33999 473 * @param arg Pointer argument to function
<> 149:156823d33999 474 */
<> 149:156823d33999 475 template <typename T>
<> 149:156823d33999 476 void attach(R (*func)(const volatile T*), const volatile T *arg) {
<> 149:156823d33999 477 this->~Callback();
<> 149:156823d33999 478 new (this) Callback(func, arg);
<> 149:156823d33999 479 }
<> 149:156823d33999 480
<> 149:156823d33999 481 /** Attach a function object
<> 149:156823d33999 482 * @param func Function object to attach
<> 149:156823d33999 483 * @note The function object is limited to a single word of storage
<> 149:156823d33999 484 */
<> 149:156823d33999 485 template <typename F>
<> 149:156823d33999 486 void attach(F f, typename detail::enable_if<
<> 149:156823d33999 487 detail::is_type<R (F::*)(), &F::operator()>::value &&
<> 149:156823d33999 488 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 489 >::type = detail::nil()) {
<> 149:156823d33999 490 this->~Callback();
<> 149:156823d33999 491 new (this) Callback(f);
<> 149:156823d33999 492 }
<> 149:156823d33999 493
<> 149:156823d33999 494 /** Attach a function object
<> 149:156823d33999 495 * @param func Function object to attach
<> 149:156823d33999 496 * @note The function object is limited to a single word of storage
<> 149:156823d33999 497 */
<> 149:156823d33999 498 template <typename F>
<> 149:156823d33999 499 void attach(const F f, typename detail::enable_if<
<> 149:156823d33999 500 detail::is_type<R (F::*)() const, &F::operator()>::value &&
<> 149:156823d33999 501 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 502 >::type = detail::nil()) {
<> 149:156823d33999 503 this->~Callback();
<> 149:156823d33999 504 new (this) Callback(f);
<> 149:156823d33999 505 }
<> 149:156823d33999 506
<> 149:156823d33999 507 /** Attach a function object
<> 149:156823d33999 508 * @param func Function object to attach
<> 149:156823d33999 509 * @note The function object is limited to a single word of storage
<> 149:156823d33999 510 */
<> 149:156823d33999 511 template <typename F>
<> 149:156823d33999 512 void attach(volatile F f, typename detail::enable_if<
<> 149:156823d33999 513 detail::is_type<R (F::*)() volatile, &F::operator()>::value &&
<> 149:156823d33999 514 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 515 >::type = detail::nil()) {
<> 149:156823d33999 516 this->~Callback();
<> 149:156823d33999 517 new (this) Callback(f);
<> 149:156823d33999 518 }
<> 149:156823d33999 519
<> 149:156823d33999 520 /** Attach a function object
<> 149:156823d33999 521 * @param func Function object to attach
<> 149:156823d33999 522 * @note The function object is limited to a single word of storage
<> 149:156823d33999 523 */
<> 149:156823d33999 524 template <typename F>
<> 149:156823d33999 525 void attach(const volatile F f, typename detail::enable_if<
<> 149:156823d33999 526 detail::is_type<R (F::*)() const volatile, &F::operator()>::value &&
<> 149:156823d33999 527 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 528 >::type = detail::nil()) {
<> 149:156823d33999 529 this->~Callback();
<> 149:156823d33999 530 new (this) Callback(f);
<> 149:156823d33999 531 }
<> 149:156823d33999 532
<> 149:156823d33999 533 /** Attach a static function with a bound pointer
<> 149:156823d33999 534 * @param obj Pointer to object to bind to function
<> 149:156823d33999 535 * @param func Static function to attach
<> 149:156823d33999 536 * @deprecated
<> 149:156823d33999 537 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 538 */
<> 149:156823d33999 539 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 540 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 541 void attach(void *obj, R (*func)(void*)) {
<> 149:156823d33999 542 this->~Callback();
<> 149:156823d33999 543 new (this) Callback(func, obj);
<> 149:156823d33999 544 }
<> 149:156823d33999 545
<> 149:156823d33999 546 /** Attach a static function with a bound pointer
<> 149:156823d33999 547 * @param obj Pointer to object to bind to function
<> 149:156823d33999 548 * @param func Static function to attach
<> 149:156823d33999 549 * @deprecated
<> 149:156823d33999 550 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 551 */
<> 149:156823d33999 552 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 553 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 554 void attach(const void *obj, R (*func)(const void*)) {
<> 149:156823d33999 555 this->~Callback();
<> 149:156823d33999 556 new (this) Callback(func, obj);
<> 149:156823d33999 557 }
<> 149:156823d33999 558
<> 149:156823d33999 559 /** Attach a static function with a bound pointer
<> 149:156823d33999 560 * @param obj Pointer to object to bind to function
<> 149:156823d33999 561 * @param func Static function to attach
<> 149:156823d33999 562 * @deprecated
<> 149:156823d33999 563 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 564 */
<> 149:156823d33999 565 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 566 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 567 void attach(volatile void *obj, R (*func)(volatile void*)) {
<> 149:156823d33999 568 this->~Callback();
<> 149:156823d33999 569 new (this) Callback(func, obj);
<> 149:156823d33999 570 }
<> 149:156823d33999 571
<> 149:156823d33999 572 /** Attach a static function with a bound pointer
<> 149:156823d33999 573 * @param obj Pointer to object to bind to function
<> 149:156823d33999 574 * @param func Static function to attach
<> 149:156823d33999 575 * @deprecated
<> 149:156823d33999 576 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 577 */
<> 149:156823d33999 578 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 579 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 580 void attach(const volatile void *obj, R (*func)(const volatile void*)) {
<> 149:156823d33999 581 this->~Callback();
<> 149:156823d33999 582 new (this) Callback(func, obj);
<> 149:156823d33999 583 }
<> 149:156823d33999 584
<> 149:156823d33999 585 /** Attach a static function with a bound pointer
<> 149:156823d33999 586 * @param obj Pointer to object to bind to function
<> 149:156823d33999 587 * @param func Static function to attach
<> 149:156823d33999 588 * @deprecated
<> 149:156823d33999 589 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 590 */
<> 149:156823d33999 591 template <typename T>
<> 149:156823d33999 592 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 593 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 594 void attach(T *obj, R (*func)(T*)) {
<> 149:156823d33999 595 this->~Callback();
<> 149:156823d33999 596 new (this) Callback(func, obj);
<> 149:156823d33999 597 }
<> 149:156823d33999 598
<> 149:156823d33999 599 /** Attach a static function with a bound pointer
<> 149:156823d33999 600 * @param obj Pointer to object to bind to function
<> 149:156823d33999 601 * @param func Static function to attach
<> 149:156823d33999 602 * @deprecated
<> 149:156823d33999 603 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 604 */
<> 149:156823d33999 605 template <typename T>
<> 149:156823d33999 606 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 607 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 608 void attach(const T *obj, R (*func)(const T*)) {
<> 149:156823d33999 609 this->~Callback();
<> 149:156823d33999 610 new (this) Callback(func, obj);
<> 149:156823d33999 611 }
<> 149:156823d33999 612
<> 149:156823d33999 613 /** Attach a static function with a bound pointer
<> 149:156823d33999 614 * @param obj Pointer to object to bind to function
<> 149:156823d33999 615 * @param func Static function to attach
<> 149:156823d33999 616 * @deprecated
<> 149:156823d33999 617 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 618 */
<> 149:156823d33999 619 template <typename T>
<> 149:156823d33999 620 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 621 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 622 void attach(volatile T *obj, R (*func)(volatile T*)) {
<> 149:156823d33999 623 this->~Callback();
<> 149:156823d33999 624 new (this) Callback(func, obj);
<> 149:156823d33999 625 }
<> 149:156823d33999 626
<> 149:156823d33999 627 /** Attach a static function with a bound pointer
<> 149:156823d33999 628 * @param obj Pointer to object to bind to function
<> 149:156823d33999 629 * @param func Static function to attach
<> 149:156823d33999 630 * @deprecated
<> 149:156823d33999 631 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 632 */
<> 149:156823d33999 633 template <typename T>
<> 149:156823d33999 634 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 635 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 636 void attach(const volatile T *obj, R (*func)(const volatile T*)) {
<> 149:156823d33999 637 this->~Callback();
<> 149:156823d33999 638 new (this) Callback(func, obj);
<> 149:156823d33999 639 }
<> 149:156823d33999 640
<> 149:156823d33999 641 /** Assign a callback
<> 149:156823d33999 642 */
<> 149:156823d33999 643 Callback &operator=(const Callback &that) {
<> 149:156823d33999 644 if (this != &that) {
<> 149:156823d33999 645 this->~Callback();
<> 149:156823d33999 646 new (this) Callback(that);
<> 149:156823d33999 647 }
<> 149:156823d33999 648
<> 149:156823d33999 649 return *this;
<> 149:156823d33999 650 }
<> 149:156823d33999 651
<> 149:156823d33999 652 /** Call the attached function
<> 149:156823d33999 653 */
<> 149:156823d33999 654 R call() const {
<> 149:156823d33999 655 MBED_ASSERT(_ops);
<> 149:156823d33999 656 return _ops->call(this);
<> 149:156823d33999 657 }
<> 149:156823d33999 658
<> 149:156823d33999 659 /** Call the attached function
<> 149:156823d33999 660 */
<> 149:156823d33999 661 R operator()() const {
<> 149:156823d33999 662 return call();
<> 149:156823d33999 663 }
<> 149:156823d33999 664
<> 149:156823d33999 665 /** Test if function has been attached
<> 149:156823d33999 666 */
<> 149:156823d33999 667 operator bool() const {
<> 149:156823d33999 668 return _ops;
<> 149:156823d33999 669 }
<> 149:156823d33999 670
<> 149:156823d33999 671 /** Test for equality
<> 149:156823d33999 672 */
<> 149:156823d33999 673 friend bool operator==(const Callback &l, const Callback &r) {
<> 149:156823d33999 674 return memcmp(&l, &r, sizeof(Callback)) == 0;
<> 149:156823d33999 675 }
<> 149:156823d33999 676
<> 149:156823d33999 677 /** Test for inequality
<> 149:156823d33999 678 */
<> 149:156823d33999 679 friend bool operator!=(const Callback &l, const Callback &r) {
<> 149:156823d33999 680 return !(l == r);
<> 149:156823d33999 681 }
<> 149:156823d33999 682
<> 149:156823d33999 683 /** Static thunk for passing as C-style function
<> 149:156823d33999 684 * @param func Callback to call passed as void pointer
<> 149:156823d33999 685 */
<> 149:156823d33999 686 static R thunk(void *func) {
<> 149:156823d33999 687 return static_cast<Callback*>(func)->call();
<> 149:156823d33999 688 }
<> 149:156823d33999 689
<> 149:156823d33999 690 private:
<> 149:156823d33999 691 // Stored as pointer to function and pointer to optional object
<> 149:156823d33999 692 // Function pointer is stored as union of possible function types
<> 149:156823d33999 693 // to garuntee proper size and alignment
<> 149:156823d33999 694 struct _class;
<> 149:156823d33999 695 union {
<> 149:156823d33999 696 void (*_staticfunc)();
<> 149:156823d33999 697 void (*_boundfunc)(_class*);
<> 149:156823d33999 698 void (_class::*_methodfunc)();
<> 149:156823d33999 699 } _func;
<> 149:156823d33999 700 void *_obj;
<> 149:156823d33999 701
<> 149:156823d33999 702 // Dynamically dispatched operations
<> 149:156823d33999 703 const struct ops {
<> 149:156823d33999 704 R (*call)(const void*);
<> 149:156823d33999 705 void (*move)(void*, const void*);
<> 149:156823d33999 706 void (*dtor)(void*);
<> 149:156823d33999 707 } *_ops;
<> 149:156823d33999 708
<> 149:156823d33999 709 // Generate operations for function object
<> 149:156823d33999 710 template <typename F>
<> 149:156823d33999 711 void generate(const F &f) {
<> 149:156823d33999 712 static const ops ops = {
<> 149:156823d33999 713 &Callback::function_call<F>,
<> 149:156823d33999 714 &Callback::function_move<F>,
<> 149:156823d33999 715 &Callback::function_dtor<F>,
<> 149:156823d33999 716 };
<> 149:156823d33999 717
<> 149:156823d33999 718 MBED_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F));
<> 149:156823d33999 719 new (this) F(f);
<> 149:156823d33999 720 _ops = &ops;
<> 149:156823d33999 721 }
<> 149:156823d33999 722
<> 149:156823d33999 723 // Function attributes
<> 149:156823d33999 724 template <typename F>
<> 149:156823d33999 725 static R function_call(const void *p) {
<> 149:156823d33999 726 return (*(F*)p)();
<> 149:156823d33999 727 }
<> 149:156823d33999 728
<> 149:156823d33999 729 template <typename F>
<> 149:156823d33999 730 static void function_move(void *d, const void *p) {
<> 149:156823d33999 731 new (d) F(*(F*)p);
<> 149:156823d33999 732 }
<> 149:156823d33999 733
<> 149:156823d33999 734 template <typename F>
<> 149:156823d33999 735 static void function_dtor(void *p) {
<> 149:156823d33999 736 ((F*)p)->~F();
<> 149:156823d33999 737 }
<> 149:156823d33999 738
<> 149:156823d33999 739 // Wrappers for functions with context
<> 149:156823d33999 740 template <typename O, typename M>
<> 149:156823d33999 741 struct method_context {
<> 149:156823d33999 742 M method;
<> 149:156823d33999 743 O *obj;
<> 149:156823d33999 744
<> 149:156823d33999 745 method_context(O *obj, M method)
<> 149:156823d33999 746 : method(method), obj(obj) {}
<> 149:156823d33999 747
<> 149:156823d33999 748 R operator()() const {
<> 149:156823d33999 749 return (obj->*method)();
<> 149:156823d33999 750 }
<> 149:156823d33999 751 };
<> 149:156823d33999 752
<> 149:156823d33999 753 template <typename F, typename A>
<> 149:156823d33999 754 struct function_context {
<> 149:156823d33999 755 F func;
<> 149:156823d33999 756 A *arg;
<> 149:156823d33999 757
<> 149:156823d33999 758 function_context(F func, A *arg)
<> 149:156823d33999 759 : func(func), arg(arg) {}
<> 149:156823d33999 760
<> 149:156823d33999 761 R operator()() const {
<> 149:156823d33999 762 return func(arg);
<> 149:156823d33999 763 }
<> 149:156823d33999 764 };
<> 149:156823d33999 765 };
<> 149:156823d33999 766
<> 149:156823d33999 767 /** Callback class based on template specialization
<> 149:156823d33999 768 *
<> 149:156823d33999 769 * @Note Synchronization level: Not protected
<> 149:156823d33999 770 */
<> 149:156823d33999 771 template <typename R, typename A0>
<> 149:156823d33999 772 class Callback<R(A0)> {
<> 149:156823d33999 773 public:
<> 149:156823d33999 774 /** Create a Callback with a static function
<> 149:156823d33999 775 * @param func Static function to attach
<> 149:156823d33999 776 */
<> 149:156823d33999 777 Callback(R (*func)(A0) = 0) {
<> 149:156823d33999 778 if (!func) {
<> 149:156823d33999 779 _ops = 0;
<> 149:156823d33999 780 } else {
<> 149:156823d33999 781 generate(func);
<> 149:156823d33999 782 }
<> 149:156823d33999 783 }
<> 149:156823d33999 784
<> 149:156823d33999 785 /** Attach a Callback
<> 149:156823d33999 786 * @param func The Callback to attach
<> 149:156823d33999 787 */
<> 149:156823d33999 788 Callback(const Callback<R(A0)> &func) {
<> 149:156823d33999 789 if (func._ops) {
<> 149:156823d33999 790 func._ops->move(this, &func);
<> 149:156823d33999 791 }
<> 149:156823d33999 792 _ops = func._ops;
<> 149:156823d33999 793 }
<> 149:156823d33999 794
<> 149:156823d33999 795 /** Create a Callback with a member function
<> 149:156823d33999 796 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 797 * @param method Member function to attach
<> 149:156823d33999 798 */
<> 149:156823d33999 799 template<typename T>
<> 149:156823d33999 800 Callback(T *obj, R (T::*method)(A0)) {
<> 149:156823d33999 801 generate(method_context<T, R (T::*)(A0)>(obj, method));
<> 149:156823d33999 802 }
<> 149:156823d33999 803
<> 149:156823d33999 804 /** Create a Callback with a member function
<> 149:156823d33999 805 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 806 * @param method Member function to attach
<> 149:156823d33999 807 */
<> 149:156823d33999 808 template<typename T>
<> 149:156823d33999 809 Callback(const T *obj, R (T::*method)(A0) const) {
<> 149:156823d33999 810 generate(method_context<const T, R (T::*)(A0) const>(obj, method));
<> 149:156823d33999 811 }
<> 149:156823d33999 812
<> 149:156823d33999 813 /** Create a Callback with a member function
<> 149:156823d33999 814 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 815 * @param method Member function to attach
<> 149:156823d33999 816 */
<> 149:156823d33999 817 template<typename T>
<> 149:156823d33999 818 Callback(volatile T *obj, R (T::*method)(A0) volatile) {
<> 149:156823d33999 819 generate(method_context<volatile T, R (T::*)(A0) volatile>(obj, method));
<> 149:156823d33999 820 }
<> 149:156823d33999 821
<> 149:156823d33999 822 /** Create a Callback with a member function
<> 149:156823d33999 823 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 824 * @param method Member function to attach
<> 149:156823d33999 825 */
<> 149:156823d33999 826 template<typename T>
<> 149:156823d33999 827 Callback(const volatile T *obj, R (T::*method)(A0) const volatile) {
<> 149:156823d33999 828 generate(method_context<const volatile T, R (T::*)(A0) const volatile>(obj, method));
<> 149:156823d33999 829 }
<> 149:156823d33999 830
<> 149:156823d33999 831 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 832 * @param func Static function to attach
<> 149:156823d33999 833 * @param arg Pointer argument to function
<> 149:156823d33999 834 */
<> 149:156823d33999 835 Callback(R (*func)(void*, A0), void *arg) {
<> 149:156823d33999 836 generate(function_context<R (*)(void*, A0), void>(func, arg));
<> 149:156823d33999 837 }
<> 149:156823d33999 838
<> 149:156823d33999 839 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 840 * @param func Static function to attach
<> 149:156823d33999 841 * @param arg Pointer argument to function
<> 149:156823d33999 842 */
<> 149:156823d33999 843 Callback(R (*func)(const void*, A0), const void *arg) {
<> 149:156823d33999 844 generate(function_context<R (*)(const void*, A0), const void>(func, arg));
<> 149:156823d33999 845 }
<> 149:156823d33999 846
<> 149:156823d33999 847 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 848 * @param func Static function to attach
<> 149:156823d33999 849 * @param arg Pointer argument to function
<> 149:156823d33999 850 */
<> 149:156823d33999 851 Callback(R (*func)(volatile void*, A0), volatile void *arg) {
<> 149:156823d33999 852 generate(function_context<R (*)(volatile void*, A0), volatile void>(func, arg));
<> 149:156823d33999 853 }
<> 149:156823d33999 854
<> 149:156823d33999 855 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 856 * @param func Static function to attach
<> 149:156823d33999 857 * @param arg Pointer argument to function
<> 149:156823d33999 858 */
<> 149:156823d33999 859 Callback(R (*func)(const volatile void*, A0), const volatile void *arg) {
<> 149:156823d33999 860 generate(function_context<R (*)(const volatile void*, A0), const volatile void>(func, arg));
<> 149:156823d33999 861 }
<> 149:156823d33999 862
<> 149:156823d33999 863 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 864 * @param func Static function to attach
<> 149:156823d33999 865 * @param arg Pointer argument to function
<> 149:156823d33999 866 */
<> 149:156823d33999 867 template<typename T>
<> 149:156823d33999 868 Callback(R (*func)(T*, A0), T *arg) {
<> 149:156823d33999 869 generate(function_context<R (*)(T*, A0), T>(func, arg));
<> 149:156823d33999 870 }
<> 149:156823d33999 871
<> 149:156823d33999 872 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 873 * @param func Static function to attach
<> 149:156823d33999 874 * @param arg Pointer argument to function
<> 149:156823d33999 875 */
<> 149:156823d33999 876 template<typename T>
<> 149:156823d33999 877 Callback(R (*func)(const T*, A0), const T *arg) {
<> 149:156823d33999 878 generate(function_context<R (*)(const T*, A0), const T>(func, arg));
<> 149:156823d33999 879 }
<> 149:156823d33999 880
<> 149:156823d33999 881 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 882 * @param func Static function to attach
<> 149:156823d33999 883 * @param arg Pointer argument to function
<> 149:156823d33999 884 */
<> 149:156823d33999 885 template<typename T>
<> 149:156823d33999 886 Callback(R (*func)(volatile T*, A0), volatile T *arg) {
<> 149:156823d33999 887 generate(function_context<R (*)(volatile T*, A0), volatile T>(func, arg));
<> 149:156823d33999 888 }
<> 149:156823d33999 889
<> 149:156823d33999 890 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 891 * @param func Static function to attach
<> 149:156823d33999 892 * @param arg Pointer argument to function
<> 149:156823d33999 893 */
<> 149:156823d33999 894 template<typename T>
<> 149:156823d33999 895 Callback(R (*func)(const volatile T*, A0), const volatile T *arg) {
<> 149:156823d33999 896 generate(function_context<R (*)(const volatile T*, A0), const volatile T>(func, arg));
<> 149:156823d33999 897 }
<> 149:156823d33999 898
<> 149:156823d33999 899 /** Create a Callback with a function object
<> 149:156823d33999 900 * @param func Function object to attach
<> 149:156823d33999 901 * @note The function object is limited to a single word of storage
<> 149:156823d33999 902 */
<> 149:156823d33999 903 template <typename F>
<> 149:156823d33999 904 Callback(F f, typename detail::enable_if<
<> 149:156823d33999 905 detail::is_type<R (F::*)(A0), &F::operator()>::value &&
<> 149:156823d33999 906 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 907 >::type = detail::nil()) {
<> 149:156823d33999 908 generate(f);
<> 149:156823d33999 909 }
<> 149:156823d33999 910
<> 149:156823d33999 911 /** Create a Callback with a function object
<> 149:156823d33999 912 * @param func Function object to attach
<> 149:156823d33999 913 * @note The function object is limited to a single word of storage
<> 149:156823d33999 914 */
<> 149:156823d33999 915 template <typename F>
<> 149:156823d33999 916 Callback(const F f, typename detail::enable_if<
<> 149:156823d33999 917 detail::is_type<R (F::*)(A0) const, &F::operator()>::value &&
<> 149:156823d33999 918 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 919 >::type = detail::nil()) {
<> 149:156823d33999 920 generate(f);
<> 149:156823d33999 921 }
<> 149:156823d33999 922
<> 149:156823d33999 923 /** Create a Callback with a function object
<> 149:156823d33999 924 * @param func Function object to attach
<> 149:156823d33999 925 * @note The function object is limited to a single word of storage
<> 149:156823d33999 926 */
<> 149:156823d33999 927 template <typename F>
<> 149:156823d33999 928 Callback(volatile F f, typename detail::enable_if<
<> 149:156823d33999 929 detail::is_type<R (F::*)(A0) volatile, &F::operator()>::value &&
<> 149:156823d33999 930 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 931 >::type = detail::nil()) {
<> 149:156823d33999 932 generate(f);
<> 149:156823d33999 933 }
<> 149:156823d33999 934
<> 149:156823d33999 935 /** Create a Callback with a function object
<> 149:156823d33999 936 * @param func Function object to attach
<> 149:156823d33999 937 * @note The function object is limited to a single word of storage
<> 149:156823d33999 938 */
<> 149:156823d33999 939 template <typename F>
<> 149:156823d33999 940 Callback(const volatile F f, typename detail::enable_if<
<> 149:156823d33999 941 detail::is_type<R (F::*)(A0) const volatile, &F::operator()>::value &&
<> 149:156823d33999 942 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 943 >::type = detail::nil()) {
<> 149:156823d33999 944 generate(f);
<> 149:156823d33999 945 }
<> 149:156823d33999 946
<> 149:156823d33999 947 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 948 * @param obj Pointer to object to bind to function
<> 149:156823d33999 949 * @param func Static function to attach
<> 149:156823d33999 950 * @deprecated
<> 149:156823d33999 951 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 952 */
<> 149:156823d33999 953 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 954 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 955 Callback(void *obj, R (*func)(void*, A0)) {
<> 149:156823d33999 956 new (this) Callback(func, obj);
<> 149:156823d33999 957 }
<> 149:156823d33999 958
<> 149:156823d33999 959 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 960 * @param obj Pointer to object to bind to function
<> 149:156823d33999 961 * @param func Static function to attach
<> 149:156823d33999 962 * @deprecated
<> 149:156823d33999 963 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 964 */
<> 149:156823d33999 965 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 966 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 967 Callback(const void *obj, R (*func)(const void*, A0)) {
<> 149:156823d33999 968 new (this) Callback(func, obj);
<> 149:156823d33999 969 }
<> 149:156823d33999 970
<> 149:156823d33999 971 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 972 * @param obj Pointer to object to bind to function
<> 149:156823d33999 973 * @param func Static function to attach
<> 149:156823d33999 974 * @deprecated
<> 149:156823d33999 975 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 976 */
<> 149:156823d33999 977 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 978 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 979 Callback(volatile void *obj, R (*func)(volatile void*, A0)) {
<> 149:156823d33999 980 new (this) Callback(func, obj);
<> 149:156823d33999 981 }
<> 149:156823d33999 982
<> 149:156823d33999 983 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 984 * @param obj Pointer to object to bind to function
<> 149:156823d33999 985 * @param func Static function to attach
<> 149:156823d33999 986 * @deprecated
<> 149:156823d33999 987 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 988 */
<> 149:156823d33999 989 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 990 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 991 Callback(const volatile void *obj, R (*func)(const volatile void*, A0)) {
<> 149:156823d33999 992 new (this) Callback(func, obj);
<> 149:156823d33999 993 }
<> 149:156823d33999 994
<> 149:156823d33999 995 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 996 * @param obj Pointer to object to bind to function
<> 149:156823d33999 997 * @param func Static function to attach
<> 149:156823d33999 998 * @deprecated
<> 149:156823d33999 999 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 1000 */
<> 149:156823d33999 1001 template<typename T>
<> 149:156823d33999 1002 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1003 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 1004 Callback(T *obj, R (*func)(T*, A0)) {
<> 149:156823d33999 1005 new (this) Callback(func, obj);
<> 149:156823d33999 1006 }
<> 149:156823d33999 1007
<> 149:156823d33999 1008 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1009 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1010 * @param func Static function to attach
<> 149:156823d33999 1011 * @deprecated
<> 149:156823d33999 1012 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 1013 */
<> 149:156823d33999 1014 template<typename T>
<> 149:156823d33999 1015 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1016 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 1017 Callback(const T *obj, R (*func)(const T*, A0)) {
<> 149:156823d33999 1018 new (this) Callback(func, obj);
<> 149:156823d33999 1019 }
<> 149:156823d33999 1020
<> 149:156823d33999 1021 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1022 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1023 * @param func Static function to attach
<> 149:156823d33999 1024 * @deprecated
<> 149:156823d33999 1025 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 1026 */
<> 149:156823d33999 1027 template<typename T>
<> 149:156823d33999 1028 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1029 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 1030 Callback(volatile T *obj, R (*func)(volatile T*, A0)) {
<> 149:156823d33999 1031 new (this) Callback(func, obj);
<> 149:156823d33999 1032 }
<> 149:156823d33999 1033
<> 149:156823d33999 1034 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1035 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1036 * @param func Static function to attach
<> 149:156823d33999 1037 * @deprecated
<> 149:156823d33999 1038 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 1039 */
<> 149:156823d33999 1040 template<typename T>
<> 149:156823d33999 1041 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1042 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 1043 Callback(const volatile T *obj, R (*func)(const volatile T*, A0)) {
<> 149:156823d33999 1044 new (this) Callback(func, obj);
<> 149:156823d33999 1045 }
<> 149:156823d33999 1046
<> 149:156823d33999 1047 /** Destroy a callback
<> 149:156823d33999 1048 */
<> 149:156823d33999 1049 ~Callback() {
<> 149:156823d33999 1050 if (_ops) {
<> 149:156823d33999 1051 _ops->dtor(this);
<> 149:156823d33999 1052 }
<> 149:156823d33999 1053 }
<> 149:156823d33999 1054
<> 149:156823d33999 1055 /** Attach a static function
<> 149:156823d33999 1056 * @param func Static function to attach
<> 149:156823d33999 1057 */
<> 149:156823d33999 1058 void attach(R (*func)(A0)) {
<> 149:156823d33999 1059 this->~Callback();
<> 149:156823d33999 1060 new (this) Callback(func);
<> 149:156823d33999 1061 }
<> 149:156823d33999 1062
<> 149:156823d33999 1063 /** Attach a Callback
<> 149:156823d33999 1064 * @param func The Callback to attach
<> 149:156823d33999 1065 */
<> 149:156823d33999 1066 void attach(const Callback<R(A0)> &func) {
<> 149:156823d33999 1067 this->~Callback();
<> 149:156823d33999 1068 new (this) Callback(func);
<> 149:156823d33999 1069 }
<> 149:156823d33999 1070
<> 149:156823d33999 1071 /** Attach a member function
<> 149:156823d33999 1072 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 1073 * @param method Member function to attach
<> 149:156823d33999 1074 */
<> 149:156823d33999 1075 template<typename T>
<> 149:156823d33999 1076 void attach(T *obj, R (T::*method)(A0)) {
<> 149:156823d33999 1077 this->~Callback();
<> 149:156823d33999 1078 new (this) Callback(obj, method);
<> 149:156823d33999 1079 }
<> 149:156823d33999 1080
<> 149:156823d33999 1081 /** Attach a member function
<> 149:156823d33999 1082 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 1083 * @param method Member function to attach
<> 149:156823d33999 1084 */
<> 149:156823d33999 1085 template<typename T>
<> 149:156823d33999 1086 void attach(const T *obj, R (T::*method)(A0) const) {
<> 149:156823d33999 1087 this->~Callback();
<> 149:156823d33999 1088 new (this) Callback(obj, method);
<> 149:156823d33999 1089 }
<> 149:156823d33999 1090
<> 149:156823d33999 1091 /** Attach a member function
<> 149:156823d33999 1092 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 1093 * @param method Member function to attach
<> 149:156823d33999 1094 */
<> 149:156823d33999 1095 template<typename T>
<> 149:156823d33999 1096 void attach(volatile T *obj, R (T::*method)(A0) volatile) {
<> 149:156823d33999 1097 this->~Callback();
<> 149:156823d33999 1098 new (this) Callback(obj, method);
<> 149:156823d33999 1099 }
<> 149:156823d33999 1100
<> 149:156823d33999 1101 /** Attach a member function
<> 149:156823d33999 1102 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 1103 * @param method Member function to attach
<> 149:156823d33999 1104 */
<> 149:156823d33999 1105 template<typename T>
<> 149:156823d33999 1106 void attach(const volatile T *obj, R (T::*method)(A0) const volatile) {
<> 149:156823d33999 1107 this->~Callback();
<> 149:156823d33999 1108 new (this) Callback(obj, method);
<> 149:156823d33999 1109 }
<> 149:156823d33999 1110
<> 149:156823d33999 1111 /** Attach a static function with a bound pointer
<> 149:156823d33999 1112 * @param func Static function to attach
<> 149:156823d33999 1113 * @param arg Pointer argument to function
<> 149:156823d33999 1114 */
<> 149:156823d33999 1115 void attach(R (*func)(void*, A0), void *arg) {
<> 149:156823d33999 1116 this->~Callback();
<> 149:156823d33999 1117 new (this) Callback(func, arg);
<> 149:156823d33999 1118 }
<> 149:156823d33999 1119
<> 149:156823d33999 1120 /** Attach a static function with a bound pointer
<> 149:156823d33999 1121 * @param func Static function to attach
<> 149:156823d33999 1122 * @param arg Pointer argument to function
<> 149:156823d33999 1123 */
<> 149:156823d33999 1124 void attach(R (*func)(const void*, A0), const void *arg) {
<> 149:156823d33999 1125 this->~Callback();
<> 149:156823d33999 1126 new (this) Callback(func, arg);
<> 149:156823d33999 1127 }
<> 149:156823d33999 1128
<> 149:156823d33999 1129 /** Attach a static function with a bound pointer
<> 149:156823d33999 1130 * @param func Static function to attach
<> 149:156823d33999 1131 * @param arg Pointer argument to function
<> 149:156823d33999 1132 */
<> 149:156823d33999 1133 void attach(R (*func)(volatile void*, A0), volatile void *arg) {
<> 149:156823d33999 1134 this->~Callback();
<> 149:156823d33999 1135 new (this) Callback(func, arg);
<> 149:156823d33999 1136 }
<> 149:156823d33999 1137
<> 149:156823d33999 1138 /** Attach a static function with a bound pointer
<> 149:156823d33999 1139 * @param func Static function to attach
<> 149:156823d33999 1140 * @param arg Pointer argument to function
<> 149:156823d33999 1141 */
<> 149:156823d33999 1142 void attach(R (*func)(const volatile void*, A0), const volatile void *arg) {
<> 149:156823d33999 1143 this->~Callback();
<> 149:156823d33999 1144 new (this) Callback(func, arg);
<> 149:156823d33999 1145 }
<> 149:156823d33999 1146
<> 149:156823d33999 1147 /** Attach a static function with a bound pointer
<> 149:156823d33999 1148 * @param func Static function to attach
<> 149:156823d33999 1149 * @param arg Pointer argument to function
<> 149:156823d33999 1150 */
<> 149:156823d33999 1151 template <typename T>
<> 149:156823d33999 1152 void attach(R (*func)(T*, A0), T *arg) {
<> 149:156823d33999 1153 this->~Callback();
<> 149:156823d33999 1154 new (this) Callback(func, arg);
<> 149:156823d33999 1155 }
<> 149:156823d33999 1156
<> 149:156823d33999 1157 /** Attach a static function with a bound pointer
<> 149:156823d33999 1158 * @param func Static function to attach
<> 149:156823d33999 1159 * @param arg Pointer argument to function
<> 149:156823d33999 1160 */
<> 149:156823d33999 1161 template <typename T>
<> 149:156823d33999 1162 void attach(R (*func)(const T*, A0), const T *arg) {
<> 149:156823d33999 1163 this->~Callback();
<> 149:156823d33999 1164 new (this) Callback(func, arg);
<> 149:156823d33999 1165 }
<> 149:156823d33999 1166
<> 149:156823d33999 1167 /** Attach a static function with a bound pointer
<> 149:156823d33999 1168 * @param func Static function to attach
<> 149:156823d33999 1169 * @param arg Pointer argument to function
<> 149:156823d33999 1170 */
<> 149:156823d33999 1171 template <typename T>
<> 149:156823d33999 1172 void attach(R (*func)(volatile T*, A0), volatile T *arg) {
<> 149:156823d33999 1173 this->~Callback();
<> 149:156823d33999 1174 new (this) Callback(func, arg);
<> 149:156823d33999 1175 }
<> 149:156823d33999 1176
<> 149:156823d33999 1177 /** Attach a static function with a bound pointer
<> 149:156823d33999 1178 * @param func Static function to attach
<> 149:156823d33999 1179 * @param arg Pointer argument to function
<> 149:156823d33999 1180 */
<> 149:156823d33999 1181 template <typename T>
<> 149:156823d33999 1182 void attach(R (*func)(const volatile T*, A0), const volatile T *arg) {
<> 149:156823d33999 1183 this->~Callback();
<> 149:156823d33999 1184 new (this) Callback(func, arg);
<> 149:156823d33999 1185 }
<> 149:156823d33999 1186
<> 149:156823d33999 1187 /** Attach a function object
<> 149:156823d33999 1188 * @param func Function object to attach
<> 149:156823d33999 1189 * @note The function object is limited to a single word of storage
<> 149:156823d33999 1190 */
<> 149:156823d33999 1191 template <typename F>
<> 149:156823d33999 1192 void attach(F f, typename detail::enable_if<
<> 149:156823d33999 1193 detail::is_type<R (F::*)(A0), &F::operator()>::value &&
<> 149:156823d33999 1194 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 1195 >::type = detail::nil()) {
<> 149:156823d33999 1196 this->~Callback();
<> 149:156823d33999 1197 new (this) Callback(f);
<> 149:156823d33999 1198 }
<> 149:156823d33999 1199
<> 149:156823d33999 1200 /** Attach a function object
<> 149:156823d33999 1201 * @param func Function object to attach
<> 149:156823d33999 1202 * @note The function object is limited to a single word of storage
<> 149:156823d33999 1203 */
<> 149:156823d33999 1204 template <typename F>
<> 149:156823d33999 1205 void attach(const F f, typename detail::enable_if<
<> 149:156823d33999 1206 detail::is_type<R (F::*)(A0) const, &F::operator()>::value &&
<> 149:156823d33999 1207 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 1208 >::type = detail::nil()) {
<> 149:156823d33999 1209 this->~Callback();
<> 149:156823d33999 1210 new (this) Callback(f);
<> 149:156823d33999 1211 }
<> 149:156823d33999 1212
<> 149:156823d33999 1213 /** Attach a function object
<> 149:156823d33999 1214 * @param func Function object to attach
<> 149:156823d33999 1215 * @note The function object is limited to a single word of storage
<> 149:156823d33999 1216 */
<> 149:156823d33999 1217 template <typename F>
<> 149:156823d33999 1218 void attach(volatile F f, typename detail::enable_if<
<> 149:156823d33999 1219 detail::is_type<R (F::*)(A0) volatile, &F::operator()>::value &&
<> 149:156823d33999 1220 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 1221 >::type = detail::nil()) {
<> 149:156823d33999 1222 this->~Callback();
<> 149:156823d33999 1223 new (this) Callback(f);
<> 149:156823d33999 1224 }
<> 149:156823d33999 1225
<> 149:156823d33999 1226 /** Attach a function object
<> 149:156823d33999 1227 * @param func Function object to attach
<> 149:156823d33999 1228 * @note The function object is limited to a single word of storage
<> 149:156823d33999 1229 */
<> 149:156823d33999 1230 template <typename F>
<> 149:156823d33999 1231 void attach(const volatile F f, typename detail::enable_if<
<> 149:156823d33999 1232 detail::is_type<R (F::*)(A0) const volatile, &F::operator()>::value &&
<> 149:156823d33999 1233 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 1234 >::type = detail::nil()) {
<> 149:156823d33999 1235 this->~Callback();
<> 149:156823d33999 1236 new (this) Callback(f);
<> 149:156823d33999 1237 }
<> 149:156823d33999 1238
<> 149:156823d33999 1239 /** Attach a static function with a bound pointer
<> 149:156823d33999 1240 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1241 * @param func Static function to attach
<> 149:156823d33999 1242 * @deprecated
<> 149:156823d33999 1243 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 1244 */
<> 149:156823d33999 1245 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1246 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 1247 void attach(void *obj, R (*func)(void*, A0)) {
<> 149:156823d33999 1248 this->~Callback();
<> 149:156823d33999 1249 new (this) Callback(func, obj);
<> 149:156823d33999 1250 }
<> 149:156823d33999 1251
<> 149:156823d33999 1252 /** Attach a static function with a bound pointer
<> 149:156823d33999 1253 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1254 * @param func Static function to attach
<> 149:156823d33999 1255 * @deprecated
<> 149:156823d33999 1256 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 1257 */
<> 149:156823d33999 1258 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1259 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 1260 void attach(const void *obj, R (*func)(const void*, A0)) {
<> 149:156823d33999 1261 this->~Callback();
<> 149:156823d33999 1262 new (this) Callback(func, obj);
<> 149:156823d33999 1263 }
<> 149:156823d33999 1264
<> 149:156823d33999 1265 /** Attach a static function with a bound pointer
<> 149:156823d33999 1266 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1267 * @param func Static function to attach
<> 149:156823d33999 1268 * @deprecated
<> 149:156823d33999 1269 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 1270 */
<> 149:156823d33999 1271 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1272 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 1273 void attach(volatile void *obj, R (*func)(volatile void*, A0)) {
<> 149:156823d33999 1274 this->~Callback();
<> 149:156823d33999 1275 new (this) Callback(func, obj);
<> 149:156823d33999 1276 }
<> 149:156823d33999 1277
<> 149:156823d33999 1278 /** Attach a static function with a bound pointer
<> 149:156823d33999 1279 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1280 * @param func Static function to attach
<> 149:156823d33999 1281 * @deprecated
<> 149:156823d33999 1282 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 1283 */
<> 149:156823d33999 1284 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1285 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 1286 void attach(const volatile void *obj, R (*func)(const volatile void*, A0)) {
<> 149:156823d33999 1287 this->~Callback();
<> 149:156823d33999 1288 new (this) Callback(func, obj);
<> 149:156823d33999 1289 }
<> 149:156823d33999 1290
<> 149:156823d33999 1291 /** Attach a static function with a bound pointer
<> 149:156823d33999 1292 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1293 * @param func Static function to attach
<> 149:156823d33999 1294 * @deprecated
<> 149:156823d33999 1295 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 1296 */
<> 149:156823d33999 1297 template <typename T>
<> 149:156823d33999 1298 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1299 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 1300 void attach(T *obj, R (*func)(T*, A0)) {
<> 149:156823d33999 1301 this->~Callback();
<> 149:156823d33999 1302 new (this) Callback(func, obj);
<> 149:156823d33999 1303 }
<> 149:156823d33999 1304
<> 149:156823d33999 1305 /** Attach a static function with a bound pointer
<> 149:156823d33999 1306 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1307 * @param func Static function to attach
<> 149:156823d33999 1308 * @deprecated
<> 149:156823d33999 1309 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 1310 */
<> 149:156823d33999 1311 template <typename T>
<> 149:156823d33999 1312 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1313 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 1314 void attach(const T *obj, R (*func)(const T*, A0)) {
<> 149:156823d33999 1315 this->~Callback();
<> 149:156823d33999 1316 new (this) Callback(func, obj);
<> 149:156823d33999 1317 }
<> 149:156823d33999 1318
<> 149:156823d33999 1319 /** Attach a static function with a bound pointer
<> 149:156823d33999 1320 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1321 * @param func Static function to attach
<> 149:156823d33999 1322 * @deprecated
<> 149:156823d33999 1323 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 1324 */
<> 149:156823d33999 1325 template <typename T>
<> 149:156823d33999 1326 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1327 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 1328 void attach(volatile T *obj, R (*func)(volatile T*, A0)) {
<> 149:156823d33999 1329 this->~Callback();
<> 149:156823d33999 1330 new (this) Callback(func, obj);
<> 149:156823d33999 1331 }
<> 149:156823d33999 1332
<> 149:156823d33999 1333 /** Attach a static function with a bound pointer
<> 149:156823d33999 1334 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1335 * @param func Static function to attach
<> 149:156823d33999 1336 * @deprecated
<> 149:156823d33999 1337 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 1338 */
<> 149:156823d33999 1339 template <typename T>
<> 149:156823d33999 1340 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1341 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 1342 void attach(const volatile T *obj, R (*func)(const volatile T*, A0)) {
<> 149:156823d33999 1343 this->~Callback();
<> 149:156823d33999 1344 new (this) Callback(func, obj);
<> 149:156823d33999 1345 }
<> 149:156823d33999 1346
<> 149:156823d33999 1347 /** Assign a callback
<> 149:156823d33999 1348 */
<> 149:156823d33999 1349 Callback &operator=(const Callback &that) {
<> 149:156823d33999 1350 if (this != &that) {
<> 149:156823d33999 1351 this->~Callback();
<> 149:156823d33999 1352 new (this) Callback(that);
<> 149:156823d33999 1353 }
<> 149:156823d33999 1354
<> 149:156823d33999 1355 return *this;
<> 149:156823d33999 1356 }
<> 149:156823d33999 1357
<> 149:156823d33999 1358 /** Call the attached function
<> 149:156823d33999 1359 */
<> 149:156823d33999 1360 R call(A0 a0) const {
<> 149:156823d33999 1361 MBED_ASSERT(_ops);
<> 149:156823d33999 1362 return _ops->call(this, a0);
<> 149:156823d33999 1363 }
<> 149:156823d33999 1364
<> 149:156823d33999 1365 /** Call the attached function
<> 149:156823d33999 1366 */
<> 149:156823d33999 1367 R operator()(A0 a0) const {
<> 149:156823d33999 1368 return call(a0);
<> 149:156823d33999 1369 }
<> 149:156823d33999 1370
<> 149:156823d33999 1371 /** Test if function has been attached
<> 149:156823d33999 1372 */
<> 149:156823d33999 1373 operator bool() const {
<> 149:156823d33999 1374 return _ops;
<> 149:156823d33999 1375 }
<> 149:156823d33999 1376
<> 149:156823d33999 1377 /** Test for equality
<> 149:156823d33999 1378 */
<> 149:156823d33999 1379 friend bool operator==(const Callback &l, const Callback &r) {
<> 149:156823d33999 1380 return memcmp(&l, &r, sizeof(Callback)) == 0;
<> 149:156823d33999 1381 }
<> 149:156823d33999 1382
<> 149:156823d33999 1383 /** Test for inequality
<> 149:156823d33999 1384 */
<> 149:156823d33999 1385 friend bool operator!=(const Callback &l, const Callback &r) {
<> 149:156823d33999 1386 return !(l == r);
<> 149:156823d33999 1387 }
<> 149:156823d33999 1388
<> 149:156823d33999 1389 /** Static thunk for passing as C-style function
<> 149:156823d33999 1390 * @param func Callback to call passed as void pointer
<> 149:156823d33999 1391 */
<> 149:156823d33999 1392 static R thunk(void *func, A0 a0) {
<> 149:156823d33999 1393 return static_cast<Callback*>(func)->call(a0);
<> 149:156823d33999 1394 }
<> 149:156823d33999 1395
<> 149:156823d33999 1396 private:
<> 149:156823d33999 1397 // Stored as pointer to function and pointer to optional object
<> 149:156823d33999 1398 // Function pointer is stored as union of possible function types
<> 149:156823d33999 1399 // to garuntee proper size and alignment
<> 149:156823d33999 1400 struct _class;
<> 149:156823d33999 1401 union {
<> 149:156823d33999 1402 void (*_staticfunc)(A0);
<> 149:156823d33999 1403 void (*_boundfunc)(_class*, A0);
<> 149:156823d33999 1404 void (_class::*_methodfunc)(A0);
<> 149:156823d33999 1405 } _func;
<> 149:156823d33999 1406 void *_obj;
<> 149:156823d33999 1407
<> 149:156823d33999 1408 // Dynamically dispatched operations
<> 149:156823d33999 1409 const struct ops {
<> 149:156823d33999 1410 R (*call)(const void*, A0);
<> 149:156823d33999 1411 void (*move)(void*, const void*);
<> 149:156823d33999 1412 void (*dtor)(void*);
<> 149:156823d33999 1413 } *_ops;
<> 149:156823d33999 1414
<> 149:156823d33999 1415 // Generate operations for function object
<> 149:156823d33999 1416 template <typename F>
<> 149:156823d33999 1417 void generate(const F &f) {
<> 149:156823d33999 1418 static const ops ops = {
<> 149:156823d33999 1419 &Callback::function_call<F>,
<> 149:156823d33999 1420 &Callback::function_move<F>,
<> 149:156823d33999 1421 &Callback::function_dtor<F>,
<> 149:156823d33999 1422 };
<> 149:156823d33999 1423
<> 149:156823d33999 1424 MBED_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F));
<> 149:156823d33999 1425 new (this) F(f);
<> 149:156823d33999 1426 _ops = &ops;
<> 149:156823d33999 1427 }
<> 149:156823d33999 1428
<> 149:156823d33999 1429 // Function attributes
<> 149:156823d33999 1430 template <typename F>
<> 149:156823d33999 1431 static R function_call(const void *p, A0 a0) {
<> 149:156823d33999 1432 return (*(F*)p)(a0);
<> 149:156823d33999 1433 }
<> 149:156823d33999 1434
<> 149:156823d33999 1435 template <typename F>
<> 149:156823d33999 1436 static void function_move(void *d, const void *p) {
<> 149:156823d33999 1437 new (d) F(*(F*)p);
<> 149:156823d33999 1438 }
<> 149:156823d33999 1439
<> 149:156823d33999 1440 template <typename F>
<> 149:156823d33999 1441 static void function_dtor(void *p) {
<> 149:156823d33999 1442 ((F*)p)->~F();
<> 149:156823d33999 1443 }
<> 149:156823d33999 1444
<> 149:156823d33999 1445 // Wrappers for functions with context
<> 149:156823d33999 1446 template <typename O, typename M>
<> 149:156823d33999 1447 struct method_context {
<> 149:156823d33999 1448 M method;
<> 149:156823d33999 1449 O *obj;
<> 149:156823d33999 1450
<> 149:156823d33999 1451 method_context(O *obj, M method)
<> 149:156823d33999 1452 : method(method), obj(obj) {}
<> 149:156823d33999 1453
<> 149:156823d33999 1454 R operator()(A0 a0) const {
<> 149:156823d33999 1455 return (obj->*method)(a0);
<> 149:156823d33999 1456 }
<> 149:156823d33999 1457 };
<> 149:156823d33999 1458
<> 149:156823d33999 1459 template <typename F, typename A>
<> 149:156823d33999 1460 struct function_context {
<> 149:156823d33999 1461 F func;
<> 149:156823d33999 1462 A *arg;
<> 149:156823d33999 1463
<> 149:156823d33999 1464 function_context(F func, A *arg)
<> 149:156823d33999 1465 : func(func), arg(arg) {}
<> 149:156823d33999 1466
<> 149:156823d33999 1467 R operator()(A0 a0) const {
<> 149:156823d33999 1468 return func(arg, a0);
<> 149:156823d33999 1469 }
<> 149:156823d33999 1470 };
<> 149:156823d33999 1471 };
<> 149:156823d33999 1472
<> 149:156823d33999 1473 /** Callback class based on template specialization
<> 149:156823d33999 1474 *
<> 149:156823d33999 1475 * @Note Synchronization level: Not protected
<> 149:156823d33999 1476 */
<> 149:156823d33999 1477 template <typename R, typename A0, typename A1>
<> 149:156823d33999 1478 class Callback<R(A0, A1)> {
<> 149:156823d33999 1479 public:
<> 149:156823d33999 1480 /** Create a Callback with a static function
<> 149:156823d33999 1481 * @param func Static function to attach
<> 149:156823d33999 1482 */
<> 149:156823d33999 1483 Callback(R (*func)(A0, A1) = 0) {
<> 149:156823d33999 1484 if (!func) {
<> 149:156823d33999 1485 _ops = 0;
<> 149:156823d33999 1486 } else {
<> 149:156823d33999 1487 generate(func);
<> 149:156823d33999 1488 }
<> 149:156823d33999 1489 }
<> 149:156823d33999 1490
<> 149:156823d33999 1491 /** Attach a Callback
<> 149:156823d33999 1492 * @param func The Callback to attach
<> 149:156823d33999 1493 */
<> 149:156823d33999 1494 Callback(const Callback<R(A0, A1)> &func) {
<> 149:156823d33999 1495 if (func._ops) {
<> 149:156823d33999 1496 func._ops->move(this, &func);
<> 149:156823d33999 1497 }
<> 149:156823d33999 1498 _ops = func._ops;
<> 149:156823d33999 1499 }
<> 149:156823d33999 1500
<> 149:156823d33999 1501 /** Create a Callback with a member function
<> 149:156823d33999 1502 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 1503 * @param method Member function to attach
<> 149:156823d33999 1504 */
<> 149:156823d33999 1505 template<typename T>
<> 149:156823d33999 1506 Callback(T *obj, R (T::*method)(A0, A1)) {
<> 149:156823d33999 1507 generate(method_context<T, R (T::*)(A0, A1)>(obj, method));
<> 149:156823d33999 1508 }
<> 149:156823d33999 1509
<> 149:156823d33999 1510 /** Create a Callback with a member function
<> 149:156823d33999 1511 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 1512 * @param method Member function to attach
<> 149:156823d33999 1513 */
<> 149:156823d33999 1514 template<typename T>
<> 149:156823d33999 1515 Callback(const T *obj, R (T::*method)(A0, A1) const) {
<> 149:156823d33999 1516 generate(method_context<const T, R (T::*)(A0, A1) const>(obj, method));
<> 149:156823d33999 1517 }
<> 149:156823d33999 1518
<> 149:156823d33999 1519 /** Create a Callback with a member function
<> 149:156823d33999 1520 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 1521 * @param method Member function to attach
<> 149:156823d33999 1522 */
<> 149:156823d33999 1523 template<typename T>
<> 149:156823d33999 1524 Callback(volatile T *obj, R (T::*method)(A0, A1) volatile) {
<> 149:156823d33999 1525 generate(method_context<volatile T, R (T::*)(A0, A1) volatile>(obj, method));
<> 149:156823d33999 1526 }
<> 149:156823d33999 1527
<> 149:156823d33999 1528 /** Create a Callback with a member function
<> 149:156823d33999 1529 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 1530 * @param method Member function to attach
<> 149:156823d33999 1531 */
<> 149:156823d33999 1532 template<typename T>
<> 149:156823d33999 1533 Callback(const volatile T *obj, R (T::*method)(A0, A1) const volatile) {
<> 149:156823d33999 1534 generate(method_context<const volatile T, R (T::*)(A0, A1) const volatile>(obj, method));
<> 149:156823d33999 1535 }
<> 149:156823d33999 1536
<> 149:156823d33999 1537 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1538 * @param func Static function to attach
<> 149:156823d33999 1539 * @param arg Pointer argument to function
<> 149:156823d33999 1540 */
<> 149:156823d33999 1541 Callback(R (*func)(void*, A0, A1), void *arg) {
<> 149:156823d33999 1542 generate(function_context<R (*)(void*, A0, A1), void>(func, arg));
<> 149:156823d33999 1543 }
<> 149:156823d33999 1544
<> 149:156823d33999 1545 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1546 * @param func Static function to attach
<> 149:156823d33999 1547 * @param arg Pointer argument to function
<> 149:156823d33999 1548 */
<> 149:156823d33999 1549 Callback(R (*func)(const void*, A0, A1), const void *arg) {
<> 149:156823d33999 1550 generate(function_context<R (*)(const void*, A0, A1), const void>(func, arg));
<> 149:156823d33999 1551 }
<> 149:156823d33999 1552
<> 149:156823d33999 1553 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1554 * @param func Static function to attach
<> 149:156823d33999 1555 * @param arg Pointer argument to function
<> 149:156823d33999 1556 */
<> 149:156823d33999 1557 Callback(R (*func)(volatile void*, A0, A1), volatile void *arg) {
<> 149:156823d33999 1558 generate(function_context<R (*)(volatile void*, A0, A1), volatile void>(func, arg));
<> 149:156823d33999 1559 }
<> 149:156823d33999 1560
<> 149:156823d33999 1561 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1562 * @param func Static function to attach
<> 149:156823d33999 1563 * @param arg Pointer argument to function
<> 149:156823d33999 1564 */
<> 149:156823d33999 1565 Callback(R (*func)(const volatile void*, A0, A1), const volatile void *arg) {
<> 149:156823d33999 1566 generate(function_context<R (*)(const volatile void*, A0, A1), const volatile void>(func, arg));
<> 149:156823d33999 1567 }
<> 149:156823d33999 1568
<> 149:156823d33999 1569 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1570 * @param func Static function to attach
<> 149:156823d33999 1571 * @param arg Pointer argument to function
<> 149:156823d33999 1572 */
<> 149:156823d33999 1573 template<typename T>
<> 149:156823d33999 1574 Callback(R (*func)(T*, A0, A1), T *arg) {
<> 149:156823d33999 1575 generate(function_context<R (*)(T*, A0, A1), T>(func, arg));
<> 149:156823d33999 1576 }
<> 149:156823d33999 1577
<> 149:156823d33999 1578 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1579 * @param func Static function to attach
<> 149:156823d33999 1580 * @param arg Pointer argument to function
<> 149:156823d33999 1581 */
<> 149:156823d33999 1582 template<typename T>
<> 149:156823d33999 1583 Callback(R (*func)(const T*, A0, A1), const T *arg) {
<> 149:156823d33999 1584 generate(function_context<R (*)(const T*, A0, A1), const T>(func, arg));
<> 149:156823d33999 1585 }
<> 149:156823d33999 1586
<> 149:156823d33999 1587 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1588 * @param func Static function to attach
<> 149:156823d33999 1589 * @param arg Pointer argument to function
<> 149:156823d33999 1590 */
<> 149:156823d33999 1591 template<typename T>
<> 149:156823d33999 1592 Callback(R (*func)(volatile T*, A0, A1), volatile T *arg) {
<> 149:156823d33999 1593 generate(function_context<R (*)(volatile T*, A0, A1), volatile T>(func, arg));
<> 149:156823d33999 1594 }
<> 149:156823d33999 1595
<> 149:156823d33999 1596 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1597 * @param func Static function to attach
<> 149:156823d33999 1598 * @param arg Pointer argument to function
<> 149:156823d33999 1599 */
<> 149:156823d33999 1600 template<typename T>
<> 149:156823d33999 1601 Callback(R (*func)(const volatile T*, A0, A1), const volatile T *arg) {
<> 149:156823d33999 1602 generate(function_context<R (*)(const volatile T*, A0, A1), const volatile T>(func, arg));
<> 149:156823d33999 1603 }
<> 149:156823d33999 1604
<> 149:156823d33999 1605 /** Create a Callback with a function object
<> 149:156823d33999 1606 * @param func Function object to attach
<> 149:156823d33999 1607 * @note The function object is limited to a single word of storage
<> 149:156823d33999 1608 */
<> 149:156823d33999 1609 template <typename F>
<> 149:156823d33999 1610 Callback(F f, typename detail::enable_if<
<> 149:156823d33999 1611 detail::is_type<R (F::*)(A0, A1), &F::operator()>::value &&
<> 149:156823d33999 1612 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 1613 >::type = detail::nil()) {
<> 149:156823d33999 1614 generate(f);
<> 149:156823d33999 1615 }
<> 149:156823d33999 1616
<> 149:156823d33999 1617 /** Create a Callback with a function object
<> 149:156823d33999 1618 * @param func Function object to attach
<> 149:156823d33999 1619 * @note The function object is limited to a single word of storage
<> 149:156823d33999 1620 */
<> 149:156823d33999 1621 template <typename F>
<> 149:156823d33999 1622 Callback(const F f, typename detail::enable_if<
<> 149:156823d33999 1623 detail::is_type<R (F::*)(A0, A1) const, &F::operator()>::value &&
<> 149:156823d33999 1624 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 1625 >::type = detail::nil()) {
<> 149:156823d33999 1626 generate(f);
<> 149:156823d33999 1627 }
<> 149:156823d33999 1628
<> 149:156823d33999 1629 /** Create a Callback with a function object
<> 149:156823d33999 1630 * @param func Function object to attach
<> 149:156823d33999 1631 * @note The function object is limited to a single word of storage
<> 149:156823d33999 1632 */
<> 149:156823d33999 1633 template <typename F>
<> 149:156823d33999 1634 Callback(volatile F f, typename detail::enable_if<
<> 149:156823d33999 1635 detail::is_type<R (F::*)(A0, A1) volatile, &F::operator()>::value &&
<> 149:156823d33999 1636 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 1637 >::type = detail::nil()) {
<> 149:156823d33999 1638 generate(f);
<> 149:156823d33999 1639 }
<> 149:156823d33999 1640
<> 149:156823d33999 1641 /** Create a Callback with a function object
<> 149:156823d33999 1642 * @param func Function object to attach
<> 149:156823d33999 1643 * @note The function object is limited to a single word of storage
<> 149:156823d33999 1644 */
<> 149:156823d33999 1645 template <typename F>
<> 149:156823d33999 1646 Callback(const volatile F f, typename detail::enable_if<
<> 149:156823d33999 1647 detail::is_type<R (F::*)(A0, A1) const volatile, &F::operator()>::value &&
<> 149:156823d33999 1648 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 1649 >::type = detail::nil()) {
<> 149:156823d33999 1650 generate(f);
<> 149:156823d33999 1651 }
<> 149:156823d33999 1652
<> 149:156823d33999 1653 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1654 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1655 * @param func Static function to attach
<> 149:156823d33999 1656 * @deprecated
<> 149:156823d33999 1657 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 1658 */
<> 149:156823d33999 1659 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1660 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 1661 Callback(void *obj, R (*func)(void*, A0, A1)) {
<> 149:156823d33999 1662 new (this) Callback(func, obj);
<> 149:156823d33999 1663 }
<> 149:156823d33999 1664
<> 149:156823d33999 1665 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1666 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1667 * @param func Static function to attach
<> 149:156823d33999 1668 * @deprecated
<> 149:156823d33999 1669 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 1670 */
<> 149:156823d33999 1671 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1672 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 1673 Callback(const void *obj, R (*func)(const void*, A0, A1)) {
<> 149:156823d33999 1674 new (this) Callback(func, obj);
<> 149:156823d33999 1675 }
<> 149:156823d33999 1676
<> 149:156823d33999 1677 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1678 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1679 * @param func Static function to attach
<> 149:156823d33999 1680 * @deprecated
<> 149:156823d33999 1681 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 1682 */
<> 149:156823d33999 1683 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1684 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 1685 Callback(volatile void *obj, R (*func)(volatile void*, A0, A1)) {
<> 149:156823d33999 1686 new (this) Callback(func, obj);
<> 149:156823d33999 1687 }
<> 149:156823d33999 1688
<> 149:156823d33999 1689 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1690 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1691 * @param func Static function to attach
<> 149:156823d33999 1692 * @deprecated
<> 149:156823d33999 1693 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 1694 */
<> 149:156823d33999 1695 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1696 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 1697 Callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1)) {
<> 149:156823d33999 1698 new (this) Callback(func, obj);
<> 149:156823d33999 1699 }
<> 149:156823d33999 1700
<> 149:156823d33999 1701 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1702 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1703 * @param func Static function to attach
<> 149:156823d33999 1704 * @deprecated
<> 149:156823d33999 1705 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 1706 */
<> 149:156823d33999 1707 template<typename T>
<> 149:156823d33999 1708 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1709 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 1710 Callback(T *obj, R (*func)(T*, A0, A1)) {
<> 149:156823d33999 1711 new (this) Callback(func, obj);
<> 149:156823d33999 1712 }
<> 149:156823d33999 1713
<> 149:156823d33999 1714 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1715 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1716 * @param func Static function to attach
<> 149:156823d33999 1717 * @deprecated
<> 149:156823d33999 1718 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 1719 */
<> 149:156823d33999 1720 template<typename T>
<> 149:156823d33999 1721 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1722 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 1723 Callback(const T *obj, R (*func)(const T*, A0, A1)) {
<> 149:156823d33999 1724 new (this) Callback(func, obj);
<> 149:156823d33999 1725 }
<> 149:156823d33999 1726
<> 149:156823d33999 1727 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1728 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1729 * @param func Static function to attach
<> 149:156823d33999 1730 * @deprecated
<> 149:156823d33999 1731 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 1732 */
<> 149:156823d33999 1733 template<typename T>
<> 149:156823d33999 1734 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1735 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 1736 Callback(volatile T *obj, R (*func)(volatile T*, A0, A1)) {
<> 149:156823d33999 1737 new (this) Callback(func, obj);
<> 149:156823d33999 1738 }
<> 149:156823d33999 1739
<> 149:156823d33999 1740 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 1741 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1742 * @param func Static function to attach
<> 149:156823d33999 1743 * @deprecated
<> 149:156823d33999 1744 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 1745 */
<> 149:156823d33999 1746 template<typename T>
<> 149:156823d33999 1747 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1748 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 1749 Callback(const volatile T *obj, R (*func)(const volatile T*, A0, A1)) {
<> 149:156823d33999 1750 new (this) Callback(func, obj);
<> 149:156823d33999 1751 }
<> 149:156823d33999 1752
<> 149:156823d33999 1753 /** Destroy a callback
<> 149:156823d33999 1754 */
<> 149:156823d33999 1755 ~Callback() {
<> 149:156823d33999 1756 if (_ops) {
<> 149:156823d33999 1757 _ops->dtor(this);
<> 149:156823d33999 1758 }
<> 149:156823d33999 1759 }
<> 149:156823d33999 1760
<> 149:156823d33999 1761 /** Attach a static function
<> 149:156823d33999 1762 * @param func Static function to attach
<> 149:156823d33999 1763 */
<> 149:156823d33999 1764 void attach(R (*func)(A0, A1)) {
<> 149:156823d33999 1765 this->~Callback();
<> 149:156823d33999 1766 new (this) Callback(func);
<> 149:156823d33999 1767 }
<> 149:156823d33999 1768
<> 149:156823d33999 1769 /** Attach a Callback
<> 149:156823d33999 1770 * @param func The Callback to attach
<> 149:156823d33999 1771 */
<> 149:156823d33999 1772 void attach(const Callback<R(A0, A1)> &func) {
<> 149:156823d33999 1773 this->~Callback();
<> 149:156823d33999 1774 new (this) Callback(func);
<> 149:156823d33999 1775 }
<> 149:156823d33999 1776
<> 149:156823d33999 1777 /** Attach a member function
<> 149:156823d33999 1778 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 1779 * @param method Member function to attach
<> 149:156823d33999 1780 */
<> 149:156823d33999 1781 template<typename T>
<> 149:156823d33999 1782 void attach(T *obj, R (T::*method)(A0, A1)) {
<> 149:156823d33999 1783 this->~Callback();
<> 149:156823d33999 1784 new (this) Callback(obj, method);
<> 149:156823d33999 1785 }
<> 149:156823d33999 1786
<> 149:156823d33999 1787 /** Attach a member function
<> 149:156823d33999 1788 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 1789 * @param method Member function to attach
<> 149:156823d33999 1790 */
<> 149:156823d33999 1791 template<typename T>
<> 149:156823d33999 1792 void attach(const T *obj, R (T::*method)(A0, A1) const) {
<> 149:156823d33999 1793 this->~Callback();
<> 149:156823d33999 1794 new (this) Callback(obj, method);
<> 149:156823d33999 1795 }
<> 149:156823d33999 1796
<> 149:156823d33999 1797 /** Attach a member function
<> 149:156823d33999 1798 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 1799 * @param method Member function to attach
<> 149:156823d33999 1800 */
<> 149:156823d33999 1801 template<typename T>
<> 149:156823d33999 1802 void attach(volatile T *obj, R (T::*method)(A0, A1) volatile) {
<> 149:156823d33999 1803 this->~Callback();
<> 149:156823d33999 1804 new (this) Callback(obj, method);
<> 149:156823d33999 1805 }
<> 149:156823d33999 1806
<> 149:156823d33999 1807 /** Attach a member function
<> 149:156823d33999 1808 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 1809 * @param method Member function to attach
<> 149:156823d33999 1810 */
<> 149:156823d33999 1811 template<typename T>
<> 149:156823d33999 1812 void attach(const volatile T *obj, R (T::*method)(A0, A1) const volatile) {
<> 149:156823d33999 1813 this->~Callback();
<> 149:156823d33999 1814 new (this) Callback(obj, method);
<> 149:156823d33999 1815 }
<> 149:156823d33999 1816
<> 149:156823d33999 1817 /** Attach a static function with a bound pointer
<> 149:156823d33999 1818 * @param func Static function to attach
<> 149:156823d33999 1819 * @param arg Pointer argument to function
<> 149:156823d33999 1820 */
<> 149:156823d33999 1821 void attach(R (*func)(void*, A0, A1), void *arg) {
<> 149:156823d33999 1822 this->~Callback();
<> 149:156823d33999 1823 new (this) Callback(func, arg);
<> 149:156823d33999 1824 }
<> 149:156823d33999 1825
<> 149:156823d33999 1826 /** Attach a static function with a bound pointer
<> 149:156823d33999 1827 * @param func Static function to attach
<> 149:156823d33999 1828 * @param arg Pointer argument to function
<> 149:156823d33999 1829 */
<> 149:156823d33999 1830 void attach(R (*func)(const void*, A0, A1), const void *arg) {
<> 149:156823d33999 1831 this->~Callback();
<> 149:156823d33999 1832 new (this) Callback(func, arg);
<> 149:156823d33999 1833 }
<> 149:156823d33999 1834
<> 149:156823d33999 1835 /** Attach a static function with a bound pointer
<> 149:156823d33999 1836 * @param func Static function to attach
<> 149:156823d33999 1837 * @param arg Pointer argument to function
<> 149:156823d33999 1838 */
<> 149:156823d33999 1839 void attach(R (*func)(volatile void*, A0, A1), volatile void *arg) {
<> 149:156823d33999 1840 this->~Callback();
<> 149:156823d33999 1841 new (this) Callback(func, arg);
<> 149:156823d33999 1842 }
<> 149:156823d33999 1843
<> 149:156823d33999 1844 /** Attach a static function with a bound pointer
<> 149:156823d33999 1845 * @param func Static function to attach
<> 149:156823d33999 1846 * @param arg Pointer argument to function
<> 149:156823d33999 1847 */
<> 149:156823d33999 1848 void attach(R (*func)(const volatile void*, A0, A1), const volatile void *arg) {
<> 149:156823d33999 1849 this->~Callback();
<> 149:156823d33999 1850 new (this) Callback(func, arg);
<> 149:156823d33999 1851 }
<> 149:156823d33999 1852
<> 149:156823d33999 1853 /** Attach a static function with a bound pointer
<> 149:156823d33999 1854 * @param func Static function to attach
<> 149:156823d33999 1855 * @param arg Pointer argument to function
<> 149:156823d33999 1856 */
<> 149:156823d33999 1857 template <typename T>
<> 149:156823d33999 1858 void attach(R (*func)(T*, A0, A1), T *arg) {
<> 149:156823d33999 1859 this->~Callback();
<> 149:156823d33999 1860 new (this) Callback(func, arg);
<> 149:156823d33999 1861 }
<> 149:156823d33999 1862
<> 149:156823d33999 1863 /** Attach a static function with a bound pointer
<> 149:156823d33999 1864 * @param func Static function to attach
<> 149:156823d33999 1865 * @param arg Pointer argument to function
<> 149:156823d33999 1866 */
<> 149:156823d33999 1867 template <typename T>
<> 149:156823d33999 1868 void attach(R (*func)(const T*, A0, A1), const T *arg) {
<> 149:156823d33999 1869 this->~Callback();
<> 149:156823d33999 1870 new (this) Callback(func, arg);
<> 149:156823d33999 1871 }
<> 149:156823d33999 1872
<> 149:156823d33999 1873 /** Attach a static function with a bound pointer
<> 149:156823d33999 1874 * @param func Static function to attach
<> 149:156823d33999 1875 * @param arg Pointer argument to function
<> 149:156823d33999 1876 */
<> 149:156823d33999 1877 template <typename T>
<> 149:156823d33999 1878 void attach(R (*func)(volatile T*, A0, A1), volatile T *arg) {
<> 149:156823d33999 1879 this->~Callback();
<> 149:156823d33999 1880 new (this) Callback(func, arg);
<> 149:156823d33999 1881 }
<> 149:156823d33999 1882
<> 149:156823d33999 1883 /** Attach a static function with a bound pointer
<> 149:156823d33999 1884 * @param func Static function to attach
<> 149:156823d33999 1885 * @param arg Pointer argument to function
<> 149:156823d33999 1886 */
<> 149:156823d33999 1887 template <typename T>
<> 149:156823d33999 1888 void attach(R (*func)(const volatile T*, A0, A1), const volatile T *arg) {
<> 149:156823d33999 1889 this->~Callback();
<> 149:156823d33999 1890 new (this) Callback(func, arg);
<> 149:156823d33999 1891 }
<> 149:156823d33999 1892
<> 149:156823d33999 1893 /** Attach a function object
<> 149:156823d33999 1894 * @param func Function object to attach
<> 149:156823d33999 1895 * @note The function object is limited to a single word of storage
<> 149:156823d33999 1896 */
<> 149:156823d33999 1897 template <typename F>
<> 149:156823d33999 1898 void attach(F f, typename detail::enable_if<
<> 149:156823d33999 1899 detail::is_type<R (F::*)(A0, A1), &F::operator()>::value &&
<> 149:156823d33999 1900 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 1901 >::type = detail::nil()) {
<> 149:156823d33999 1902 this->~Callback();
<> 149:156823d33999 1903 new (this) Callback(f);
<> 149:156823d33999 1904 }
<> 149:156823d33999 1905
<> 149:156823d33999 1906 /** Attach a function object
<> 149:156823d33999 1907 * @param func Function object to attach
<> 149:156823d33999 1908 * @note The function object is limited to a single word of storage
<> 149:156823d33999 1909 */
<> 149:156823d33999 1910 template <typename F>
<> 149:156823d33999 1911 void attach(const F f, typename detail::enable_if<
<> 149:156823d33999 1912 detail::is_type<R (F::*)(A0, A1) const, &F::operator()>::value &&
<> 149:156823d33999 1913 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 1914 >::type = detail::nil()) {
<> 149:156823d33999 1915 this->~Callback();
<> 149:156823d33999 1916 new (this) Callback(f);
<> 149:156823d33999 1917 }
<> 149:156823d33999 1918
<> 149:156823d33999 1919 /** Attach a function object
<> 149:156823d33999 1920 * @param func Function object to attach
<> 149:156823d33999 1921 * @note The function object is limited to a single word of storage
<> 149:156823d33999 1922 */
<> 149:156823d33999 1923 template <typename F>
<> 149:156823d33999 1924 void attach(volatile F f, typename detail::enable_if<
<> 149:156823d33999 1925 detail::is_type<R (F::*)(A0, A1) volatile, &F::operator()>::value &&
<> 149:156823d33999 1926 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 1927 >::type = detail::nil()) {
<> 149:156823d33999 1928 this->~Callback();
<> 149:156823d33999 1929 new (this) Callback(f);
<> 149:156823d33999 1930 }
<> 149:156823d33999 1931
<> 149:156823d33999 1932 /** Attach a function object
<> 149:156823d33999 1933 * @param func Function object to attach
<> 149:156823d33999 1934 * @note The function object is limited to a single word of storage
<> 149:156823d33999 1935 */
<> 149:156823d33999 1936 template <typename F>
<> 149:156823d33999 1937 void attach(const volatile F f, typename detail::enable_if<
<> 149:156823d33999 1938 detail::is_type<R (F::*)(A0, A1) const volatile, &F::operator()>::value &&
<> 149:156823d33999 1939 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 1940 >::type = detail::nil()) {
<> 149:156823d33999 1941 this->~Callback();
<> 149:156823d33999 1942 new (this) Callback(f);
<> 149:156823d33999 1943 }
<> 149:156823d33999 1944
<> 149:156823d33999 1945 /** Attach a static function with a bound pointer
<> 149:156823d33999 1946 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1947 * @param func Static function to attach
<> 149:156823d33999 1948 * @deprecated
<> 149:156823d33999 1949 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 1950 */
<> 149:156823d33999 1951 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1952 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 1953 void attach(void *obj, R (*func)(void*, A0, A1)) {
<> 149:156823d33999 1954 this->~Callback();
<> 149:156823d33999 1955 new (this) Callback(func, obj);
<> 149:156823d33999 1956 }
<> 149:156823d33999 1957
<> 149:156823d33999 1958 /** Attach a static function with a bound pointer
<> 149:156823d33999 1959 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1960 * @param func Static function to attach
<> 149:156823d33999 1961 * @deprecated
<> 149:156823d33999 1962 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 1963 */
<> 149:156823d33999 1964 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1965 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 1966 void attach(const void *obj, R (*func)(const void*, A0, A1)) {
<> 149:156823d33999 1967 this->~Callback();
<> 149:156823d33999 1968 new (this) Callback(func, obj);
<> 149:156823d33999 1969 }
<> 149:156823d33999 1970
<> 149:156823d33999 1971 /** Attach a static function with a bound pointer
<> 149:156823d33999 1972 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1973 * @param func Static function to attach
<> 149:156823d33999 1974 * @deprecated
<> 149:156823d33999 1975 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 1976 */
<> 149:156823d33999 1977 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1978 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 1979 void attach(volatile void *obj, R (*func)(volatile void*, A0, A1)) {
<> 149:156823d33999 1980 this->~Callback();
<> 149:156823d33999 1981 new (this) Callback(func, obj);
<> 149:156823d33999 1982 }
<> 149:156823d33999 1983
<> 149:156823d33999 1984 /** Attach a static function with a bound pointer
<> 149:156823d33999 1985 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1986 * @param func Static function to attach
<> 149:156823d33999 1987 * @deprecated
<> 149:156823d33999 1988 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 1989 */
<> 149:156823d33999 1990 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 1991 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 1992 void attach(const volatile void *obj, R (*func)(const volatile void*, A0, A1)) {
<> 149:156823d33999 1993 this->~Callback();
<> 149:156823d33999 1994 new (this) Callback(func, obj);
<> 149:156823d33999 1995 }
<> 149:156823d33999 1996
<> 149:156823d33999 1997 /** Attach a static function with a bound pointer
<> 149:156823d33999 1998 * @param obj Pointer to object to bind to function
<> 149:156823d33999 1999 * @param func Static function to attach
<> 149:156823d33999 2000 * @deprecated
<> 149:156823d33999 2001 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 2002 */
<> 149:156823d33999 2003 template <typename T>
<> 149:156823d33999 2004 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2005 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 2006 void attach(T *obj, R (*func)(T*, A0, A1)) {
<> 149:156823d33999 2007 this->~Callback();
<> 149:156823d33999 2008 new (this) Callback(func, obj);
<> 149:156823d33999 2009 }
<> 149:156823d33999 2010
<> 149:156823d33999 2011 /** Attach a static function with a bound pointer
<> 149:156823d33999 2012 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2013 * @param func Static function to attach
<> 149:156823d33999 2014 * @deprecated
<> 149:156823d33999 2015 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 2016 */
<> 149:156823d33999 2017 template <typename T>
<> 149:156823d33999 2018 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2019 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 2020 void attach(const T *obj, R (*func)(const T*, A0, A1)) {
<> 149:156823d33999 2021 this->~Callback();
<> 149:156823d33999 2022 new (this) Callback(func, obj);
<> 149:156823d33999 2023 }
<> 149:156823d33999 2024
<> 149:156823d33999 2025 /** Attach a static function with a bound pointer
<> 149:156823d33999 2026 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2027 * @param func Static function to attach
<> 149:156823d33999 2028 * @deprecated
<> 149:156823d33999 2029 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 2030 */
<> 149:156823d33999 2031 template <typename T>
<> 149:156823d33999 2032 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2033 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 2034 void attach(volatile T *obj, R (*func)(volatile T*, A0, A1)) {
<> 149:156823d33999 2035 this->~Callback();
<> 149:156823d33999 2036 new (this) Callback(func, obj);
<> 149:156823d33999 2037 }
<> 149:156823d33999 2038
<> 149:156823d33999 2039 /** Attach a static function with a bound pointer
<> 149:156823d33999 2040 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2041 * @param func Static function to attach
<> 149:156823d33999 2042 * @deprecated
<> 149:156823d33999 2043 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 2044 */
<> 149:156823d33999 2045 template <typename T>
<> 149:156823d33999 2046 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2047 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 2048 void attach(const volatile T *obj, R (*func)(const volatile T*, A0, A1)) {
<> 149:156823d33999 2049 this->~Callback();
<> 149:156823d33999 2050 new (this) Callback(func, obj);
<> 149:156823d33999 2051 }
<> 149:156823d33999 2052
<> 149:156823d33999 2053 /** Assign a callback
<> 149:156823d33999 2054 */
<> 149:156823d33999 2055 Callback &operator=(const Callback &that) {
<> 149:156823d33999 2056 if (this != &that) {
<> 149:156823d33999 2057 this->~Callback();
<> 149:156823d33999 2058 new (this) Callback(that);
<> 149:156823d33999 2059 }
<> 149:156823d33999 2060
<> 149:156823d33999 2061 return *this;
<> 149:156823d33999 2062 }
<> 149:156823d33999 2063
<> 149:156823d33999 2064 /** Call the attached function
<> 149:156823d33999 2065 */
<> 149:156823d33999 2066 R call(A0 a0, A1 a1) const {
<> 149:156823d33999 2067 MBED_ASSERT(_ops);
<> 149:156823d33999 2068 return _ops->call(this, a0, a1);
<> 149:156823d33999 2069 }
<> 149:156823d33999 2070
<> 149:156823d33999 2071 /** Call the attached function
<> 149:156823d33999 2072 */
<> 149:156823d33999 2073 R operator()(A0 a0, A1 a1) const {
<> 149:156823d33999 2074 return call(a0, a1);
<> 149:156823d33999 2075 }
<> 149:156823d33999 2076
<> 149:156823d33999 2077 /** Test if function has been attached
<> 149:156823d33999 2078 */
<> 149:156823d33999 2079 operator bool() const {
<> 149:156823d33999 2080 return _ops;
<> 149:156823d33999 2081 }
<> 149:156823d33999 2082
<> 149:156823d33999 2083 /** Test for equality
<> 149:156823d33999 2084 */
<> 149:156823d33999 2085 friend bool operator==(const Callback &l, const Callback &r) {
<> 149:156823d33999 2086 return memcmp(&l, &r, sizeof(Callback)) == 0;
<> 149:156823d33999 2087 }
<> 149:156823d33999 2088
<> 149:156823d33999 2089 /** Test for inequality
<> 149:156823d33999 2090 */
<> 149:156823d33999 2091 friend bool operator!=(const Callback &l, const Callback &r) {
<> 149:156823d33999 2092 return !(l == r);
<> 149:156823d33999 2093 }
<> 149:156823d33999 2094
<> 149:156823d33999 2095 /** Static thunk for passing as C-style function
<> 149:156823d33999 2096 * @param func Callback to call passed as void pointer
<> 149:156823d33999 2097 */
<> 149:156823d33999 2098 static R thunk(void *func, A0 a0, A1 a1) {
<> 149:156823d33999 2099 return static_cast<Callback*>(func)->call(a0, a1);
<> 149:156823d33999 2100 }
<> 149:156823d33999 2101
<> 149:156823d33999 2102 private:
<> 149:156823d33999 2103 // Stored as pointer to function and pointer to optional object
<> 149:156823d33999 2104 // Function pointer is stored as union of possible function types
<> 149:156823d33999 2105 // to garuntee proper size and alignment
<> 149:156823d33999 2106 struct _class;
<> 149:156823d33999 2107 union {
<> 149:156823d33999 2108 void (*_staticfunc)(A0, A1);
<> 149:156823d33999 2109 void (*_boundfunc)(_class*, A0, A1);
<> 149:156823d33999 2110 void (_class::*_methodfunc)(A0, A1);
<> 149:156823d33999 2111 } _func;
<> 149:156823d33999 2112 void *_obj;
<> 149:156823d33999 2113
<> 149:156823d33999 2114 // Dynamically dispatched operations
<> 149:156823d33999 2115 const struct ops {
<> 149:156823d33999 2116 R (*call)(const void*, A0, A1);
<> 149:156823d33999 2117 void (*move)(void*, const void*);
<> 149:156823d33999 2118 void (*dtor)(void*);
<> 149:156823d33999 2119 } *_ops;
<> 149:156823d33999 2120
<> 149:156823d33999 2121 // Generate operations for function object
<> 149:156823d33999 2122 template <typename F>
<> 149:156823d33999 2123 void generate(const F &f) {
<> 149:156823d33999 2124 static const ops ops = {
<> 149:156823d33999 2125 &Callback::function_call<F>,
<> 149:156823d33999 2126 &Callback::function_move<F>,
<> 149:156823d33999 2127 &Callback::function_dtor<F>,
<> 149:156823d33999 2128 };
<> 149:156823d33999 2129
<> 149:156823d33999 2130 MBED_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F));
<> 149:156823d33999 2131 new (this) F(f);
<> 149:156823d33999 2132 _ops = &ops;
<> 149:156823d33999 2133 }
<> 149:156823d33999 2134
<> 149:156823d33999 2135 // Function attributes
<> 149:156823d33999 2136 template <typename F>
<> 149:156823d33999 2137 static R function_call(const void *p, A0 a0, A1 a1) {
<> 149:156823d33999 2138 return (*(F*)p)(a0, a1);
<> 149:156823d33999 2139 }
<> 149:156823d33999 2140
<> 149:156823d33999 2141 template <typename F>
<> 149:156823d33999 2142 static void function_move(void *d, const void *p) {
<> 149:156823d33999 2143 new (d) F(*(F*)p);
<> 149:156823d33999 2144 }
<> 149:156823d33999 2145
<> 149:156823d33999 2146 template <typename F>
<> 149:156823d33999 2147 static void function_dtor(void *p) {
<> 149:156823d33999 2148 ((F*)p)->~F();
<> 149:156823d33999 2149 }
<> 149:156823d33999 2150
<> 149:156823d33999 2151 // Wrappers for functions with context
<> 149:156823d33999 2152 template <typename O, typename M>
<> 149:156823d33999 2153 struct method_context {
<> 149:156823d33999 2154 M method;
<> 149:156823d33999 2155 O *obj;
<> 149:156823d33999 2156
<> 149:156823d33999 2157 method_context(O *obj, M method)
<> 149:156823d33999 2158 : method(method), obj(obj) {}
<> 149:156823d33999 2159
<> 149:156823d33999 2160 R operator()(A0 a0, A1 a1) const {
<> 149:156823d33999 2161 return (obj->*method)(a0, a1);
<> 149:156823d33999 2162 }
<> 149:156823d33999 2163 };
<> 149:156823d33999 2164
<> 149:156823d33999 2165 template <typename F, typename A>
<> 149:156823d33999 2166 struct function_context {
<> 149:156823d33999 2167 F func;
<> 149:156823d33999 2168 A *arg;
<> 149:156823d33999 2169
<> 149:156823d33999 2170 function_context(F func, A *arg)
<> 149:156823d33999 2171 : func(func), arg(arg) {}
<> 149:156823d33999 2172
<> 149:156823d33999 2173 R operator()(A0 a0, A1 a1) const {
<> 149:156823d33999 2174 return func(arg, a0, a1);
<> 149:156823d33999 2175 }
<> 149:156823d33999 2176 };
<> 149:156823d33999 2177 };
<> 149:156823d33999 2178
<> 149:156823d33999 2179 /** Callback class based on template specialization
<> 149:156823d33999 2180 *
<> 149:156823d33999 2181 * @Note Synchronization level: Not protected
<> 149:156823d33999 2182 */
<> 149:156823d33999 2183 template <typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 2184 class Callback<R(A0, A1, A2)> {
<> 149:156823d33999 2185 public:
<> 149:156823d33999 2186 /** Create a Callback with a static function
<> 149:156823d33999 2187 * @param func Static function to attach
<> 149:156823d33999 2188 */
<> 149:156823d33999 2189 Callback(R (*func)(A0, A1, A2) = 0) {
<> 149:156823d33999 2190 if (!func) {
<> 149:156823d33999 2191 _ops = 0;
<> 149:156823d33999 2192 } else {
<> 149:156823d33999 2193 generate(func);
<> 149:156823d33999 2194 }
<> 149:156823d33999 2195 }
<> 149:156823d33999 2196
<> 149:156823d33999 2197 /** Attach a Callback
<> 149:156823d33999 2198 * @param func The Callback to attach
<> 149:156823d33999 2199 */
<> 149:156823d33999 2200 Callback(const Callback<R(A0, A1, A2)> &func) {
<> 149:156823d33999 2201 if (func._ops) {
<> 149:156823d33999 2202 func._ops->move(this, &func);
<> 149:156823d33999 2203 }
<> 149:156823d33999 2204 _ops = func._ops;
<> 149:156823d33999 2205 }
<> 149:156823d33999 2206
<> 149:156823d33999 2207 /** Create a Callback with a member function
<> 149:156823d33999 2208 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 2209 * @param method Member function to attach
<> 149:156823d33999 2210 */
<> 149:156823d33999 2211 template<typename T>
<> 149:156823d33999 2212 Callback(T *obj, R (T::*method)(A0, A1, A2)) {
<> 149:156823d33999 2213 generate(method_context<T, R (T::*)(A0, A1, A2)>(obj, method));
<> 149:156823d33999 2214 }
<> 149:156823d33999 2215
<> 149:156823d33999 2216 /** Create a Callback with a member function
<> 149:156823d33999 2217 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 2218 * @param method Member function to attach
<> 149:156823d33999 2219 */
<> 149:156823d33999 2220 template<typename T>
<> 149:156823d33999 2221 Callback(const T *obj, R (T::*method)(A0, A1, A2) const) {
<> 149:156823d33999 2222 generate(method_context<const T, R (T::*)(A0, A1, A2) const>(obj, method));
<> 149:156823d33999 2223 }
<> 149:156823d33999 2224
<> 149:156823d33999 2225 /** Create a Callback with a member function
<> 149:156823d33999 2226 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 2227 * @param method Member function to attach
<> 149:156823d33999 2228 */
<> 149:156823d33999 2229 template<typename T>
<> 149:156823d33999 2230 Callback(volatile T *obj, R (T::*method)(A0, A1, A2) volatile) {
<> 149:156823d33999 2231 generate(method_context<volatile T, R (T::*)(A0, A1, A2) volatile>(obj, method));
<> 149:156823d33999 2232 }
<> 149:156823d33999 2233
<> 149:156823d33999 2234 /** Create a Callback with a member function
<> 149:156823d33999 2235 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 2236 * @param method Member function to attach
<> 149:156823d33999 2237 */
<> 149:156823d33999 2238 template<typename T>
<> 149:156823d33999 2239 Callback(const volatile T *obj, R (T::*method)(A0, A1, A2) const volatile) {
<> 149:156823d33999 2240 generate(method_context<const volatile T, R (T::*)(A0, A1, A2) const volatile>(obj, method));
<> 149:156823d33999 2241 }
<> 149:156823d33999 2242
<> 149:156823d33999 2243 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2244 * @param func Static function to attach
<> 149:156823d33999 2245 * @param arg Pointer argument to function
<> 149:156823d33999 2246 */
<> 149:156823d33999 2247 Callback(R (*func)(void*, A0, A1, A2), void *arg) {
<> 149:156823d33999 2248 generate(function_context<R (*)(void*, A0, A1, A2), void>(func, arg));
<> 149:156823d33999 2249 }
<> 149:156823d33999 2250
<> 149:156823d33999 2251 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2252 * @param func Static function to attach
<> 149:156823d33999 2253 * @param arg Pointer argument to function
<> 149:156823d33999 2254 */
<> 149:156823d33999 2255 Callback(R (*func)(const void*, A0, A1, A2), const void *arg) {
<> 149:156823d33999 2256 generate(function_context<R (*)(const void*, A0, A1, A2), const void>(func, arg));
<> 149:156823d33999 2257 }
<> 149:156823d33999 2258
<> 149:156823d33999 2259 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2260 * @param func Static function to attach
<> 149:156823d33999 2261 * @param arg Pointer argument to function
<> 149:156823d33999 2262 */
<> 149:156823d33999 2263 Callback(R (*func)(volatile void*, A0, A1, A2), volatile void *arg) {
<> 149:156823d33999 2264 generate(function_context<R (*)(volatile void*, A0, A1, A2), volatile void>(func, arg));
<> 149:156823d33999 2265 }
<> 149:156823d33999 2266
<> 149:156823d33999 2267 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2268 * @param func Static function to attach
<> 149:156823d33999 2269 * @param arg Pointer argument to function
<> 149:156823d33999 2270 */
<> 149:156823d33999 2271 Callback(R (*func)(const volatile void*, A0, A1, A2), const volatile void *arg) {
<> 149:156823d33999 2272 generate(function_context<R (*)(const volatile void*, A0, A1, A2), const volatile void>(func, arg));
<> 149:156823d33999 2273 }
<> 149:156823d33999 2274
<> 149:156823d33999 2275 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2276 * @param func Static function to attach
<> 149:156823d33999 2277 * @param arg Pointer argument to function
<> 149:156823d33999 2278 */
<> 149:156823d33999 2279 template<typename T>
<> 149:156823d33999 2280 Callback(R (*func)(T*, A0, A1, A2), T *arg) {
<> 149:156823d33999 2281 generate(function_context<R (*)(T*, A0, A1, A2), T>(func, arg));
<> 149:156823d33999 2282 }
<> 149:156823d33999 2283
<> 149:156823d33999 2284 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2285 * @param func Static function to attach
<> 149:156823d33999 2286 * @param arg Pointer argument to function
<> 149:156823d33999 2287 */
<> 149:156823d33999 2288 template<typename T>
<> 149:156823d33999 2289 Callback(R (*func)(const T*, A0, A1, A2), const T *arg) {
<> 149:156823d33999 2290 generate(function_context<R (*)(const T*, A0, A1, A2), const T>(func, arg));
<> 149:156823d33999 2291 }
<> 149:156823d33999 2292
<> 149:156823d33999 2293 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2294 * @param func Static function to attach
<> 149:156823d33999 2295 * @param arg Pointer argument to function
<> 149:156823d33999 2296 */
<> 149:156823d33999 2297 template<typename T>
<> 149:156823d33999 2298 Callback(R (*func)(volatile T*, A0, A1, A2), volatile T *arg) {
<> 149:156823d33999 2299 generate(function_context<R (*)(volatile T*, A0, A1, A2), volatile T>(func, arg));
<> 149:156823d33999 2300 }
<> 149:156823d33999 2301
<> 149:156823d33999 2302 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2303 * @param func Static function to attach
<> 149:156823d33999 2304 * @param arg Pointer argument to function
<> 149:156823d33999 2305 */
<> 149:156823d33999 2306 template<typename T>
<> 149:156823d33999 2307 Callback(R (*func)(const volatile T*, A0, A1, A2), const volatile T *arg) {
<> 149:156823d33999 2308 generate(function_context<R (*)(const volatile T*, A0, A1, A2), const volatile T>(func, arg));
<> 149:156823d33999 2309 }
<> 149:156823d33999 2310
<> 149:156823d33999 2311 /** Create a Callback with a function object
<> 149:156823d33999 2312 * @param func Function object to attach
<> 149:156823d33999 2313 * @note The function object is limited to a single word of storage
<> 149:156823d33999 2314 */
<> 149:156823d33999 2315 template <typename F>
<> 149:156823d33999 2316 Callback(F f, typename detail::enable_if<
<> 149:156823d33999 2317 detail::is_type<R (F::*)(A0, A1, A2), &F::operator()>::value &&
<> 149:156823d33999 2318 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 2319 >::type = detail::nil()) {
<> 149:156823d33999 2320 generate(f);
<> 149:156823d33999 2321 }
<> 149:156823d33999 2322
<> 149:156823d33999 2323 /** Create a Callback with a function object
<> 149:156823d33999 2324 * @param func Function object to attach
<> 149:156823d33999 2325 * @note The function object is limited to a single word of storage
<> 149:156823d33999 2326 */
<> 149:156823d33999 2327 template <typename F>
<> 149:156823d33999 2328 Callback(const F f, typename detail::enable_if<
<> 149:156823d33999 2329 detail::is_type<R (F::*)(A0, A1, A2) const, &F::operator()>::value &&
<> 149:156823d33999 2330 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 2331 >::type = detail::nil()) {
<> 149:156823d33999 2332 generate(f);
<> 149:156823d33999 2333 }
<> 149:156823d33999 2334
<> 149:156823d33999 2335 /** Create a Callback with a function object
<> 149:156823d33999 2336 * @param func Function object to attach
<> 149:156823d33999 2337 * @note The function object is limited to a single word of storage
<> 149:156823d33999 2338 */
<> 149:156823d33999 2339 template <typename F>
<> 149:156823d33999 2340 Callback(volatile F f, typename detail::enable_if<
<> 149:156823d33999 2341 detail::is_type<R (F::*)(A0, A1, A2) volatile, &F::operator()>::value &&
<> 149:156823d33999 2342 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 2343 >::type = detail::nil()) {
<> 149:156823d33999 2344 generate(f);
<> 149:156823d33999 2345 }
<> 149:156823d33999 2346
<> 149:156823d33999 2347 /** Create a Callback with a function object
<> 149:156823d33999 2348 * @param func Function object to attach
<> 149:156823d33999 2349 * @note The function object is limited to a single word of storage
<> 149:156823d33999 2350 */
<> 149:156823d33999 2351 template <typename F>
<> 149:156823d33999 2352 Callback(const volatile F f, typename detail::enable_if<
<> 149:156823d33999 2353 detail::is_type<R (F::*)(A0, A1, A2) const volatile, &F::operator()>::value &&
<> 149:156823d33999 2354 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 2355 >::type = detail::nil()) {
<> 149:156823d33999 2356 generate(f);
<> 149:156823d33999 2357 }
<> 149:156823d33999 2358
<> 149:156823d33999 2359 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2360 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2361 * @param func Static function to attach
<> 149:156823d33999 2362 * @deprecated
<> 149:156823d33999 2363 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 2364 */
<> 149:156823d33999 2365 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2366 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 2367 Callback(void *obj, R (*func)(void*, A0, A1, A2)) {
<> 149:156823d33999 2368 new (this) Callback(func, obj);
<> 149:156823d33999 2369 }
<> 149:156823d33999 2370
<> 149:156823d33999 2371 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2372 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2373 * @param func Static function to attach
<> 149:156823d33999 2374 * @deprecated
<> 149:156823d33999 2375 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 2376 */
<> 149:156823d33999 2377 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2378 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 2379 Callback(const void *obj, R (*func)(const void*, A0, A1, A2)) {
<> 149:156823d33999 2380 new (this) Callback(func, obj);
<> 149:156823d33999 2381 }
<> 149:156823d33999 2382
<> 149:156823d33999 2383 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2384 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2385 * @param func Static function to attach
<> 149:156823d33999 2386 * @deprecated
<> 149:156823d33999 2387 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 2388 */
<> 149:156823d33999 2389 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2390 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 2391 Callback(volatile void *obj, R (*func)(volatile void*, A0, A1, A2)) {
<> 149:156823d33999 2392 new (this) Callback(func, obj);
<> 149:156823d33999 2393 }
<> 149:156823d33999 2394
<> 149:156823d33999 2395 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2396 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2397 * @param func Static function to attach
<> 149:156823d33999 2398 * @deprecated
<> 149:156823d33999 2399 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 2400 */
<> 149:156823d33999 2401 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2402 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 2403 Callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2)) {
<> 149:156823d33999 2404 new (this) Callback(func, obj);
<> 149:156823d33999 2405 }
<> 149:156823d33999 2406
<> 149:156823d33999 2407 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2408 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2409 * @param func Static function to attach
<> 149:156823d33999 2410 * @deprecated
<> 149:156823d33999 2411 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 2412 */
<> 149:156823d33999 2413 template<typename T>
<> 149:156823d33999 2414 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2415 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 2416 Callback(T *obj, R (*func)(T*, A0, A1, A2)) {
<> 149:156823d33999 2417 new (this) Callback(func, obj);
<> 149:156823d33999 2418 }
<> 149:156823d33999 2419
<> 149:156823d33999 2420 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2421 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2422 * @param func Static function to attach
<> 149:156823d33999 2423 * @deprecated
<> 149:156823d33999 2424 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 2425 */
<> 149:156823d33999 2426 template<typename T>
<> 149:156823d33999 2427 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2428 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 2429 Callback(const T *obj, R (*func)(const T*, A0, A1, A2)) {
<> 149:156823d33999 2430 new (this) Callback(func, obj);
<> 149:156823d33999 2431 }
<> 149:156823d33999 2432
<> 149:156823d33999 2433 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2434 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2435 * @param func Static function to attach
<> 149:156823d33999 2436 * @deprecated
<> 149:156823d33999 2437 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 2438 */
<> 149:156823d33999 2439 template<typename T>
<> 149:156823d33999 2440 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2441 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 2442 Callback(volatile T *obj, R (*func)(volatile T*, A0, A1, A2)) {
<> 149:156823d33999 2443 new (this) Callback(func, obj);
<> 149:156823d33999 2444 }
<> 149:156823d33999 2445
<> 149:156823d33999 2446 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2447 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2448 * @param func Static function to attach
<> 149:156823d33999 2449 * @deprecated
<> 149:156823d33999 2450 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 2451 */
<> 149:156823d33999 2452 template<typename T>
<> 149:156823d33999 2453 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2454 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 2455 Callback(const volatile T *obj, R (*func)(const volatile T*, A0, A1, A2)) {
<> 149:156823d33999 2456 new (this) Callback(func, obj);
<> 149:156823d33999 2457 }
<> 149:156823d33999 2458
<> 149:156823d33999 2459 /** Destroy a callback
<> 149:156823d33999 2460 */
<> 149:156823d33999 2461 ~Callback() {
<> 149:156823d33999 2462 if (_ops) {
<> 149:156823d33999 2463 _ops->dtor(this);
<> 149:156823d33999 2464 }
<> 149:156823d33999 2465 }
<> 149:156823d33999 2466
<> 149:156823d33999 2467 /** Attach a static function
<> 149:156823d33999 2468 * @param func Static function to attach
<> 149:156823d33999 2469 */
<> 149:156823d33999 2470 void attach(R (*func)(A0, A1, A2)) {
<> 149:156823d33999 2471 this->~Callback();
<> 149:156823d33999 2472 new (this) Callback(func);
<> 149:156823d33999 2473 }
<> 149:156823d33999 2474
<> 149:156823d33999 2475 /** Attach a Callback
<> 149:156823d33999 2476 * @param func The Callback to attach
<> 149:156823d33999 2477 */
<> 149:156823d33999 2478 void attach(const Callback<R(A0, A1, A2)> &func) {
<> 149:156823d33999 2479 this->~Callback();
<> 149:156823d33999 2480 new (this) Callback(func);
<> 149:156823d33999 2481 }
<> 149:156823d33999 2482
<> 149:156823d33999 2483 /** Attach a member function
<> 149:156823d33999 2484 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 2485 * @param method Member function to attach
<> 149:156823d33999 2486 */
<> 149:156823d33999 2487 template<typename T>
<> 149:156823d33999 2488 void attach(T *obj, R (T::*method)(A0, A1, A2)) {
<> 149:156823d33999 2489 this->~Callback();
<> 149:156823d33999 2490 new (this) Callback(obj, method);
<> 149:156823d33999 2491 }
<> 149:156823d33999 2492
<> 149:156823d33999 2493 /** Attach a member function
<> 149:156823d33999 2494 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 2495 * @param method Member function to attach
<> 149:156823d33999 2496 */
<> 149:156823d33999 2497 template<typename T>
<> 149:156823d33999 2498 void attach(const T *obj, R (T::*method)(A0, A1, A2) const) {
<> 149:156823d33999 2499 this->~Callback();
<> 149:156823d33999 2500 new (this) Callback(obj, method);
<> 149:156823d33999 2501 }
<> 149:156823d33999 2502
<> 149:156823d33999 2503 /** Attach a member function
<> 149:156823d33999 2504 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 2505 * @param method Member function to attach
<> 149:156823d33999 2506 */
<> 149:156823d33999 2507 template<typename T>
<> 149:156823d33999 2508 void attach(volatile T *obj, R (T::*method)(A0, A1, A2) volatile) {
<> 149:156823d33999 2509 this->~Callback();
<> 149:156823d33999 2510 new (this) Callback(obj, method);
<> 149:156823d33999 2511 }
<> 149:156823d33999 2512
<> 149:156823d33999 2513 /** Attach a member function
<> 149:156823d33999 2514 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 2515 * @param method Member function to attach
<> 149:156823d33999 2516 */
<> 149:156823d33999 2517 template<typename T>
<> 149:156823d33999 2518 void attach(const volatile T *obj, R (T::*method)(A0, A1, A2) const volatile) {
<> 149:156823d33999 2519 this->~Callback();
<> 149:156823d33999 2520 new (this) Callback(obj, method);
<> 149:156823d33999 2521 }
<> 149:156823d33999 2522
<> 149:156823d33999 2523 /** Attach a static function with a bound pointer
<> 149:156823d33999 2524 * @param func Static function to attach
<> 149:156823d33999 2525 * @param arg Pointer argument to function
<> 149:156823d33999 2526 */
<> 149:156823d33999 2527 void attach(R (*func)(void*, A0, A1, A2), void *arg) {
<> 149:156823d33999 2528 this->~Callback();
<> 149:156823d33999 2529 new (this) Callback(func, arg);
<> 149:156823d33999 2530 }
<> 149:156823d33999 2531
<> 149:156823d33999 2532 /** Attach a static function with a bound pointer
<> 149:156823d33999 2533 * @param func Static function to attach
<> 149:156823d33999 2534 * @param arg Pointer argument to function
<> 149:156823d33999 2535 */
<> 149:156823d33999 2536 void attach(R (*func)(const void*, A0, A1, A2), const void *arg) {
<> 149:156823d33999 2537 this->~Callback();
<> 149:156823d33999 2538 new (this) Callback(func, arg);
<> 149:156823d33999 2539 }
<> 149:156823d33999 2540
<> 149:156823d33999 2541 /** Attach a static function with a bound pointer
<> 149:156823d33999 2542 * @param func Static function to attach
<> 149:156823d33999 2543 * @param arg Pointer argument to function
<> 149:156823d33999 2544 */
<> 149:156823d33999 2545 void attach(R (*func)(volatile void*, A0, A1, A2), volatile void *arg) {
<> 149:156823d33999 2546 this->~Callback();
<> 149:156823d33999 2547 new (this) Callback(func, arg);
<> 149:156823d33999 2548 }
<> 149:156823d33999 2549
<> 149:156823d33999 2550 /** Attach a static function with a bound pointer
<> 149:156823d33999 2551 * @param func Static function to attach
<> 149:156823d33999 2552 * @param arg Pointer argument to function
<> 149:156823d33999 2553 */
<> 149:156823d33999 2554 void attach(R (*func)(const volatile void*, A0, A1, A2), const volatile void *arg) {
<> 149:156823d33999 2555 this->~Callback();
<> 149:156823d33999 2556 new (this) Callback(func, arg);
<> 149:156823d33999 2557 }
<> 149:156823d33999 2558
<> 149:156823d33999 2559 /** Attach a static function with a bound pointer
<> 149:156823d33999 2560 * @param func Static function to attach
<> 149:156823d33999 2561 * @param arg Pointer argument to function
<> 149:156823d33999 2562 */
<> 149:156823d33999 2563 template <typename T>
<> 149:156823d33999 2564 void attach(R (*func)(T*, A0, A1, A2), T *arg) {
<> 149:156823d33999 2565 this->~Callback();
<> 149:156823d33999 2566 new (this) Callback(func, arg);
<> 149:156823d33999 2567 }
<> 149:156823d33999 2568
<> 149:156823d33999 2569 /** Attach a static function with a bound pointer
<> 149:156823d33999 2570 * @param func Static function to attach
<> 149:156823d33999 2571 * @param arg Pointer argument to function
<> 149:156823d33999 2572 */
<> 149:156823d33999 2573 template <typename T>
<> 149:156823d33999 2574 void attach(R (*func)(const T*, A0, A1, A2), const T *arg) {
<> 149:156823d33999 2575 this->~Callback();
<> 149:156823d33999 2576 new (this) Callback(func, arg);
<> 149:156823d33999 2577 }
<> 149:156823d33999 2578
<> 149:156823d33999 2579 /** Attach a static function with a bound pointer
<> 149:156823d33999 2580 * @param func Static function to attach
<> 149:156823d33999 2581 * @param arg Pointer argument to function
<> 149:156823d33999 2582 */
<> 149:156823d33999 2583 template <typename T>
<> 149:156823d33999 2584 void attach(R (*func)(volatile T*, A0, A1, A2), volatile T *arg) {
<> 149:156823d33999 2585 this->~Callback();
<> 149:156823d33999 2586 new (this) Callback(func, arg);
<> 149:156823d33999 2587 }
<> 149:156823d33999 2588
<> 149:156823d33999 2589 /** Attach a static function with a bound pointer
<> 149:156823d33999 2590 * @param func Static function to attach
<> 149:156823d33999 2591 * @param arg Pointer argument to function
<> 149:156823d33999 2592 */
<> 149:156823d33999 2593 template <typename T>
<> 149:156823d33999 2594 void attach(R (*func)(const volatile T*, A0, A1, A2), const volatile T *arg) {
<> 149:156823d33999 2595 this->~Callback();
<> 149:156823d33999 2596 new (this) Callback(func, arg);
<> 149:156823d33999 2597 }
<> 149:156823d33999 2598
<> 149:156823d33999 2599 /** Attach a function object
<> 149:156823d33999 2600 * @param func Function object to attach
<> 149:156823d33999 2601 * @note The function object is limited to a single word of storage
<> 149:156823d33999 2602 */
<> 149:156823d33999 2603 template <typename F>
<> 149:156823d33999 2604 void attach(F f, typename detail::enable_if<
<> 149:156823d33999 2605 detail::is_type<R (F::*)(A0, A1, A2), &F::operator()>::value &&
<> 149:156823d33999 2606 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 2607 >::type = detail::nil()) {
<> 149:156823d33999 2608 this->~Callback();
<> 149:156823d33999 2609 new (this) Callback(f);
<> 149:156823d33999 2610 }
<> 149:156823d33999 2611
<> 149:156823d33999 2612 /** Attach a function object
<> 149:156823d33999 2613 * @param func Function object to attach
<> 149:156823d33999 2614 * @note The function object is limited to a single word of storage
<> 149:156823d33999 2615 */
<> 149:156823d33999 2616 template <typename F>
<> 149:156823d33999 2617 void attach(const F f, typename detail::enable_if<
<> 149:156823d33999 2618 detail::is_type<R (F::*)(A0, A1, A2) const, &F::operator()>::value &&
<> 149:156823d33999 2619 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 2620 >::type = detail::nil()) {
<> 149:156823d33999 2621 this->~Callback();
<> 149:156823d33999 2622 new (this) Callback(f);
<> 149:156823d33999 2623 }
<> 149:156823d33999 2624
<> 149:156823d33999 2625 /** Attach a function object
<> 149:156823d33999 2626 * @param func Function object to attach
<> 149:156823d33999 2627 * @note The function object is limited to a single word of storage
<> 149:156823d33999 2628 */
<> 149:156823d33999 2629 template <typename F>
<> 149:156823d33999 2630 void attach(volatile F f, typename detail::enable_if<
<> 149:156823d33999 2631 detail::is_type<R (F::*)(A0, A1, A2) volatile, &F::operator()>::value &&
<> 149:156823d33999 2632 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 2633 >::type = detail::nil()) {
<> 149:156823d33999 2634 this->~Callback();
<> 149:156823d33999 2635 new (this) Callback(f);
<> 149:156823d33999 2636 }
<> 149:156823d33999 2637
<> 149:156823d33999 2638 /** Attach a function object
<> 149:156823d33999 2639 * @param func Function object to attach
<> 149:156823d33999 2640 * @note The function object is limited to a single word of storage
<> 149:156823d33999 2641 */
<> 149:156823d33999 2642 template <typename F>
<> 149:156823d33999 2643 void attach(const volatile F f, typename detail::enable_if<
<> 149:156823d33999 2644 detail::is_type<R (F::*)(A0, A1, A2) const volatile, &F::operator()>::value &&
<> 149:156823d33999 2645 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 2646 >::type = detail::nil()) {
<> 149:156823d33999 2647 this->~Callback();
<> 149:156823d33999 2648 new (this) Callback(f);
<> 149:156823d33999 2649 }
<> 149:156823d33999 2650
<> 149:156823d33999 2651 /** Attach a static function with a bound pointer
<> 149:156823d33999 2652 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2653 * @param func Static function to attach
<> 149:156823d33999 2654 * @deprecated
<> 149:156823d33999 2655 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 2656 */
<> 149:156823d33999 2657 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2658 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 2659 void attach(void *obj, R (*func)(void*, A0, A1, A2)) {
<> 149:156823d33999 2660 this->~Callback();
<> 149:156823d33999 2661 new (this) Callback(func, obj);
<> 149:156823d33999 2662 }
<> 149:156823d33999 2663
<> 149:156823d33999 2664 /** Attach a static function with a bound pointer
<> 149:156823d33999 2665 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2666 * @param func Static function to attach
<> 149:156823d33999 2667 * @deprecated
<> 149:156823d33999 2668 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 2669 */
<> 149:156823d33999 2670 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2671 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 2672 void attach(const void *obj, R (*func)(const void*, A0, A1, A2)) {
<> 149:156823d33999 2673 this->~Callback();
<> 149:156823d33999 2674 new (this) Callback(func, obj);
<> 149:156823d33999 2675 }
<> 149:156823d33999 2676
<> 149:156823d33999 2677 /** Attach a static function with a bound pointer
<> 149:156823d33999 2678 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2679 * @param func Static function to attach
<> 149:156823d33999 2680 * @deprecated
<> 149:156823d33999 2681 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 2682 */
<> 149:156823d33999 2683 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2684 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 2685 void attach(volatile void *obj, R (*func)(volatile void*, A0, A1, A2)) {
<> 149:156823d33999 2686 this->~Callback();
<> 149:156823d33999 2687 new (this) Callback(func, obj);
<> 149:156823d33999 2688 }
<> 149:156823d33999 2689
<> 149:156823d33999 2690 /** Attach a static function with a bound pointer
<> 149:156823d33999 2691 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2692 * @param func Static function to attach
<> 149:156823d33999 2693 * @deprecated
<> 149:156823d33999 2694 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 2695 */
<> 149:156823d33999 2696 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2697 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 2698 void attach(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2)) {
<> 149:156823d33999 2699 this->~Callback();
<> 149:156823d33999 2700 new (this) Callback(func, obj);
<> 149:156823d33999 2701 }
<> 149:156823d33999 2702
<> 149:156823d33999 2703 /** Attach a static function with a bound pointer
<> 149:156823d33999 2704 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2705 * @param func Static function to attach
<> 149:156823d33999 2706 * @deprecated
<> 149:156823d33999 2707 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 2708 */
<> 149:156823d33999 2709 template <typename T>
<> 149:156823d33999 2710 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2711 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 2712 void attach(T *obj, R (*func)(T*, A0, A1, A2)) {
<> 149:156823d33999 2713 this->~Callback();
<> 149:156823d33999 2714 new (this) Callback(func, obj);
<> 149:156823d33999 2715 }
<> 149:156823d33999 2716
<> 149:156823d33999 2717 /** Attach a static function with a bound pointer
<> 149:156823d33999 2718 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2719 * @param func Static function to attach
<> 149:156823d33999 2720 * @deprecated
<> 149:156823d33999 2721 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 2722 */
<> 149:156823d33999 2723 template <typename T>
<> 149:156823d33999 2724 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2725 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 2726 void attach(const T *obj, R (*func)(const T*, A0, A1, A2)) {
<> 149:156823d33999 2727 this->~Callback();
<> 149:156823d33999 2728 new (this) Callback(func, obj);
<> 149:156823d33999 2729 }
<> 149:156823d33999 2730
<> 149:156823d33999 2731 /** Attach a static function with a bound pointer
<> 149:156823d33999 2732 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2733 * @param func Static function to attach
<> 149:156823d33999 2734 * @deprecated
<> 149:156823d33999 2735 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 2736 */
<> 149:156823d33999 2737 template <typename T>
<> 149:156823d33999 2738 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2739 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 2740 void attach(volatile T *obj, R (*func)(volatile T*, A0, A1, A2)) {
<> 149:156823d33999 2741 this->~Callback();
<> 149:156823d33999 2742 new (this) Callback(func, obj);
<> 149:156823d33999 2743 }
<> 149:156823d33999 2744
<> 149:156823d33999 2745 /** Attach a static function with a bound pointer
<> 149:156823d33999 2746 * @param obj Pointer to object to bind to function
<> 149:156823d33999 2747 * @param func Static function to attach
<> 149:156823d33999 2748 * @deprecated
<> 149:156823d33999 2749 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 2750 */
<> 149:156823d33999 2751 template <typename T>
<> 149:156823d33999 2752 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 2753 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 2754 void attach(const volatile T *obj, R (*func)(const volatile T*, A0, A1, A2)) {
<> 149:156823d33999 2755 this->~Callback();
<> 149:156823d33999 2756 new (this) Callback(func, obj);
<> 149:156823d33999 2757 }
<> 149:156823d33999 2758
<> 149:156823d33999 2759 /** Assign a callback
<> 149:156823d33999 2760 */
<> 149:156823d33999 2761 Callback &operator=(const Callback &that) {
<> 149:156823d33999 2762 if (this != &that) {
<> 149:156823d33999 2763 this->~Callback();
<> 149:156823d33999 2764 new (this) Callback(that);
<> 149:156823d33999 2765 }
<> 149:156823d33999 2766
<> 149:156823d33999 2767 return *this;
<> 149:156823d33999 2768 }
<> 149:156823d33999 2769
<> 149:156823d33999 2770 /** Call the attached function
<> 149:156823d33999 2771 */
<> 149:156823d33999 2772 R call(A0 a0, A1 a1, A2 a2) const {
<> 149:156823d33999 2773 MBED_ASSERT(_ops);
<> 149:156823d33999 2774 return _ops->call(this, a0, a1, a2);
<> 149:156823d33999 2775 }
<> 149:156823d33999 2776
<> 149:156823d33999 2777 /** Call the attached function
<> 149:156823d33999 2778 */
<> 149:156823d33999 2779 R operator()(A0 a0, A1 a1, A2 a2) const {
<> 149:156823d33999 2780 return call(a0, a1, a2);
<> 149:156823d33999 2781 }
<> 149:156823d33999 2782
<> 149:156823d33999 2783 /** Test if function has been attached
<> 149:156823d33999 2784 */
<> 149:156823d33999 2785 operator bool() const {
<> 149:156823d33999 2786 return _ops;
<> 149:156823d33999 2787 }
<> 149:156823d33999 2788
<> 149:156823d33999 2789 /** Test for equality
<> 149:156823d33999 2790 */
<> 149:156823d33999 2791 friend bool operator==(const Callback &l, const Callback &r) {
<> 149:156823d33999 2792 return memcmp(&l, &r, sizeof(Callback)) == 0;
<> 149:156823d33999 2793 }
<> 149:156823d33999 2794
<> 149:156823d33999 2795 /** Test for inequality
<> 149:156823d33999 2796 */
<> 149:156823d33999 2797 friend bool operator!=(const Callback &l, const Callback &r) {
<> 149:156823d33999 2798 return !(l == r);
<> 149:156823d33999 2799 }
<> 149:156823d33999 2800
<> 149:156823d33999 2801 /** Static thunk for passing as C-style function
<> 149:156823d33999 2802 * @param func Callback to call passed as void pointer
<> 149:156823d33999 2803 */
<> 149:156823d33999 2804 static R thunk(void *func, A0 a0, A1 a1, A2 a2) {
<> 149:156823d33999 2805 return static_cast<Callback*>(func)->call(a0, a1, a2);
<> 149:156823d33999 2806 }
<> 149:156823d33999 2807
<> 149:156823d33999 2808 private:
<> 149:156823d33999 2809 // Stored as pointer to function and pointer to optional object
<> 149:156823d33999 2810 // Function pointer is stored as union of possible function types
<> 149:156823d33999 2811 // to garuntee proper size and alignment
<> 149:156823d33999 2812 struct _class;
<> 149:156823d33999 2813 union {
<> 149:156823d33999 2814 void (*_staticfunc)(A0, A1, A2);
<> 149:156823d33999 2815 void (*_boundfunc)(_class*, A0, A1, A2);
<> 149:156823d33999 2816 void (_class::*_methodfunc)(A0, A1, A2);
<> 149:156823d33999 2817 } _func;
<> 149:156823d33999 2818 void *_obj;
<> 149:156823d33999 2819
<> 149:156823d33999 2820 // Dynamically dispatched operations
<> 149:156823d33999 2821 const struct ops {
<> 149:156823d33999 2822 R (*call)(const void*, A0, A1, A2);
<> 149:156823d33999 2823 void (*move)(void*, const void*);
<> 149:156823d33999 2824 void (*dtor)(void*);
<> 149:156823d33999 2825 } *_ops;
<> 149:156823d33999 2826
<> 149:156823d33999 2827 // Generate operations for function object
<> 149:156823d33999 2828 template <typename F>
<> 149:156823d33999 2829 void generate(const F &f) {
<> 149:156823d33999 2830 static const ops ops = {
<> 149:156823d33999 2831 &Callback::function_call<F>,
<> 149:156823d33999 2832 &Callback::function_move<F>,
<> 149:156823d33999 2833 &Callback::function_dtor<F>,
<> 149:156823d33999 2834 };
<> 149:156823d33999 2835
<> 149:156823d33999 2836 MBED_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F));
<> 149:156823d33999 2837 new (this) F(f);
<> 149:156823d33999 2838 _ops = &ops;
<> 149:156823d33999 2839 }
<> 149:156823d33999 2840
<> 149:156823d33999 2841 // Function attributes
<> 149:156823d33999 2842 template <typename F>
<> 149:156823d33999 2843 static R function_call(const void *p, A0 a0, A1 a1, A2 a2) {
<> 149:156823d33999 2844 return (*(F*)p)(a0, a1, a2);
<> 149:156823d33999 2845 }
<> 149:156823d33999 2846
<> 149:156823d33999 2847 template <typename F>
<> 149:156823d33999 2848 static void function_move(void *d, const void *p) {
<> 149:156823d33999 2849 new (d) F(*(F*)p);
<> 149:156823d33999 2850 }
<> 149:156823d33999 2851
<> 149:156823d33999 2852 template <typename F>
<> 149:156823d33999 2853 static void function_dtor(void *p) {
<> 149:156823d33999 2854 ((F*)p)->~F();
<> 149:156823d33999 2855 }
<> 149:156823d33999 2856
<> 149:156823d33999 2857 // Wrappers for functions with context
<> 149:156823d33999 2858 template <typename O, typename M>
<> 149:156823d33999 2859 struct method_context {
<> 149:156823d33999 2860 M method;
<> 149:156823d33999 2861 O *obj;
<> 149:156823d33999 2862
<> 149:156823d33999 2863 method_context(O *obj, M method)
<> 149:156823d33999 2864 : method(method), obj(obj) {}
<> 149:156823d33999 2865
<> 149:156823d33999 2866 R operator()(A0 a0, A1 a1, A2 a2) const {
<> 149:156823d33999 2867 return (obj->*method)(a0, a1, a2);
<> 149:156823d33999 2868 }
<> 149:156823d33999 2869 };
<> 149:156823d33999 2870
<> 149:156823d33999 2871 template <typename F, typename A>
<> 149:156823d33999 2872 struct function_context {
<> 149:156823d33999 2873 F func;
<> 149:156823d33999 2874 A *arg;
<> 149:156823d33999 2875
<> 149:156823d33999 2876 function_context(F func, A *arg)
<> 149:156823d33999 2877 : func(func), arg(arg) {}
<> 149:156823d33999 2878
<> 149:156823d33999 2879 R operator()(A0 a0, A1 a1, A2 a2) const {
<> 149:156823d33999 2880 return func(arg, a0, a1, a2);
<> 149:156823d33999 2881 }
<> 149:156823d33999 2882 };
<> 149:156823d33999 2883 };
<> 149:156823d33999 2884
<> 149:156823d33999 2885 /** Callback class based on template specialization
<> 149:156823d33999 2886 *
<> 149:156823d33999 2887 * @Note Synchronization level: Not protected
<> 149:156823d33999 2888 */
<> 149:156823d33999 2889 template <typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 2890 class Callback<R(A0, A1, A2, A3)> {
<> 149:156823d33999 2891 public:
<> 149:156823d33999 2892 /** Create a Callback with a static function
<> 149:156823d33999 2893 * @param func Static function to attach
<> 149:156823d33999 2894 */
<> 149:156823d33999 2895 Callback(R (*func)(A0, A1, A2, A3) = 0) {
<> 149:156823d33999 2896 if (!func) {
<> 149:156823d33999 2897 _ops = 0;
<> 149:156823d33999 2898 } else {
<> 149:156823d33999 2899 generate(func);
<> 149:156823d33999 2900 }
<> 149:156823d33999 2901 }
<> 149:156823d33999 2902
<> 149:156823d33999 2903 /** Attach a Callback
<> 149:156823d33999 2904 * @param func The Callback to attach
<> 149:156823d33999 2905 */
<> 149:156823d33999 2906 Callback(const Callback<R(A0, A1, A2, A3)> &func) {
<> 149:156823d33999 2907 if (func._ops) {
<> 149:156823d33999 2908 func._ops->move(this, &func);
<> 149:156823d33999 2909 }
<> 149:156823d33999 2910 _ops = func._ops;
<> 149:156823d33999 2911 }
<> 149:156823d33999 2912
<> 149:156823d33999 2913 /** Create a Callback with a member function
<> 149:156823d33999 2914 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 2915 * @param method Member function to attach
<> 149:156823d33999 2916 */
<> 149:156823d33999 2917 template<typename T>
<> 149:156823d33999 2918 Callback(T *obj, R (T::*method)(A0, A1, A2, A3)) {
<> 149:156823d33999 2919 generate(method_context<T, R (T::*)(A0, A1, A2, A3)>(obj, method));
<> 149:156823d33999 2920 }
<> 149:156823d33999 2921
<> 149:156823d33999 2922 /** Create a Callback with a member function
<> 149:156823d33999 2923 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 2924 * @param method Member function to attach
<> 149:156823d33999 2925 */
<> 149:156823d33999 2926 template<typename T>
<> 149:156823d33999 2927 Callback(const T *obj, R (T::*method)(A0, A1, A2, A3) const) {
<> 149:156823d33999 2928 generate(method_context<const T, R (T::*)(A0, A1, A2, A3) const>(obj, method));
<> 149:156823d33999 2929 }
<> 149:156823d33999 2930
<> 149:156823d33999 2931 /** Create a Callback with a member function
<> 149:156823d33999 2932 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 2933 * @param method Member function to attach
<> 149:156823d33999 2934 */
<> 149:156823d33999 2935 template<typename T>
<> 149:156823d33999 2936 Callback(volatile T *obj, R (T::*method)(A0, A1, A2, A3) volatile) {
<> 149:156823d33999 2937 generate(method_context<volatile T, R (T::*)(A0, A1, A2, A3) volatile>(obj, method));
<> 149:156823d33999 2938 }
<> 149:156823d33999 2939
<> 149:156823d33999 2940 /** Create a Callback with a member function
<> 149:156823d33999 2941 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 2942 * @param method Member function to attach
<> 149:156823d33999 2943 */
<> 149:156823d33999 2944 template<typename T>
<> 149:156823d33999 2945 Callback(const volatile T *obj, R (T::*method)(A0, A1, A2, A3) const volatile) {
<> 149:156823d33999 2946 generate(method_context<const volatile T, R (T::*)(A0, A1, A2, A3) const volatile>(obj, method));
<> 149:156823d33999 2947 }
<> 149:156823d33999 2948
<> 149:156823d33999 2949 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2950 * @param func Static function to attach
<> 149:156823d33999 2951 * @param arg Pointer argument to function
<> 149:156823d33999 2952 */
<> 149:156823d33999 2953 Callback(R (*func)(void*, A0, A1, A2, A3), void *arg) {
<> 149:156823d33999 2954 generate(function_context<R (*)(void*, A0, A1, A2, A3), void>(func, arg));
<> 149:156823d33999 2955 }
<> 149:156823d33999 2956
<> 149:156823d33999 2957 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2958 * @param func Static function to attach
<> 149:156823d33999 2959 * @param arg Pointer argument to function
<> 149:156823d33999 2960 */
<> 149:156823d33999 2961 Callback(R (*func)(const void*, A0, A1, A2, A3), const void *arg) {
<> 149:156823d33999 2962 generate(function_context<R (*)(const void*, A0, A1, A2, A3), const void>(func, arg));
<> 149:156823d33999 2963 }
<> 149:156823d33999 2964
<> 149:156823d33999 2965 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2966 * @param func Static function to attach
<> 149:156823d33999 2967 * @param arg Pointer argument to function
<> 149:156823d33999 2968 */
<> 149:156823d33999 2969 Callback(R (*func)(volatile void*, A0, A1, A2, A3), volatile void *arg) {
<> 149:156823d33999 2970 generate(function_context<R (*)(volatile void*, A0, A1, A2, A3), volatile void>(func, arg));
<> 149:156823d33999 2971 }
<> 149:156823d33999 2972
<> 149:156823d33999 2973 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2974 * @param func Static function to attach
<> 149:156823d33999 2975 * @param arg Pointer argument to function
<> 149:156823d33999 2976 */
<> 149:156823d33999 2977 Callback(R (*func)(const volatile void*, A0, A1, A2, A3), const volatile void *arg) {
<> 149:156823d33999 2978 generate(function_context<R (*)(const volatile void*, A0, A1, A2, A3), const volatile void>(func, arg));
<> 149:156823d33999 2979 }
<> 149:156823d33999 2980
<> 149:156823d33999 2981 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2982 * @param func Static function to attach
<> 149:156823d33999 2983 * @param arg Pointer argument to function
<> 149:156823d33999 2984 */
<> 149:156823d33999 2985 template<typename T>
<> 149:156823d33999 2986 Callback(R (*func)(T*, A0, A1, A2, A3), T *arg) {
<> 149:156823d33999 2987 generate(function_context<R (*)(T*, A0, A1, A2, A3), T>(func, arg));
<> 149:156823d33999 2988 }
<> 149:156823d33999 2989
<> 149:156823d33999 2990 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 2991 * @param func Static function to attach
<> 149:156823d33999 2992 * @param arg Pointer argument to function
<> 149:156823d33999 2993 */
<> 149:156823d33999 2994 template<typename T>
<> 149:156823d33999 2995 Callback(R (*func)(const T*, A0, A1, A2, A3), const T *arg) {
<> 149:156823d33999 2996 generate(function_context<R (*)(const T*, A0, A1, A2, A3), const T>(func, arg));
<> 149:156823d33999 2997 }
<> 149:156823d33999 2998
<> 149:156823d33999 2999 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3000 * @param func Static function to attach
<> 149:156823d33999 3001 * @param arg Pointer argument to function
<> 149:156823d33999 3002 */
<> 149:156823d33999 3003 template<typename T>
<> 149:156823d33999 3004 Callback(R (*func)(volatile T*, A0, A1, A2, A3), volatile T *arg) {
<> 149:156823d33999 3005 generate(function_context<R (*)(volatile T*, A0, A1, A2, A3), volatile T>(func, arg));
<> 149:156823d33999 3006 }
<> 149:156823d33999 3007
<> 149:156823d33999 3008 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3009 * @param func Static function to attach
<> 149:156823d33999 3010 * @param arg Pointer argument to function
<> 149:156823d33999 3011 */
<> 149:156823d33999 3012 template<typename T>
<> 149:156823d33999 3013 Callback(R (*func)(const volatile T*, A0, A1, A2, A3), const volatile T *arg) {
<> 149:156823d33999 3014 generate(function_context<R (*)(const volatile T*, A0, A1, A2, A3), const volatile T>(func, arg));
<> 149:156823d33999 3015 }
<> 149:156823d33999 3016
<> 149:156823d33999 3017 /** Create a Callback with a function object
<> 149:156823d33999 3018 * @param func Function object to attach
<> 149:156823d33999 3019 * @note The function object is limited to a single word of storage
<> 149:156823d33999 3020 */
<> 149:156823d33999 3021 template <typename F>
<> 149:156823d33999 3022 Callback(F f, typename detail::enable_if<
<> 149:156823d33999 3023 detail::is_type<R (F::*)(A0, A1, A2, A3), &F::operator()>::value &&
<> 149:156823d33999 3024 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 3025 >::type = detail::nil()) {
<> 149:156823d33999 3026 generate(f);
<> 149:156823d33999 3027 }
<> 149:156823d33999 3028
<> 149:156823d33999 3029 /** Create a Callback with a function object
<> 149:156823d33999 3030 * @param func Function object to attach
<> 149:156823d33999 3031 * @note The function object is limited to a single word of storage
<> 149:156823d33999 3032 */
<> 149:156823d33999 3033 template <typename F>
<> 149:156823d33999 3034 Callback(const F f, typename detail::enable_if<
<> 149:156823d33999 3035 detail::is_type<R (F::*)(A0, A1, A2, A3) const, &F::operator()>::value &&
<> 149:156823d33999 3036 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 3037 >::type = detail::nil()) {
<> 149:156823d33999 3038 generate(f);
<> 149:156823d33999 3039 }
<> 149:156823d33999 3040
<> 149:156823d33999 3041 /** Create a Callback with a function object
<> 149:156823d33999 3042 * @param func Function object to attach
<> 149:156823d33999 3043 * @note The function object is limited to a single word of storage
<> 149:156823d33999 3044 */
<> 149:156823d33999 3045 template <typename F>
<> 149:156823d33999 3046 Callback(volatile F f, typename detail::enable_if<
<> 149:156823d33999 3047 detail::is_type<R (F::*)(A0, A1, A2, A3) volatile, &F::operator()>::value &&
<> 149:156823d33999 3048 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 3049 >::type = detail::nil()) {
<> 149:156823d33999 3050 generate(f);
<> 149:156823d33999 3051 }
<> 149:156823d33999 3052
<> 149:156823d33999 3053 /** Create a Callback with a function object
<> 149:156823d33999 3054 * @param func Function object to attach
<> 149:156823d33999 3055 * @note The function object is limited to a single word of storage
<> 149:156823d33999 3056 */
<> 149:156823d33999 3057 template <typename F>
<> 149:156823d33999 3058 Callback(const volatile F f, typename detail::enable_if<
<> 149:156823d33999 3059 detail::is_type<R (F::*)(A0, A1, A2, A3) const volatile, &F::operator()>::value &&
<> 149:156823d33999 3060 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 3061 >::type = detail::nil()) {
<> 149:156823d33999 3062 generate(f);
<> 149:156823d33999 3063 }
<> 149:156823d33999 3064
<> 149:156823d33999 3065 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3066 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3067 * @param func Static function to attach
<> 149:156823d33999 3068 * @deprecated
<> 149:156823d33999 3069 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3070 */
<> 149:156823d33999 3071 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3072 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3073 Callback(void *obj, R (*func)(void*, A0, A1, A2, A3)) {
<> 149:156823d33999 3074 new (this) Callback(func, obj);
<> 149:156823d33999 3075 }
<> 149:156823d33999 3076
<> 149:156823d33999 3077 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3078 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3079 * @param func Static function to attach
<> 149:156823d33999 3080 * @deprecated
<> 149:156823d33999 3081 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3082 */
<> 149:156823d33999 3083 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3084 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3085 Callback(const void *obj, R (*func)(const void*, A0, A1, A2, A3)) {
<> 149:156823d33999 3086 new (this) Callback(func, obj);
<> 149:156823d33999 3087 }
<> 149:156823d33999 3088
<> 149:156823d33999 3089 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3090 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3091 * @param func Static function to attach
<> 149:156823d33999 3092 * @deprecated
<> 149:156823d33999 3093 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3094 */
<> 149:156823d33999 3095 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3096 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3097 Callback(volatile void *obj, R (*func)(volatile void*, A0, A1, A2, A3)) {
<> 149:156823d33999 3098 new (this) Callback(func, obj);
<> 149:156823d33999 3099 }
<> 149:156823d33999 3100
<> 149:156823d33999 3101 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3102 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3103 * @param func Static function to attach
<> 149:156823d33999 3104 * @deprecated
<> 149:156823d33999 3105 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3106 */
<> 149:156823d33999 3107 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3108 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3109 Callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2, A3)) {
<> 149:156823d33999 3110 new (this) Callback(func, obj);
<> 149:156823d33999 3111 }
<> 149:156823d33999 3112
<> 149:156823d33999 3113 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3114 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3115 * @param func Static function to attach
<> 149:156823d33999 3116 * @deprecated
<> 149:156823d33999 3117 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3118 */
<> 149:156823d33999 3119 template<typename T>
<> 149:156823d33999 3120 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3121 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3122 Callback(T *obj, R (*func)(T*, A0, A1, A2, A3)) {
<> 149:156823d33999 3123 new (this) Callback(func, obj);
<> 149:156823d33999 3124 }
<> 149:156823d33999 3125
<> 149:156823d33999 3126 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3127 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3128 * @param func Static function to attach
<> 149:156823d33999 3129 * @deprecated
<> 149:156823d33999 3130 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3131 */
<> 149:156823d33999 3132 template<typename T>
<> 149:156823d33999 3133 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3134 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3135 Callback(const T *obj, R (*func)(const T*, A0, A1, A2, A3)) {
<> 149:156823d33999 3136 new (this) Callback(func, obj);
<> 149:156823d33999 3137 }
<> 149:156823d33999 3138
<> 149:156823d33999 3139 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3140 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3141 * @param func Static function to attach
<> 149:156823d33999 3142 * @deprecated
<> 149:156823d33999 3143 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3144 */
<> 149:156823d33999 3145 template<typename T>
<> 149:156823d33999 3146 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3147 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3148 Callback(volatile T *obj, R (*func)(volatile T*, A0, A1, A2, A3)) {
<> 149:156823d33999 3149 new (this) Callback(func, obj);
<> 149:156823d33999 3150 }
<> 149:156823d33999 3151
<> 149:156823d33999 3152 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3153 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3154 * @param func Static function to attach
<> 149:156823d33999 3155 * @deprecated
<> 149:156823d33999 3156 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3157 */
<> 149:156823d33999 3158 template<typename T>
<> 149:156823d33999 3159 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3160 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3161 Callback(const volatile T *obj, R (*func)(const volatile T*, A0, A1, A2, A3)) {
<> 149:156823d33999 3162 new (this) Callback(func, obj);
<> 149:156823d33999 3163 }
<> 149:156823d33999 3164
<> 149:156823d33999 3165 /** Destroy a callback
<> 149:156823d33999 3166 */
<> 149:156823d33999 3167 ~Callback() {
<> 149:156823d33999 3168 if (_ops) {
<> 149:156823d33999 3169 _ops->dtor(this);
<> 149:156823d33999 3170 }
<> 149:156823d33999 3171 }
<> 149:156823d33999 3172
<> 149:156823d33999 3173 /** Attach a static function
<> 149:156823d33999 3174 * @param func Static function to attach
<> 149:156823d33999 3175 */
<> 149:156823d33999 3176 void attach(R (*func)(A0, A1, A2, A3)) {
<> 149:156823d33999 3177 this->~Callback();
<> 149:156823d33999 3178 new (this) Callback(func);
<> 149:156823d33999 3179 }
<> 149:156823d33999 3180
<> 149:156823d33999 3181 /** Attach a Callback
<> 149:156823d33999 3182 * @param func The Callback to attach
<> 149:156823d33999 3183 */
<> 149:156823d33999 3184 void attach(const Callback<R(A0, A1, A2, A3)> &func) {
<> 149:156823d33999 3185 this->~Callback();
<> 149:156823d33999 3186 new (this) Callback(func);
<> 149:156823d33999 3187 }
<> 149:156823d33999 3188
<> 149:156823d33999 3189 /** Attach a member function
<> 149:156823d33999 3190 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 3191 * @param method Member function to attach
<> 149:156823d33999 3192 */
<> 149:156823d33999 3193 template<typename T>
<> 149:156823d33999 3194 void attach(T *obj, R (T::*method)(A0, A1, A2, A3)) {
<> 149:156823d33999 3195 this->~Callback();
<> 149:156823d33999 3196 new (this) Callback(obj, method);
<> 149:156823d33999 3197 }
<> 149:156823d33999 3198
<> 149:156823d33999 3199 /** Attach a member function
<> 149:156823d33999 3200 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 3201 * @param method Member function to attach
<> 149:156823d33999 3202 */
<> 149:156823d33999 3203 template<typename T>
<> 149:156823d33999 3204 void attach(const T *obj, R (T::*method)(A0, A1, A2, A3) const) {
<> 149:156823d33999 3205 this->~Callback();
<> 149:156823d33999 3206 new (this) Callback(obj, method);
<> 149:156823d33999 3207 }
<> 149:156823d33999 3208
<> 149:156823d33999 3209 /** Attach a member function
<> 149:156823d33999 3210 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 3211 * @param method Member function to attach
<> 149:156823d33999 3212 */
<> 149:156823d33999 3213 template<typename T>
<> 149:156823d33999 3214 void attach(volatile T *obj, R (T::*method)(A0, A1, A2, A3) volatile) {
<> 149:156823d33999 3215 this->~Callback();
<> 149:156823d33999 3216 new (this) Callback(obj, method);
<> 149:156823d33999 3217 }
<> 149:156823d33999 3218
<> 149:156823d33999 3219 /** Attach a member function
<> 149:156823d33999 3220 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 3221 * @param method Member function to attach
<> 149:156823d33999 3222 */
<> 149:156823d33999 3223 template<typename T>
<> 149:156823d33999 3224 void attach(const volatile T *obj, R (T::*method)(A0, A1, A2, A3) const volatile) {
<> 149:156823d33999 3225 this->~Callback();
<> 149:156823d33999 3226 new (this) Callback(obj, method);
<> 149:156823d33999 3227 }
<> 149:156823d33999 3228
<> 149:156823d33999 3229 /** Attach a static function with a bound pointer
<> 149:156823d33999 3230 * @param func Static function to attach
<> 149:156823d33999 3231 * @param arg Pointer argument to function
<> 149:156823d33999 3232 */
<> 149:156823d33999 3233 void attach(R (*func)(void*, A0, A1, A2, A3), void *arg) {
<> 149:156823d33999 3234 this->~Callback();
<> 149:156823d33999 3235 new (this) Callback(func, arg);
<> 149:156823d33999 3236 }
<> 149:156823d33999 3237
<> 149:156823d33999 3238 /** Attach a static function with a bound pointer
<> 149:156823d33999 3239 * @param func Static function to attach
<> 149:156823d33999 3240 * @param arg Pointer argument to function
<> 149:156823d33999 3241 */
<> 149:156823d33999 3242 void attach(R (*func)(const void*, A0, A1, A2, A3), const void *arg) {
<> 149:156823d33999 3243 this->~Callback();
<> 149:156823d33999 3244 new (this) Callback(func, arg);
<> 149:156823d33999 3245 }
<> 149:156823d33999 3246
<> 149:156823d33999 3247 /** Attach a static function with a bound pointer
<> 149:156823d33999 3248 * @param func Static function to attach
<> 149:156823d33999 3249 * @param arg Pointer argument to function
<> 149:156823d33999 3250 */
<> 149:156823d33999 3251 void attach(R (*func)(volatile void*, A0, A1, A2, A3), volatile void *arg) {
<> 149:156823d33999 3252 this->~Callback();
<> 149:156823d33999 3253 new (this) Callback(func, arg);
<> 149:156823d33999 3254 }
<> 149:156823d33999 3255
<> 149:156823d33999 3256 /** Attach a static function with a bound pointer
<> 149:156823d33999 3257 * @param func Static function to attach
<> 149:156823d33999 3258 * @param arg Pointer argument to function
<> 149:156823d33999 3259 */
<> 149:156823d33999 3260 void attach(R (*func)(const volatile void*, A0, A1, A2, A3), const volatile void *arg) {
<> 149:156823d33999 3261 this->~Callback();
<> 149:156823d33999 3262 new (this) Callback(func, arg);
<> 149:156823d33999 3263 }
<> 149:156823d33999 3264
<> 149:156823d33999 3265 /** Attach a static function with a bound pointer
<> 149:156823d33999 3266 * @param func Static function to attach
<> 149:156823d33999 3267 * @param arg Pointer argument to function
<> 149:156823d33999 3268 */
<> 149:156823d33999 3269 template <typename T>
<> 149:156823d33999 3270 void attach(R (*func)(T*, A0, A1, A2, A3), T *arg) {
<> 149:156823d33999 3271 this->~Callback();
<> 149:156823d33999 3272 new (this) Callback(func, arg);
<> 149:156823d33999 3273 }
<> 149:156823d33999 3274
<> 149:156823d33999 3275 /** Attach a static function with a bound pointer
<> 149:156823d33999 3276 * @param func Static function to attach
<> 149:156823d33999 3277 * @param arg Pointer argument to function
<> 149:156823d33999 3278 */
<> 149:156823d33999 3279 template <typename T>
<> 149:156823d33999 3280 void attach(R (*func)(const T*, A0, A1, A2, A3), const T *arg) {
<> 149:156823d33999 3281 this->~Callback();
<> 149:156823d33999 3282 new (this) Callback(func, arg);
<> 149:156823d33999 3283 }
<> 149:156823d33999 3284
<> 149:156823d33999 3285 /** Attach a static function with a bound pointer
<> 149:156823d33999 3286 * @param func Static function to attach
<> 149:156823d33999 3287 * @param arg Pointer argument to function
<> 149:156823d33999 3288 */
<> 149:156823d33999 3289 template <typename T>
<> 149:156823d33999 3290 void attach(R (*func)(volatile T*, A0, A1, A2, A3), volatile T *arg) {
<> 149:156823d33999 3291 this->~Callback();
<> 149:156823d33999 3292 new (this) Callback(func, arg);
<> 149:156823d33999 3293 }
<> 149:156823d33999 3294
<> 149:156823d33999 3295 /** Attach a static function with a bound pointer
<> 149:156823d33999 3296 * @param func Static function to attach
<> 149:156823d33999 3297 * @param arg Pointer argument to function
<> 149:156823d33999 3298 */
<> 149:156823d33999 3299 template <typename T>
<> 149:156823d33999 3300 void attach(R (*func)(const volatile T*, A0, A1, A2, A3), const volatile T *arg) {
<> 149:156823d33999 3301 this->~Callback();
<> 149:156823d33999 3302 new (this) Callback(func, arg);
<> 149:156823d33999 3303 }
<> 149:156823d33999 3304
<> 149:156823d33999 3305 /** Attach a function object
<> 149:156823d33999 3306 * @param func Function object to attach
<> 149:156823d33999 3307 * @note The function object is limited to a single word of storage
<> 149:156823d33999 3308 */
<> 149:156823d33999 3309 template <typename F>
<> 149:156823d33999 3310 void attach(F f, typename detail::enable_if<
<> 149:156823d33999 3311 detail::is_type<R (F::*)(A0, A1, A2, A3), &F::operator()>::value &&
<> 149:156823d33999 3312 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 3313 >::type = detail::nil()) {
<> 149:156823d33999 3314 this->~Callback();
<> 149:156823d33999 3315 new (this) Callback(f);
<> 149:156823d33999 3316 }
<> 149:156823d33999 3317
<> 149:156823d33999 3318 /** Attach a function object
<> 149:156823d33999 3319 * @param func Function object to attach
<> 149:156823d33999 3320 * @note The function object is limited to a single word of storage
<> 149:156823d33999 3321 */
<> 149:156823d33999 3322 template <typename F>
<> 149:156823d33999 3323 void attach(const F f, typename detail::enable_if<
<> 149:156823d33999 3324 detail::is_type<R (F::*)(A0, A1, A2, A3) const, &F::operator()>::value &&
<> 149:156823d33999 3325 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 3326 >::type = detail::nil()) {
<> 149:156823d33999 3327 this->~Callback();
<> 149:156823d33999 3328 new (this) Callback(f);
<> 149:156823d33999 3329 }
<> 149:156823d33999 3330
<> 149:156823d33999 3331 /** Attach a function object
<> 149:156823d33999 3332 * @param func Function object to attach
<> 149:156823d33999 3333 * @note The function object is limited to a single word of storage
<> 149:156823d33999 3334 */
<> 149:156823d33999 3335 template <typename F>
<> 149:156823d33999 3336 void attach(volatile F f, typename detail::enable_if<
<> 149:156823d33999 3337 detail::is_type<R (F::*)(A0, A1, A2, A3) volatile, &F::operator()>::value &&
<> 149:156823d33999 3338 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 3339 >::type = detail::nil()) {
<> 149:156823d33999 3340 this->~Callback();
<> 149:156823d33999 3341 new (this) Callback(f);
<> 149:156823d33999 3342 }
<> 149:156823d33999 3343
<> 149:156823d33999 3344 /** Attach a function object
<> 149:156823d33999 3345 * @param func Function object to attach
<> 149:156823d33999 3346 * @note The function object is limited to a single word of storage
<> 149:156823d33999 3347 */
<> 149:156823d33999 3348 template <typename F>
<> 149:156823d33999 3349 void attach(const volatile F f, typename detail::enable_if<
<> 149:156823d33999 3350 detail::is_type<R (F::*)(A0, A1, A2, A3) const volatile, &F::operator()>::value &&
<> 149:156823d33999 3351 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 3352 >::type = detail::nil()) {
<> 149:156823d33999 3353 this->~Callback();
<> 149:156823d33999 3354 new (this) Callback(f);
<> 149:156823d33999 3355 }
<> 149:156823d33999 3356
<> 149:156823d33999 3357 /** Attach a static function with a bound pointer
<> 149:156823d33999 3358 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3359 * @param func Static function to attach
<> 149:156823d33999 3360 * @deprecated
<> 149:156823d33999 3361 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 3362 */
<> 149:156823d33999 3363 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3364 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 3365 void attach(void *obj, R (*func)(void*, A0, A1, A2, A3)) {
<> 149:156823d33999 3366 this->~Callback();
<> 149:156823d33999 3367 new (this) Callback(func, obj);
<> 149:156823d33999 3368 }
<> 149:156823d33999 3369
<> 149:156823d33999 3370 /** Attach a static function with a bound pointer
<> 149:156823d33999 3371 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3372 * @param func Static function to attach
<> 149:156823d33999 3373 * @deprecated
<> 149:156823d33999 3374 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 3375 */
<> 149:156823d33999 3376 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3377 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 3378 void attach(const void *obj, R (*func)(const void*, A0, A1, A2, A3)) {
<> 149:156823d33999 3379 this->~Callback();
<> 149:156823d33999 3380 new (this) Callback(func, obj);
<> 149:156823d33999 3381 }
<> 149:156823d33999 3382
<> 149:156823d33999 3383 /** Attach a static function with a bound pointer
<> 149:156823d33999 3384 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3385 * @param func Static function to attach
<> 149:156823d33999 3386 * @deprecated
<> 149:156823d33999 3387 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 3388 */
<> 149:156823d33999 3389 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3390 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 3391 void attach(volatile void *obj, R (*func)(volatile void*, A0, A1, A2, A3)) {
<> 149:156823d33999 3392 this->~Callback();
<> 149:156823d33999 3393 new (this) Callback(func, obj);
<> 149:156823d33999 3394 }
<> 149:156823d33999 3395
<> 149:156823d33999 3396 /** Attach a static function with a bound pointer
<> 149:156823d33999 3397 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3398 * @param func Static function to attach
<> 149:156823d33999 3399 * @deprecated
<> 149:156823d33999 3400 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 3401 */
<> 149:156823d33999 3402 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3403 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 3404 void attach(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2, A3)) {
<> 149:156823d33999 3405 this->~Callback();
<> 149:156823d33999 3406 new (this) Callback(func, obj);
<> 149:156823d33999 3407 }
<> 149:156823d33999 3408
<> 149:156823d33999 3409 /** Attach a static function with a bound pointer
<> 149:156823d33999 3410 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3411 * @param func Static function to attach
<> 149:156823d33999 3412 * @deprecated
<> 149:156823d33999 3413 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 3414 */
<> 149:156823d33999 3415 template <typename T>
<> 149:156823d33999 3416 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3417 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 3418 void attach(T *obj, R (*func)(T*, A0, A1, A2, A3)) {
<> 149:156823d33999 3419 this->~Callback();
<> 149:156823d33999 3420 new (this) Callback(func, obj);
<> 149:156823d33999 3421 }
<> 149:156823d33999 3422
<> 149:156823d33999 3423 /** Attach a static function with a bound pointer
<> 149:156823d33999 3424 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3425 * @param func Static function to attach
<> 149:156823d33999 3426 * @deprecated
<> 149:156823d33999 3427 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 3428 */
<> 149:156823d33999 3429 template <typename T>
<> 149:156823d33999 3430 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3431 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 3432 void attach(const T *obj, R (*func)(const T*, A0, A1, A2, A3)) {
<> 149:156823d33999 3433 this->~Callback();
<> 149:156823d33999 3434 new (this) Callback(func, obj);
<> 149:156823d33999 3435 }
<> 149:156823d33999 3436
<> 149:156823d33999 3437 /** Attach a static function with a bound pointer
<> 149:156823d33999 3438 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3439 * @param func Static function to attach
<> 149:156823d33999 3440 * @deprecated
<> 149:156823d33999 3441 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 3442 */
<> 149:156823d33999 3443 template <typename T>
<> 149:156823d33999 3444 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3445 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 3446 void attach(volatile T *obj, R (*func)(volatile T*, A0, A1, A2, A3)) {
<> 149:156823d33999 3447 this->~Callback();
<> 149:156823d33999 3448 new (this) Callback(func, obj);
<> 149:156823d33999 3449 }
<> 149:156823d33999 3450
<> 149:156823d33999 3451 /** Attach a static function with a bound pointer
<> 149:156823d33999 3452 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3453 * @param func Static function to attach
<> 149:156823d33999 3454 * @deprecated
<> 149:156823d33999 3455 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 3456 */
<> 149:156823d33999 3457 template <typename T>
<> 149:156823d33999 3458 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3459 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 3460 void attach(const volatile T *obj, R (*func)(const volatile T*, A0, A1, A2, A3)) {
<> 149:156823d33999 3461 this->~Callback();
<> 149:156823d33999 3462 new (this) Callback(func, obj);
<> 149:156823d33999 3463 }
<> 149:156823d33999 3464
<> 149:156823d33999 3465 /** Assign a callback
<> 149:156823d33999 3466 */
<> 149:156823d33999 3467 Callback &operator=(const Callback &that) {
<> 149:156823d33999 3468 if (this != &that) {
<> 149:156823d33999 3469 this->~Callback();
<> 149:156823d33999 3470 new (this) Callback(that);
<> 149:156823d33999 3471 }
<> 149:156823d33999 3472
<> 149:156823d33999 3473 return *this;
<> 149:156823d33999 3474 }
<> 149:156823d33999 3475
<> 149:156823d33999 3476 /** Call the attached function
<> 149:156823d33999 3477 */
<> 149:156823d33999 3478 R call(A0 a0, A1 a1, A2 a2, A3 a3) const {
<> 149:156823d33999 3479 MBED_ASSERT(_ops);
<> 149:156823d33999 3480 return _ops->call(this, a0, a1, a2, a3);
<> 149:156823d33999 3481 }
<> 149:156823d33999 3482
<> 149:156823d33999 3483 /** Call the attached function
<> 149:156823d33999 3484 */
<> 149:156823d33999 3485 R operator()(A0 a0, A1 a1, A2 a2, A3 a3) const {
<> 149:156823d33999 3486 return call(a0, a1, a2, a3);
<> 149:156823d33999 3487 }
<> 149:156823d33999 3488
<> 149:156823d33999 3489 /** Test if function has been attached
<> 149:156823d33999 3490 */
<> 149:156823d33999 3491 operator bool() const {
<> 149:156823d33999 3492 return _ops;
<> 149:156823d33999 3493 }
<> 149:156823d33999 3494
<> 149:156823d33999 3495 /** Test for equality
<> 149:156823d33999 3496 */
<> 149:156823d33999 3497 friend bool operator==(const Callback &l, const Callback &r) {
<> 149:156823d33999 3498 return memcmp(&l, &r, sizeof(Callback)) == 0;
<> 149:156823d33999 3499 }
<> 149:156823d33999 3500
<> 149:156823d33999 3501 /** Test for inequality
<> 149:156823d33999 3502 */
<> 149:156823d33999 3503 friend bool operator!=(const Callback &l, const Callback &r) {
<> 149:156823d33999 3504 return !(l == r);
<> 149:156823d33999 3505 }
<> 149:156823d33999 3506
<> 149:156823d33999 3507 /** Static thunk for passing as C-style function
<> 149:156823d33999 3508 * @param func Callback to call passed as void pointer
<> 149:156823d33999 3509 */
<> 149:156823d33999 3510 static R thunk(void *func, A0 a0, A1 a1, A2 a2, A3 a3) {
<> 149:156823d33999 3511 return static_cast<Callback*>(func)->call(a0, a1, a2, a3);
<> 149:156823d33999 3512 }
<> 149:156823d33999 3513
<> 149:156823d33999 3514 private:
<> 149:156823d33999 3515 // Stored as pointer to function and pointer to optional object
<> 149:156823d33999 3516 // Function pointer is stored as union of possible function types
<> 149:156823d33999 3517 // to garuntee proper size and alignment
<> 149:156823d33999 3518 struct _class;
<> 149:156823d33999 3519 union {
<> 149:156823d33999 3520 void (*_staticfunc)(A0, A1, A2, A3);
<> 149:156823d33999 3521 void (*_boundfunc)(_class*, A0, A1, A2, A3);
<> 149:156823d33999 3522 void (_class::*_methodfunc)(A0, A1, A2, A3);
<> 149:156823d33999 3523 } _func;
<> 149:156823d33999 3524 void *_obj;
<> 149:156823d33999 3525
<> 149:156823d33999 3526 // Dynamically dispatched operations
<> 149:156823d33999 3527 const struct ops {
<> 149:156823d33999 3528 R (*call)(const void*, A0, A1, A2, A3);
<> 149:156823d33999 3529 void (*move)(void*, const void*);
<> 149:156823d33999 3530 void (*dtor)(void*);
<> 149:156823d33999 3531 } *_ops;
<> 149:156823d33999 3532
<> 149:156823d33999 3533 // Generate operations for function object
<> 149:156823d33999 3534 template <typename F>
<> 149:156823d33999 3535 void generate(const F &f) {
<> 149:156823d33999 3536 static const ops ops = {
<> 149:156823d33999 3537 &Callback::function_call<F>,
<> 149:156823d33999 3538 &Callback::function_move<F>,
<> 149:156823d33999 3539 &Callback::function_dtor<F>,
<> 149:156823d33999 3540 };
<> 149:156823d33999 3541
<> 149:156823d33999 3542 MBED_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F));
<> 149:156823d33999 3543 new (this) F(f);
<> 149:156823d33999 3544 _ops = &ops;
<> 149:156823d33999 3545 }
<> 149:156823d33999 3546
<> 149:156823d33999 3547 // Function attributes
<> 149:156823d33999 3548 template <typename F>
<> 149:156823d33999 3549 static R function_call(const void *p, A0 a0, A1 a1, A2 a2, A3 a3) {
<> 149:156823d33999 3550 return (*(F*)p)(a0, a1, a2, a3);
<> 149:156823d33999 3551 }
<> 149:156823d33999 3552
<> 149:156823d33999 3553 template <typename F>
<> 149:156823d33999 3554 static void function_move(void *d, const void *p) {
<> 149:156823d33999 3555 new (d) F(*(F*)p);
<> 149:156823d33999 3556 }
<> 149:156823d33999 3557
<> 149:156823d33999 3558 template <typename F>
<> 149:156823d33999 3559 static void function_dtor(void *p) {
<> 149:156823d33999 3560 ((F*)p)->~F();
<> 149:156823d33999 3561 }
<> 149:156823d33999 3562
<> 149:156823d33999 3563 // Wrappers for functions with context
<> 149:156823d33999 3564 template <typename O, typename M>
<> 149:156823d33999 3565 struct method_context {
<> 149:156823d33999 3566 M method;
<> 149:156823d33999 3567 O *obj;
<> 149:156823d33999 3568
<> 149:156823d33999 3569 method_context(O *obj, M method)
<> 149:156823d33999 3570 : method(method), obj(obj) {}
<> 149:156823d33999 3571
<> 149:156823d33999 3572 R operator()(A0 a0, A1 a1, A2 a2, A3 a3) const {
<> 149:156823d33999 3573 return (obj->*method)(a0, a1, a2, a3);
<> 149:156823d33999 3574 }
<> 149:156823d33999 3575 };
<> 149:156823d33999 3576
<> 149:156823d33999 3577 template <typename F, typename A>
<> 149:156823d33999 3578 struct function_context {
<> 149:156823d33999 3579 F func;
<> 149:156823d33999 3580 A *arg;
<> 149:156823d33999 3581
<> 149:156823d33999 3582 function_context(F func, A *arg)
<> 149:156823d33999 3583 : func(func), arg(arg) {}
<> 149:156823d33999 3584
<> 149:156823d33999 3585 R operator()(A0 a0, A1 a1, A2 a2, A3 a3) const {
<> 149:156823d33999 3586 return func(arg, a0, a1, a2, a3);
<> 149:156823d33999 3587 }
<> 149:156823d33999 3588 };
<> 149:156823d33999 3589 };
<> 149:156823d33999 3590
<> 149:156823d33999 3591 /** Callback class based on template specialization
<> 149:156823d33999 3592 *
<> 149:156823d33999 3593 * @Note Synchronization level: Not protected
<> 149:156823d33999 3594 */
<> 149:156823d33999 3595 template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 3596 class Callback<R(A0, A1, A2, A3, A4)> {
<> 149:156823d33999 3597 public:
<> 149:156823d33999 3598 /** Create a Callback with a static function
<> 149:156823d33999 3599 * @param func Static function to attach
<> 149:156823d33999 3600 */
<> 149:156823d33999 3601 Callback(R (*func)(A0, A1, A2, A3, A4) = 0) {
<> 149:156823d33999 3602 if (!func) {
<> 149:156823d33999 3603 _ops = 0;
<> 149:156823d33999 3604 } else {
<> 149:156823d33999 3605 generate(func);
<> 149:156823d33999 3606 }
<> 149:156823d33999 3607 }
<> 149:156823d33999 3608
<> 149:156823d33999 3609 /** Attach a Callback
<> 149:156823d33999 3610 * @param func The Callback to attach
<> 149:156823d33999 3611 */
<> 149:156823d33999 3612 Callback(const Callback<R(A0, A1, A2, A3, A4)> &func) {
<> 149:156823d33999 3613 if (func._ops) {
<> 149:156823d33999 3614 func._ops->move(this, &func);
<> 149:156823d33999 3615 }
<> 149:156823d33999 3616 _ops = func._ops;
<> 149:156823d33999 3617 }
<> 149:156823d33999 3618
<> 149:156823d33999 3619 /** Create a Callback with a member function
<> 149:156823d33999 3620 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 3621 * @param method Member function to attach
<> 149:156823d33999 3622 */
<> 149:156823d33999 3623 template<typename T>
<> 149:156823d33999 3624 Callback(T *obj, R (T::*method)(A0, A1, A2, A3, A4)) {
<> 149:156823d33999 3625 generate(method_context<T, R (T::*)(A0, A1, A2, A3, A4)>(obj, method));
<> 149:156823d33999 3626 }
<> 149:156823d33999 3627
<> 149:156823d33999 3628 /** Create a Callback with a member function
<> 149:156823d33999 3629 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 3630 * @param method Member function to attach
<> 149:156823d33999 3631 */
<> 149:156823d33999 3632 template<typename T>
<> 149:156823d33999 3633 Callback(const T *obj, R (T::*method)(A0, A1, A2, A3, A4) const) {
<> 149:156823d33999 3634 generate(method_context<const T, R (T::*)(A0, A1, A2, A3, A4) const>(obj, method));
<> 149:156823d33999 3635 }
<> 149:156823d33999 3636
<> 149:156823d33999 3637 /** Create a Callback with a member function
<> 149:156823d33999 3638 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 3639 * @param method Member function to attach
<> 149:156823d33999 3640 */
<> 149:156823d33999 3641 template<typename T>
<> 149:156823d33999 3642 Callback(volatile T *obj, R (T::*method)(A0, A1, A2, A3, A4) volatile) {
<> 149:156823d33999 3643 generate(method_context<volatile T, R (T::*)(A0, A1, A2, A3, A4) volatile>(obj, method));
<> 149:156823d33999 3644 }
<> 149:156823d33999 3645
<> 149:156823d33999 3646 /** Create a Callback with a member function
<> 149:156823d33999 3647 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 3648 * @param method Member function to attach
<> 149:156823d33999 3649 */
<> 149:156823d33999 3650 template<typename T>
<> 149:156823d33999 3651 Callback(const volatile T *obj, R (T::*method)(A0, A1, A2, A3, A4) const volatile) {
<> 149:156823d33999 3652 generate(method_context<const volatile T, R (T::*)(A0, A1, A2, A3, A4) const volatile>(obj, method));
<> 149:156823d33999 3653 }
<> 149:156823d33999 3654
<> 149:156823d33999 3655 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3656 * @param func Static function to attach
<> 149:156823d33999 3657 * @param arg Pointer argument to function
<> 149:156823d33999 3658 */
<> 149:156823d33999 3659 Callback(R (*func)(void*, A0, A1, A2, A3, A4), void *arg) {
<> 149:156823d33999 3660 generate(function_context<R (*)(void*, A0, A1, A2, A3, A4), void>(func, arg));
<> 149:156823d33999 3661 }
<> 149:156823d33999 3662
<> 149:156823d33999 3663 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3664 * @param func Static function to attach
<> 149:156823d33999 3665 * @param arg Pointer argument to function
<> 149:156823d33999 3666 */
<> 149:156823d33999 3667 Callback(R (*func)(const void*, A0, A1, A2, A3, A4), const void *arg) {
<> 149:156823d33999 3668 generate(function_context<R (*)(const void*, A0, A1, A2, A3, A4), const void>(func, arg));
<> 149:156823d33999 3669 }
<> 149:156823d33999 3670
<> 149:156823d33999 3671 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3672 * @param func Static function to attach
<> 149:156823d33999 3673 * @param arg Pointer argument to function
<> 149:156823d33999 3674 */
<> 149:156823d33999 3675 Callback(R (*func)(volatile void*, A0, A1, A2, A3, A4), volatile void *arg) {
<> 149:156823d33999 3676 generate(function_context<R (*)(volatile void*, A0, A1, A2, A3, A4), volatile void>(func, arg));
<> 149:156823d33999 3677 }
<> 149:156823d33999 3678
<> 149:156823d33999 3679 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3680 * @param func Static function to attach
<> 149:156823d33999 3681 * @param arg Pointer argument to function
<> 149:156823d33999 3682 */
<> 149:156823d33999 3683 Callback(R (*func)(const volatile void*, A0, A1, A2, A3, A4), const volatile void *arg) {
<> 149:156823d33999 3684 generate(function_context<R (*)(const volatile void*, A0, A1, A2, A3, A4), const volatile void>(func, arg));
<> 149:156823d33999 3685 }
<> 149:156823d33999 3686
<> 149:156823d33999 3687 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3688 * @param func Static function to attach
<> 149:156823d33999 3689 * @param arg Pointer argument to function
<> 149:156823d33999 3690 */
<> 149:156823d33999 3691 template<typename T>
<> 149:156823d33999 3692 Callback(R (*func)(T*, A0, A1, A2, A3, A4), T *arg) {
<> 149:156823d33999 3693 generate(function_context<R (*)(T*, A0, A1, A2, A3, A4), T>(func, arg));
<> 149:156823d33999 3694 }
<> 149:156823d33999 3695
<> 149:156823d33999 3696 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3697 * @param func Static function to attach
<> 149:156823d33999 3698 * @param arg Pointer argument to function
<> 149:156823d33999 3699 */
<> 149:156823d33999 3700 template<typename T>
<> 149:156823d33999 3701 Callback(R (*func)(const T*, A0, A1, A2, A3, A4), const T *arg) {
<> 149:156823d33999 3702 generate(function_context<R (*)(const T*, A0, A1, A2, A3, A4), const T>(func, arg));
<> 149:156823d33999 3703 }
<> 149:156823d33999 3704
<> 149:156823d33999 3705 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3706 * @param func Static function to attach
<> 149:156823d33999 3707 * @param arg Pointer argument to function
<> 149:156823d33999 3708 */
<> 149:156823d33999 3709 template<typename T>
<> 149:156823d33999 3710 Callback(R (*func)(volatile T*, A0, A1, A2, A3, A4), volatile T *arg) {
<> 149:156823d33999 3711 generate(function_context<R (*)(volatile T*, A0, A1, A2, A3, A4), volatile T>(func, arg));
<> 149:156823d33999 3712 }
<> 149:156823d33999 3713
<> 149:156823d33999 3714 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3715 * @param func Static function to attach
<> 149:156823d33999 3716 * @param arg Pointer argument to function
<> 149:156823d33999 3717 */
<> 149:156823d33999 3718 template<typename T>
<> 149:156823d33999 3719 Callback(R (*func)(const volatile T*, A0, A1, A2, A3, A4), const volatile T *arg) {
<> 149:156823d33999 3720 generate(function_context<R (*)(const volatile T*, A0, A1, A2, A3, A4), const volatile T>(func, arg));
<> 149:156823d33999 3721 }
<> 149:156823d33999 3722
<> 149:156823d33999 3723 /** Create a Callback with a function object
<> 149:156823d33999 3724 * @param func Function object to attach
<> 149:156823d33999 3725 * @note The function object is limited to a single word of storage
<> 149:156823d33999 3726 */
<> 149:156823d33999 3727 template <typename F>
<> 149:156823d33999 3728 Callback(F f, typename detail::enable_if<
<> 149:156823d33999 3729 detail::is_type<R (F::*)(A0, A1, A2, A3, A4), &F::operator()>::value &&
<> 149:156823d33999 3730 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 3731 >::type = detail::nil()) {
<> 149:156823d33999 3732 generate(f);
<> 149:156823d33999 3733 }
<> 149:156823d33999 3734
<> 149:156823d33999 3735 /** Create a Callback with a function object
<> 149:156823d33999 3736 * @param func Function object to attach
<> 149:156823d33999 3737 * @note The function object is limited to a single word of storage
<> 149:156823d33999 3738 */
<> 149:156823d33999 3739 template <typename F>
<> 149:156823d33999 3740 Callback(const F f, typename detail::enable_if<
<> 149:156823d33999 3741 detail::is_type<R (F::*)(A0, A1, A2, A3, A4) const, &F::operator()>::value &&
<> 149:156823d33999 3742 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 3743 >::type = detail::nil()) {
<> 149:156823d33999 3744 generate(f);
<> 149:156823d33999 3745 }
<> 149:156823d33999 3746
<> 149:156823d33999 3747 /** Create a Callback with a function object
<> 149:156823d33999 3748 * @param func Function object to attach
<> 149:156823d33999 3749 * @note The function object is limited to a single word of storage
<> 149:156823d33999 3750 */
<> 149:156823d33999 3751 template <typename F>
<> 149:156823d33999 3752 Callback(volatile F f, typename detail::enable_if<
<> 149:156823d33999 3753 detail::is_type<R (F::*)(A0, A1, A2, A3, A4) volatile, &F::operator()>::value &&
<> 149:156823d33999 3754 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 3755 >::type = detail::nil()) {
<> 149:156823d33999 3756 generate(f);
<> 149:156823d33999 3757 }
<> 149:156823d33999 3758
<> 149:156823d33999 3759 /** Create a Callback with a function object
<> 149:156823d33999 3760 * @param func Function object to attach
<> 149:156823d33999 3761 * @note The function object is limited to a single word of storage
<> 149:156823d33999 3762 */
<> 149:156823d33999 3763 template <typename F>
<> 149:156823d33999 3764 Callback(const volatile F f, typename detail::enable_if<
<> 149:156823d33999 3765 detail::is_type<R (F::*)(A0, A1, A2, A3, A4) const volatile, &F::operator()>::value &&
<> 149:156823d33999 3766 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 3767 >::type = detail::nil()) {
<> 149:156823d33999 3768 generate(f);
<> 149:156823d33999 3769 }
<> 149:156823d33999 3770
<> 149:156823d33999 3771 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3772 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3773 * @param func Static function to attach
<> 149:156823d33999 3774 * @deprecated
<> 149:156823d33999 3775 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3776 */
<> 149:156823d33999 3777 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3778 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3779 Callback(void *obj, R (*func)(void*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 3780 new (this) Callback(func, obj);
<> 149:156823d33999 3781 }
<> 149:156823d33999 3782
<> 149:156823d33999 3783 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3784 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3785 * @param func Static function to attach
<> 149:156823d33999 3786 * @deprecated
<> 149:156823d33999 3787 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3788 */
<> 149:156823d33999 3789 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3790 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3791 Callback(const void *obj, R (*func)(const void*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 3792 new (this) Callback(func, obj);
<> 149:156823d33999 3793 }
<> 149:156823d33999 3794
<> 149:156823d33999 3795 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3796 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3797 * @param func Static function to attach
<> 149:156823d33999 3798 * @deprecated
<> 149:156823d33999 3799 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3800 */
<> 149:156823d33999 3801 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3802 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3803 Callback(volatile void *obj, R (*func)(volatile void*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 3804 new (this) Callback(func, obj);
<> 149:156823d33999 3805 }
<> 149:156823d33999 3806
<> 149:156823d33999 3807 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3808 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3809 * @param func Static function to attach
<> 149:156823d33999 3810 * @deprecated
<> 149:156823d33999 3811 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3812 */
<> 149:156823d33999 3813 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3814 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3815 Callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 3816 new (this) Callback(func, obj);
<> 149:156823d33999 3817 }
<> 149:156823d33999 3818
<> 149:156823d33999 3819 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3820 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3821 * @param func Static function to attach
<> 149:156823d33999 3822 * @deprecated
<> 149:156823d33999 3823 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3824 */
<> 149:156823d33999 3825 template<typename T>
<> 149:156823d33999 3826 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3827 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3828 Callback(T *obj, R (*func)(T*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 3829 new (this) Callback(func, obj);
<> 149:156823d33999 3830 }
<> 149:156823d33999 3831
<> 149:156823d33999 3832 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3833 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3834 * @param func Static function to attach
<> 149:156823d33999 3835 * @deprecated
<> 149:156823d33999 3836 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3837 */
<> 149:156823d33999 3838 template<typename T>
<> 149:156823d33999 3839 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3840 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3841 Callback(const T *obj, R (*func)(const T*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 3842 new (this) Callback(func, obj);
<> 149:156823d33999 3843 }
<> 149:156823d33999 3844
<> 149:156823d33999 3845 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3846 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3847 * @param func Static function to attach
<> 149:156823d33999 3848 * @deprecated
<> 149:156823d33999 3849 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3850 */
<> 149:156823d33999 3851 template<typename T>
<> 149:156823d33999 3852 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3853 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3854 Callback(volatile T *obj, R (*func)(volatile T*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 3855 new (this) Callback(func, obj);
<> 149:156823d33999 3856 }
<> 149:156823d33999 3857
<> 149:156823d33999 3858 /** Create a Callback with a static function and bound pointer
<> 149:156823d33999 3859 * @param obj Pointer to object to bind to function
<> 149:156823d33999 3860 * @param func Static function to attach
<> 149:156823d33999 3861 * @deprecated
<> 149:156823d33999 3862 * Arguments to callback have been reordered to Callback(func, arg)
<> 149:156823d33999 3863 */
<> 149:156823d33999 3864 template<typename T>
<> 149:156823d33999 3865 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 3866 "Arguments to callback have been reordered to Callback(func, arg)")
<> 149:156823d33999 3867 Callback(const volatile T *obj, R (*func)(const volatile T*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 3868 new (this) Callback(func, obj);
<> 149:156823d33999 3869 }
<> 149:156823d33999 3870
<> 149:156823d33999 3871 /** Destroy a callback
<> 149:156823d33999 3872 */
<> 149:156823d33999 3873 ~Callback() {
<> 149:156823d33999 3874 if (_ops) {
<> 149:156823d33999 3875 _ops->dtor(this);
<> 149:156823d33999 3876 }
<> 149:156823d33999 3877 }
<> 149:156823d33999 3878
<> 149:156823d33999 3879 /** Attach a static function
<> 149:156823d33999 3880 * @param func Static function to attach
<> 149:156823d33999 3881 */
<> 149:156823d33999 3882 void attach(R (*func)(A0, A1, A2, A3, A4)) {
<> 149:156823d33999 3883 this->~Callback();
<> 149:156823d33999 3884 new (this) Callback(func);
<> 149:156823d33999 3885 }
<> 149:156823d33999 3886
<> 149:156823d33999 3887 /** Attach a Callback
<> 149:156823d33999 3888 * @param func The Callback to attach
<> 149:156823d33999 3889 */
<> 149:156823d33999 3890 void attach(const Callback<R(A0, A1, A2, A3, A4)> &func) {
<> 149:156823d33999 3891 this->~Callback();
<> 149:156823d33999 3892 new (this) Callback(func);
<> 149:156823d33999 3893 }
<> 149:156823d33999 3894
<> 149:156823d33999 3895 /** Attach a member function
<> 149:156823d33999 3896 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 3897 * @param method Member function to attach
<> 149:156823d33999 3898 */
<> 149:156823d33999 3899 template<typename T>
<> 149:156823d33999 3900 void attach(T *obj, R (T::*method)(A0, A1, A2, A3, A4)) {
<> 149:156823d33999 3901 this->~Callback();
<> 149:156823d33999 3902 new (this) Callback(obj, method);
<> 149:156823d33999 3903 }
<> 149:156823d33999 3904
<> 149:156823d33999 3905 /** Attach a member function
<> 149:156823d33999 3906 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 3907 * @param method Member function to attach
<> 149:156823d33999 3908 */
<> 149:156823d33999 3909 template<typename T>
<> 149:156823d33999 3910 void attach(const T *obj, R (T::*method)(A0, A1, A2, A3, A4) const) {
<> 149:156823d33999 3911 this->~Callback();
<> 149:156823d33999 3912 new (this) Callback(obj, method);
<> 149:156823d33999 3913 }
<> 149:156823d33999 3914
<> 149:156823d33999 3915 /** Attach a member function
<> 149:156823d33999 3916 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 3917 * @param method Member function to attach
<> 149:156823d33999 3918 */
<> 149:156823d33999 3919 template<typename T>
<> 149:156823d33999 3920 void attach(volatile T *obj, R (T::*method)(A0, A1, A2, A3, A4) volatile) {
<> 149:156823d33999 3921 this->~Callback();
<> 149:156823d33999 3922 new (this) Callback(obj, method);
<> 149:156823d33999 3923 }
<> 149:156823d33999 3924
<> 149:156823d33999 3925 /** Attach a member function
<> 149:156823d33999 3926 * @param obj Pointer to object to invoke member function on
<> 149:156823d33999 3927 * @param method Member function to attach
<> 149:156823d33999 3928 */
<> 149:156823d33999 3929 template<typename T>
<> 149:156823d33999 3930 void attach(const volatile T *obj, R (T::*method)(A0, A1, A2, A3, A4) const volatile) {
<> 149:156823d33999 3931 this->~Callback();
<> 149:156823d33999 3932 new (this) Callback(obj, method);
<> 149:156823d33999 3933 }
<> 149:156823d33999 3934
<> 149:156823d33999 3935 /** Attach a static function with a bound pointer
<> 149:156823d33999 3936 * @param func Static function to attach
<> 149:156823d33999 3937 * @param arg Pointer argument to function
<> 149:156823d33999 3938 */
<> 149:156823d33999 3939 void attach(R (*func)(void*, A0, A1, A2, A3, A4), void *arg) {
<> 149:156823d33999 3940 this->~Callback();
<> 149:156823d33999 3941 new (this) Callback(func, arg);
<> 149:156823d33999 3942 }
<> 149:156823d33999 3943
<> 149:156823d33999 3944 /** Attach a static function with a bound pointer
<> 149:156823d33999 3945 * @param func Static function to attach
<> 149:156823d33999 3946 * @param arg Pointer argument to function
<> 149:156823d33999 3947 */
<> 149:156823d33999 3948 void attach(R (*func)(const void*, A0, A1, A2, A3, A4), const void *arg) {
<> 149:156823d33999 3949 this->~Callback();
<> 149:156823d33999 3950 new (this) Callback(func, arg);
<> 149:156823d33999 3951 }
<> 149:156823d33999 3952
<> 149:156823d33999 3953 /** Attach a static function with a bound pointer
<> 149:156823d33999 3954 * @param func Static function to attach
<> 149:156823d33999 3955 * @param arg Pointer argument to function
<> 149:156823d33999 3956 */
<> 149:156823d33999 3957 void attach(R (*func)(volatile void*, A0, A1, A2, A3, A4), volatile void *arg) {
<> 149:156823d33999 3958 this->~Callback();
<> 149:156823d33999 3959 new (this) Callback(func, arg);
<> 149:156823d33999 3960 }
<> 149:156823d33999 3961
<> 149:156823d33999 3962 /** Attach a static function with a bound pointer
<> 149:156823d33999 3963 * @param func Static function to attach
<> 149:156823d33999 3964 * @param arg Pointer argument to function
<> 149:156823d33999 3965 */
<> 149:156823d33999 3966 void attach(R (*func)(const volatile void*, A0, A1, A2, A3, A4), const volatile void *arg) {
<> 149:156823d33999 3967 this->~Callback();
<> 149:156823d33999 3968 new (this) Callback(func, arg);
<> 149:156823d33999 3969 }
<> 149:156823d33999 3970
<> 149:156823d33999 3971 /** Attach a static function with a bound pointer
<> 149:156823d33999 3972 * @param func Static function to attach
<> 149:156823d33999 3973 * @param arg Pointer argument to function
<> 149:156823d33999 3974 */
<> 149:156823d33999 3975 template <typename T>
<> 149:156823d33999 3976 void attach(R (*func)(T*, A0, A1, A2, A3, A4), T *arg) {
<> 149:156823d33999 3977 this->~Callback();
<> 149:156823d33999 3978 new (this) Callback(func, arg);
<> 149:156823d33999 3979 }
<> 149:156823d33999 3980
<> 149:156823d33999 3981 /** Attach a static function with a bound pointer
<> 149:156823d33999 3982 * @param func Static function to attach
<> 149:156823d33999 3983 * @param arg Pointer argument to function
<> 149:156823d33999 3984 */
<> 149:156823d33999 3985 template <typename T>
<> 149:156823d33999 3986 void attach(R (*func)(const T*, A0, A1, A2, A3, A4), const T *arg) {
<> 149:156823d33999 3987 this->~Callback();
<> 149:156823d33999 3988 new (this) Callback(func, arg);
<> 149:156823d33999 3989 }
<> 149:156823d33999 3990
<> 149:156823d33999 3991 /** Attach a static function with a bound pointer
<> 149:156823d33999 3992 * @param func Static function to attach
<> 149:156823d33999 3993 * @param arg Pointer argument to function
<> 149:156823d33999 3994 */
<> 149:156823d33999 3995 template <typename T>
<> 149:156823d33999 3996 void attach(R (*func)(volatile T*, A0, A1, A2, A3, A4), volatile T *arg) {
<> 149:156823d33999 3997 this->~Callback();
<> 149:156823d33999 3998 new (this) Callback(func, arg);
<> 149:156823d33999 3999 }
<> 149:156823d33999 4000
<> 149:156823d33999 4001 /** Attach a static function with a bound pointer
<> 149:156823d33999 4002 * @param func Static function to attach
<> 149:156823d33999 4003 * @param arg Pointer argument to function
<> 149:156823d33999 4004 */
<> 149:156823d33999 4005 template <typename T>
<> 149:156823d33999 4006 void attach(R (*func)(const volatile T*, A0, A1, A2, A3, A4), const volatile T *arg) {
<> 149:156823d33999 4007 this->~Callback();
<> 149:156823d33999 4008 new (this) Callback(func, arg);
<> 149:156823d33999 4009 }
<> 149:156823d33999 4010
<> 149:156823d33999 4011 /** Attach a function object
<> 149:156823d33999 4012 * @param func Function object to attach
<> 149:156823d33999 4013 * @note The function object is limited to a single word of storage
<> 149:156823d33999 4014 */
<> 149:156823d33999 4015 template <typename F>
<> 149:156823d33999 4016 void attach(F f, typename detail::enable_if<
<> 149:156823d33999 4017 detail::is_type<R (F::*)(A0, A1, A2, A3, A4), &F::operator()>::value &&
<> 149:156823d33999 4018 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 4019 >::type = detail::nil()) {
<> 149:156823d33999 4020 this->~Callback();
<> 149:156823d33999 4021 new (this) Callback(f);
<> 149:156823d33999 4022 }
<> 149:156823d33999 4023
<> 149:156823d33999 4024 /** Attach a function object
<> 149:156823d33999 4025 * @param func Function object to attach
<> 149:156823d33999 4026 * @note The function object is limited to a single word of storage
<> 149:156823d33999 4027 */
<> 149:156823d33999 4028 template <typename F>
<> 149:156823d33999 4029 void attach(const F f, typename detail::enable_if<
<> 149:156823d33999 4030 detail::is_type<R (F::*)(A0, A1, A2, A3, A4) const, &F::operator()>::value &&
<> 149:156823d33999 4031 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 4032 >::type = detail::nil()) {
<> 149:156823d33999 4033 this->~Callback();
<> 149:156823d33999 4034 new (this) Callback(f);
<> 149:156823d33999 4035 }
<> 149:156823d33999 4036
<> 149:156823d33999 4037 /** Attach a function object
<> 149:156823d33999 4038 * @param func Function object to attach
<> 149:156823d33999 4039 * @note The function object is limited to a single word of storage
<> 149:156823d33999 4040 */
<> 149:156823d33999 4041 template <typename F>
<> 149:156823d33999 4042 void attach(volatile F f, typename detail::enable_if<
<> 149:156823d33999 4043 detail::is_type<R (F::*)(A0, A1, A2, A3, A4) volatile, &F::operator()>::value &&
<> 149:156823d33999 4044 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 4045 >::type = detail::nil()) {
<> 149:156823d33999 4046 this->~Callback();
<> 149:156823d33999 4047 new (this) Callback(f);
<> 149:156823d33999 4048 }
<> 149:156823d33999 4049
<> 149:156823d33999 4050 /** Attach a function object
<> 149:156823d33999 4051 * @param func Function object to attach
<> 149:156823d33999 4052 * @note The function object is limited to a single word of storage
<> 149:156823d33999 4053 */
<> 149:156823d33999 4054 template <typename F>
<> 149:156823d33999 4055 void attach(const volatile F f, typename detail::enable_if<
<> 149:156823d33999 4056 detail::is_type<R (F::*)(A0, A1, A2, A3, A4) const volatile, &F::operator()>::value &&
<> 149:156823d33999 4057 sizeof(F) <= sizeof(uintptr_t)
<> 149:156823d33999 4058 >::type = detail::nil()) {
<> 149:156823d33999 4059 this->~Callback();
<> 149:156823d33999 4060 new (this) Callback(f);
<> 149:156823d33999 4061 }
<> 149:156823d33999 4062
<> 149:156823d33999 4063 /** Attach a static function with a bound pointer
<> 149:156823d33999 4064 * @param obj Pointer to object to bind to function
<> 149:156823d33999 4065 * @param func Static function to attach
<> 149:156823d33999 4066 * @deprecated
<> 149:156823d33999 4067 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 4068 */
<> 149:156823d33999 4069 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4070 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 4071 void attach(void *obj, R (*func)(void*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 4072 this->~Callback();
<> 149:156823d33999 4073 new (this) Callback(func, obj);
<> 149:156823d33999 4074 }
<> 149:156823d33999 4075
<> 149:156823d33999 4076 /** Attach a static function with a bound pointer
<> 149:156823d33999 4077 * @param obj Pointer to object to bind to function
<> 149:156823d33999 4078 * @param func Static function to attach
<> 149:156823d33999 4079 * @deprecated
<> 149:156823d33999 4080 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 4081 */
<> 149:156823d33999 4082 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4083 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 4084 void attach(const void *obj, R (*func)(const void*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 4085 this->~Callback();
<> 149:156823d33999 4086 new (this) Callback(func, obj);
<> 149:156823d33999 4087 }
<> 149:156823d33999 4088
<> 149:156823d33999 4089 /** Attach a static function with a bound pointer
<> 149:156823d33999 4090 * @param obj Pointer to object to bind to function
<> 149:156823d33999 4091 * @param func Static function to attach
<> 149:156823d33999 4092 * @deprecated
<> 149:156823d33999 4093 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 4094 */
<> 149:156823d33999 4095 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4096 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 4097 void attach(volatile void *obj, R (*func)(volatile void*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 4098 this->~Callback();
<> 149:156823d33999 4099 new (this) Callback(func, obj);
<> 149:156823d33999 4100 }
<> 149:156823d33999 4101
<> 149:156823d33999 4102 /** Attach a static function with a bound pointer
<> 149:156823d33999 4103 * @param obj Pointer to object to bind to function
<> 149:156823d33999 4104 * @param func Static function to attach
<> 149:156823d33999 4105 * @deprecated
<> 149:156823d33999 4106 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 4107 */
<> 149:156823d33999 4108 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4109 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 4110 void attach(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 4111 this->~Callback();
<> 149:156823d33999 4112 new (this) Callback(func, obj);
<> 149:156823d33999 4113 }
<> 149:156823d33999 4114
<> 149:156823d33999 4115 /** Attach a static function with a bound pointer
<> 149:156823d33999 4116 * @param obj Pointer to object to bind to function
<> 149:156823d33999 4117 * @param func Static function to attach
<> 149:156823d33999 4118 * @deprecated
<> 149:156823d33999 4119 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 4120 */
<> 149:156823d33999 4121 template <typename T>
<> 149:156823d33999 4122 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4123 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 4124 void attach(T *obj, R (*func)(T*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 4125 this->~Callback();
<> 149:156823d33999 4126 new (this) Callback(func, obj);
<> 149:156823d33999 4127 }
<> 149:156823d33999 4128
<> 149:156823d33999 4129 /** Attach a static function with a bound pointer
<> 149:156823d33999 4130 * @param obj Pointer to object to bind to function
<> 149:156823d33999 4131 * @param func Static function to attach
<> 149:156823d33999 4132 * @deprecated
<> 149:156823d33999 4133 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 4134 */
<> 149:156823d33999 4135 template <typename T>
<> 149:156823d33999 4136 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4137 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 4138 void attach(const T *obj, R (*func)(const T*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 4139 this->~Callback();
<> 149:156823d33999 4140 new (this) Callback(func, obj);
<> 149:156823d33999 4141 }
<> 149:156823d33999 4142
<> 149:156823d33999 4143 /** Attach a static function with a bound pointer
<> 149:156823d33999 4144 * @param obj Pointer to object to bind to function
<> 149:156823d33999 4145 * @param func Static function to attach
<> 149:156823d33999 4146 * @deprecated
<> 149:156823d33999 4147 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 4148 */
<> 149:156823d33999 4149 template <typename T>
<> 149:156823d33999 4150 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4151 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 4152 void attach(volatile T *obj, R (*func)(volatile T*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 4153 this->~Callback();
<> 149:156823d33999 4154 new (this) Callback(func, obj);
<> 149:156823d33999 4155 }
<> 149:156823d33999 4156
<> 149:156823d33999 4157 /** Attach a static function with a bound pointer
<> 149:156823d33999 4158 * @param obj Pointer to object to bind to function
<> 149:156823d33999 4159 * @param func Static function to attach
<> 149:156823d33999 4160 * @deprecated
<> 149:156823d33999 4161 * Arguments to callback have been reordered to attach(func, arg)
<> 149:156823d33999 4162 */
<> 149:156823d33999 4163 template <typename T>
<> 149:156823d33999 4164 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4165 "Arguments to callback have been reordered to attach(func, arg)")
<> 149:156823d33999 4166 void attach(const volatile T *obj, R (*func)(const volatile T*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 4167 this->~Callback();
<> 149:156823d33999 4168 new (this) Callback(func, obj);
<> 149:156823d33999 4169 }
<> 149:156823d33999 4170
<> 149:156823d33999 4171 /** Assign a callback
<> 149:156823d33999 4172 */
<> 149:156823d33999 4173 Callback &operator=(const Callback &that) {
<> 149:156823d33999 4174 if (this != &that) {
<> 149:156823d33999 4175 this->~Callback();
<> 149:156823d33999 4176 new (this) Callback(that);
<> 149:156823d33999 4177 }
<> 149:156823d33999 4178
<> 149:156823d33999 4179 return *this;
<> 149:156823d33999 4180 }
<> 149:156823d33999 4181
<> 149:156823d33999 4182 /** Call the attached function
<> 149:156823d33999 4183 */
<> 149:156823d33999 4184 R call(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) const {
<> 149:156823d33999 4185 MBED_ASSERT(_ops);
<> 149:156823d33999 4186 return _ops->call(this, a0, a1, a2, a3, a4);
<> 149:156823d33999 4187 }
<> 149:156823d33999 4188
<> 149:156823d33999 4189 /** Call the attached function
<> 149:156823d33999 4190 */
<> 149:156823d33999 4191 R operator()(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) const {
<> 149:156823d33999 4192 return call(a0, a1, a2, a3, a4);
<> 149:156823d33999 4193 }
<> 149:156823d33999 4194
<> 149:156823d33999 4195 /** Test if function has been attached
<> 149:156823d33999 4196 */
<> 149:156823d33999 4197 operator bool() const {
<> 149:156823d33999 4198 return _ops;
<> 149:156823d33999 4199 }
<> 149:156823d33999 4200
<> 149:156823d33999 4201 /** Test for equality
<> 149:156823d33999 4202 */
<> 149:156823d33999 4203 friend bool operator==(const Callback &l, const Callback &r) {
<> 149:156823d33999 4204 return memcmp(&l, &r, sizeof(Callback)) == 0;
<> 149:156823d33999 4205 }
<> 149:156823d33999 4206
<> 149:156823d33999 4207 /** Test for inequality
<> 149:156823d33999 4208 */
<> 149:156823d33999 4209 friend bool operator!=(const Callback &l, const Callback &r) {
<> 149:156823d33999 4210 return !(l == r);
<> 149:156823d33999 4211 }
<> 149:156823d33999 4212
<> 149:156823d33999 4213 /** Static thunk for passing as C-style function
<> 149:156823d33999 4214 * @param func Callback to call passed as void pointer
<> 149:156823d33999 4215 */
<> 149:156823d33999 4216 static R thunk(void *func, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
<> 149:156823d33999 4217 return static_cast<Callback*>(func)->call(a0, a1, a2, a3, a4);
<> 149:156823d33999 4218 }
<> 149:156823d33999 4219
<> 149:156823d33999 4220 private:
<> 149:156823d33999 4221 // Stored as pointer to function and pointer to optional object
<> 149:156823d33999 4222 // Function pointer is stored as union of possible function types
<> 149:156823d33999 4223 // to garuntee proper size and alignment
<> 149:156823d33999 4224 struct _class;
<> 149:156823d33999 4225 union {
<> 149:156823d33999 4226 void (*_staticfunc)(A0, A1, A2, A3, A4);
<> 149:156823d33999 4227 void (*_boundfunc)(_class*, A0, A1, A2, A3, A4);
<> 149:156823d33999 4228 void (_class::*_methodfunc)(A0, A1, A2, A3, A4);
<> 149:156823d33999 4229 } _func;
<> 149:156823d33999 4230 void *_obj;
<> 149:156823d33999 4231
<> 149:156823d33999 4232 // Dynamically dispatched operations
<> 149:156823d33999 4233 const struct ops {
<> 149:156823d33999 4234 R (*call)(const void*, A0, A1, A2, A3, A4);
<> 149:156823d33999 4235 void (*move)(void*, const void*);
<> 149:156823d33999 4236 void (*dtor)(void*);
<> 149:156823d33999 4237 } *_ops;
<> 149:156823d33999 4238
<> 149:156823d33999 4239 // Generate operations for function object
<> 149:156823d33999 4240 template <typename F>
<> 149:156823d33999 4241 void generate(const F &f) {
<> 149:156823d33999 4242 static const ops ops = {
<> 149:156823d33999 4243 &Callback::function_call<F>,
<> 149:156823d33999 4244 &Callback::function_move<F>,
<> 149:156823d33999 4245 &Callback::function_dtor<F>,
<> 149:156823d33999 4246 };
<> 149:156823d33999 4247
<> 149:156823d33999 4248 MBED_ASSERT(sizeof(Callback) - sizeof(_ops) >= sizeof(F));
<> 149:156823d33999 4249 new (this) F(f);
<> 149:156823d33999 4250 _ops = &ops;
<> 149:156823d33999 4251 }
<> 149:156823d33999 4252
<> 149:156823d33999 4253 // Function attributes
<> 149:156823d33999 4254 template <typename F>
<> 149:156823d33999 4255 static R function_call(const void *p, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
<> 149:156823d33999 4256 return (*(F*)p)(a0, a1, a2, a3, a4);
<> 149:156823d33999 4257 }
<> 149:156823d33999 4258
<> 149:156823d33999 4259 template <typename F>
<> 149:156823d33999 4260 static void function_move(void *d, const void *p) {
<> 149:156823d33999 4261 new (d) F(*(F*)p);
<> 149:156823d33999 4262 }
<> 149:156823d33999 4263
<> 149:156823d33999 4264 template <typename F>
<> 149:156823d33999 4265 static void function_dtor(void *p) {
<> 149:156823d33999 4266 ((F*)p)->~F();
<> 149:156823d33999 4267 }
<> 149:156823d33999 4268
<> 149:156823d33999 4269 // Wrappers for functions with context
<> 149:156823d33999 4270 template <typename O, typename M>
<> 149:156823d33999 4271 struct method_context {
<> 149:156823d33999 4272 M method;
<> 149:156823d33999 4273 O *obj;
<> 149:156823d33999 4274
<> 149:156823d33999 4275 method_context(O *obj, M method)
<> 149:156823d33999 4276 : method(method), obj(obj) {}
<> 149:156823d33999 4277
<> 149:156823d33999 4278 R operator()(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) const {
<> 149:156823d33999 4279 return (obj->*method)(a0, a1, a2, a3, a4);
<> 149:156823d33999 4280 }
<> 149:156823d33999 4281 };
<> 149:156823d33999 4282
<> 149:156823d33999 4283 template <typename F, typename A>
<> 149:156823d33999 4284 struct function_context {
<> 149:156823d33999 4285 F func;
<> 149:156823d33999 4286 A *arg;
<> 149:156823d33999 4287
<> 149:156823d33999 4288 function_context(F func, A *arg)
<> 149:156823d33999 4289 : func(func), arg(arg) {}
<> 149:156823d33999 4290
<> 149:156823d33999 4291 R operator()(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) const {
<> 149:156823d33999 4292 return func(arg, a0, a1, a2, a3, a4);
<> 149:156823d33999 4293 }
<> 149:156823d33999 4294 };
<> 149:156823d33999 4295 };
<> 149:156823d33999 4296
<> 149:156823d33999 4297 // Internally used event type
<> 149:156823d33999 4298 typedef Callback<void(int)> event_callback_t;
<> 149:156823d33999 4299
<> 149:156823d33999 4300
<> 149:156823d33999 4301 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4302 *
<> 149:156823d33999 4303 * @param func Static function to attach
<> 149:156823d33999 4304 * @return Callback with infered type
<> 149:156823d33999 4305 */
<> 149:156823d33999 4306 template <typename R>
<> 149:156823d33999 4307 Callback<R()> callback(R (*func)() = 0) {
<> 149:156823d33999 4308 return Callback<R()>(func);
<> 149:156823d33999 4309 }
<> 149:156823d33999 4310
<> 149:156823d33999 4311 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4312 *
<> 149:156823d33999 4313 * @param func Static function to attach
<> 149:156823d33999 4314 * @return Callback with infered type
<> 149:156823d33999 4315 */
<> 149:156823d33999 4316 template <typename R>
<> 149:156823d33999 4317 Callback<R()> callback(const Callback<R()> &func) {
<> 149:156823d33999 4318 return Callback<R()>(func);
<> 149:156823d33999 4319 }
<> 149:156823d33999 4320
<> 149:156823d33999 4321 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4322 *
<> 149:156823d33999 4323 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4324 * @param method Member function to attach
<> 149:156823d33999 4325 * @return Callback with infered type
<> 149:156823d33999 4326 */
<> 149:156823d33999 4327 template<typename T, typename R>
<> 149:156823d33999 4328 Callback<R()> callback(T *obj, R (T::*func)()) {
<> 149:156823d33999 4329 return Callback<R()>(obj, func);
<> 149:156823d33999 4330 }
<> 149:156823d33999 4331
<> 149:156823d33999 4332 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4333 *
<> 149:156823d33999 4334 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4335 * @param method Member function to attach
<> 149:156823d33999 4336 * @return Callback with infered type
<> 149:156823d33999 4337 */
<> 149:156823d33999 4338 template<typename T, typename R>
<> 149:156823d33999 4339 Callback<R()> callback(const T *obj, R (T::*func)() const) {
<> 149:156823d33999 4340 return Callback<R()>(obj, func);
<> 149:156823d33999 4341 }
<> 149:156823d33999 4342
<> 149:156823d33999 4343 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4344 *
<> 149:156823d33999 4345 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4346 * @param method Member function to attach
<> 149:156823d33999 4347 * @return Callback with infered type
<> 149:156823d33999 4348 */
<> 149:156823d33999 4349 template<typename T, typename R>
<> 149:156823d33999 4350 Callback<R()> callback(volatile T *obj, R (T::*func)() volatile) {
<> 149:156823d33999 4351 return Callback<R()>(obj, func);
<> 149:156823d33999 4352 }
<> 149:156823d33999 4353
<> 149:156823d33999 4354 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4355 *
<> 149:156823d33999 4356 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4357 * @param method Member function to attach
<> 149:156823d33999 4358 * @return Callback with infered type
<> 149:156823d33999 4359 */
<> 149:156823d33999 4360 template<typename T, typename R>
<> 149:156823d33999 4361 Callback<R()> callback(const volatile T *obj, R (T::*func)() const volatile) {
<> 149:156823d33999 4362 return Callback<R()>(obj, func);
<> 149:156823d33999 4363 }
<> 149:156823d33999 4364
<> 149:156823d33999 4365 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4366 *
<> 149:156823d33999 4367 * @param func Static function to attach
<> 149:156823d33999 4368 * @param arg Pointer argument to function
<> 149:156823d33999 4369 * @return Callback with infered type
<> 149:156823d33999 4370 */
<> 149:156823d33999 4371 template <typename R>
<> 149:156823d33999 4372 Callback<R()> callback(R (*func)(void*), void *arg) {
<> 149:156823d33999 4373 return Callback<R()>(func, arg);
<> 149:156823d33999 4374 }
<> 149:156823d33999 4375
<> 149:156823d33999 4376 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4377 *
<> 149:156823d33999 4378 * @param func Static function to attach
<> 149:156823d33999 4379 * @param arg Pointer argument to function
<> 149:156823d33999 4380 * @return Callback with infered type
<> 149:156823d33999 4381 */
<> 149:156823d33999 4382 template <typename R>
<> 149:156823d33999 4383 Callback<R()> callback(R (*func)(const void*), const void *arg) {
<> 149:156823d33999 4384 return Callback<R()>(func, arg);
<> 149:156823d33999 4385 }
<> 149:156823d33999 4386
<> 149:156823d33999 4387 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4388 *
<> 149:156823d33999 4389 * @param func Static function to attach
<> 149:156823d33999 4390 * @param arg Pointer argument to function
<> 149:156823d33999 4391 * @return Callback with infered type
<> 149:156823d33999 4392 */
<> 149:156823d33999 4393 template <typename R>
<> 149:156823d33999 4394 Callback<R()> callback(R (*func)(volatile void*), volatile void *arg) {
<> 149:156823d33999 4395 return Callback<R()>(func, arg);
<> 149:156823d33999 4396 }
<> 149:156823d33999 4397
<> 149:156823d33999 4398 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4399 *
<> 149:156823d33999 4400 * @param func Static function to attach
<> 149:156823d33999 4401 * @param arg Pointer argument to function
<> 149:156823d33999 4402 * @return Callback with infered type
<> 149:156823d33999 4403 */
<> 149:156823d33999 4404 template <typename R>
<> 149:156823d33999 4405 Callback<R()> callback(R (*func)(const volatile void*), const volatile void *arg) {
<> 149:156823d33999 4406 return Callback<R()>(func, arg);
<> 149:156823d33999 4407 }
<> 149:156823d33999 4408
<> 149:156823d33999 4409 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4410 *
<> 149:156823d33999 4411 * @param func Static function to attach
<> 149:156823d33999 4412 * @param arg Pointer argument to function
<> 149:156823d33999 4413 * @return Callback with infered type
<> 149:156823d33999 4414 */
<> 149:156823d33999 4415 template <typename T, typename R>
<> 149:156823d33999 4416 Callback<R()> callback(R (*func)(T*), T *arg) {
<> 149:156823d33999 4417 return Callback<R()>(func, arg);
<> 149:156823d33999 4418 }
<> 149:156823d33999 4419
<> 149:156823d33999 4420 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4421 *
<> 149:156823d33999 4422 * @param func Static function to attach
<> 149:156823d33999 4423 * @param arg Pointer argument to function
<> 149:156823d33999 4424 * @return Callback with infered type
<> 149:156823d33999 4425 */
<> 149:156823d33999 4426 template <typename T, typename R>
<> 149:156823d33999 4427 Callback<R()> callback(R (*func)(const T*), const T *arg) {
<> 149:156823d33999 4428 return Callback<R()>(func, arg);
<> 149:156823d33999 4429 }
<> 149:156823d33999 4430
<> 149:156823d33999 4431 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4432 *
<> 149:156823d33999 4433 * @param func Static function to attach
<> 149:156823d33999 4434 * @param arg Pointer argument to function
<> 149:156823d33999 4435 * @return Callback with infered type
<> 149:156823d33999 4436 */
<> 149:156823d33999 4437 template <typename T, typename R>
<> 149:156823d33999 4438 Callback<R()> callback(R (*func)(volatile T*), volatile T *arg) {
<> 149:156823d33999 4439 return Callback<R()>(func, arg);
<> 149:156823d33999 4440 }
<> 149:156823d33999 4441
<> 149:156823d33999 4442 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4443 *
<> 149:156823d33999 4444 * @param func Static function to attach
<> 149:156823d33999 4445 * @param arg Pointer argument to function
<> 149:156823d33999 4446 * @return Callback with infered type
<> 149:156823d33999 4447 */
<> 149:156823d33999 4448 template <typename T, typename R>
<> 149:156823d33999 4449 Callback<R()> callback(R (*func)(const volatile T*), const volatile T *arg) {
<> 149:156823d33999 4450 return Callback<R()>(func, arg);
<> 149:156823d33999 4451 }
<> 149:156823d33999 4452
<> 149:156823d33999 4453 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4454 *
<> 149:156823d33999 4455 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4456 * @param func Static function to attach
<> 149:156823d33999 4457 * @return Callback with infered type
<> 149:156823d33999 4458 * @deprecated
<> 149:156823d33999 4459 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4460 */
<> 149:156823d33999 4461 template <typename R>
<> 149:156823d33999 4462 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4463 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4464 Callback<R()> callback(void *obj, R (*func)(void*)) {
<> 149:156823d33999 4465 return Callback<R()>(func, obj);
<> 149:156823d33999 4466 }
<> 149:156823d33999 4467
<> 149:156823d33999 4468 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4469 *
<> 149:156823d33999 4470 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4471 * @param func Static function to attach
<> 149:156823d33999 4472 * @return Callback with infered type
<> 149:156823d33999 4473 * @deprecated
<> 149:156823d33999 4474 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4475 */
<> 149:156823d33999 4476 template <typename R>
<> 149:156823d33999 4477 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4478 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4479 Callback<R()> callback(const void *obj, R (*func)(const void*)) {
<> 149:156823d33999 4480 return Callback<R()>(func, obj);
<> 149:156823d33999 4481 }
<> 149:156823d33999 4482
<> 149:156823d33999 4483 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4484 *
<> 149:156823d33999 4485 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4486 * @param func Static function to attach
<> 149:156823d33999 4487 * @return Callback with infered type
<> 149:156823d33999 4488 * @deprecated
<> 149:156823d33999 4489 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4490 */
<> 149:156823d33999 4491 template <typename R>
<> 149:156823d33999 4492 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4493 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4494 Callback<R()> callback(volatile void *obj, R (*func)(volatile void*)) {
<> 149:156823d33999 4495 return Callback<R()>(func, obj);
<> 149:156823d33999 4496 }
<> 149:156823d33999 4497
<> 149:156823d33999 4498 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4499 *
<> 149:156823d33999 4500 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4501 * @param func Static function to attach
<> 149:156823d33999 4502 * @return Callback with infered type
<> 149:156823d33999 4503 * @deprecated
<> 149:156823d33999 4504 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4505 */
<> 149:156823d33999 4506 template <typename R>
<> 149:156823d33999 4507 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4508 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4509 Callback<R()> callback(const volatile void *obj, R (*func)(const volatile void*)) {
<> 149:156823d33999 4510 return Callback<R()>(func, obj);
<> 149:156823d33999 4511 }
<> 149:156823d33999 4512
<> 149:156823d33999 4513 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4514 *
<> 149:156823d33999 4515 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4516 * @param func Static function to attach
<> 149:156823d33999 4517 * @return Callback with infered type
<> 149:156823d33999 4518 * @deprecated
<> 149:156823d33999 4519 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4520 */
<> 149:156823d33999 4521 template <typename T, typename R>
<> 149:156823d33999 4522 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4523 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4524 Callback<R()> callback(T *obj, R (*func)(T*)) {
<> 149:156823d33999 4525 return Callback<R()>(func, obj);
<> 149:156823d33999 4526 }
<> 149:156823d33999 4527
<> 149:156823d33999 4528 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4529 *
<> 149:156823d33999 4530 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4531 * @param func Static function to attach
<> 149:156823d33999 4532 * @return Callback with infered type
<> 149:156823d33999 4533 * @deprecated
<> 149:156823d33999 4534 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4535 */
<> 149:156823d33999 4536 template <typename T, typename R>
<> 149:156823d33999 4537 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4538 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4539 Callback<R()> callback(const T *obj, R (*func)(const T*)) {
<> 149:156823d33999 4540 return Callback<R()>(func, obj);
<> 149:156823d33999 4541 }
<> 149:156823d33999 4542
<> 149:156823d33999 4543 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4544 *
<> 149:156823d33999 4545 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4546 * @param func Static function to attach
<> 149:156823d33999 4547 * @return Callback with infered type
<> 149:156823d33999 4548 * @deprecated
<> 149:156823d33999 4549 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4550 */
<> 149:156823d33999 4551 template <typename T, typename R>
<> 149:156823d33999 4552 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4553 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4554 Callback<R()> callback(volatile T *obj, R (*func)(volatile T*)) {
<> 149:156823d33999 4555 return Callback<R()>(func, obj);
<> 149:156823d33999 4556 }
<> 149:156823d33999 4557
<> 149:156823d33999 4558 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4559 *
<> 149:156823d33999 4560 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4561 * @param func Static function to attach
<> 149:156823d33999 4562 * @return Callback with infered type
<> 149:156823d33999 4563 * @deprecated
<> 149:156823d33999 4564 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4565 */
<> 149:156823d33999 4566 template <typename T, typename R>
<> 149:156823d33999 4567 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4568 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4569 Callback<R()> callback(const volatile T *obj, R (*func)(const volatile T*)) {
<> 149:156823d33999 4570 return Callback<R()>(func, obj);
<> 149:156823d33999 4571 }
<> 149:156823d33999 4572
<> 149:156823d33999 4573
<> 149:156823d33999 4574 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4575 *
<> 149:156823d33999 4576 * @param func Static function to attach
<> 149:156823d33999 4577 * @return Callback with infered type
<> 149:156823d33999 4578 */
<> 149:156823d33999 4579 template <typename R, typename A0>
<> 149:156823d33999 4580 Callback<R(A0)> callback(R (*func)(A0) = 0) {
<> 149:156823d33999 4581 return Callback<R(A0)>(func);
<> 149:156823d33999 4582 }
<> 149:156823d33999 4583
<> 149:156823d33999 4584 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4585 *
<> 149:156823d33999 4586 * @param func Static function to attach
<> 149:156823d33999 4587 * @return Callback with infered type
<> 149:156823d33999 4588 */
<> 149:156823d33999 4589 template <typename R, typename A0>
<> 149:156823d33999 4590 Callback<R(A0)> callback(const Callback<R(A0)> &func) {
<> 149:156823d33999 4591 return Callback<R(A0)>(func);
<> 149:156823d33999 4592 }
<> 149:156823d33999 4593
<> 149:156823d33999 4594 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4595 *
<> 149:156823d33999 4596 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4597 * @param method Member function to attach
<> 149:156823d33999 4598 * @return Callback with infered type
<> 149:156823d33999 4599 */
<> 149:156823d33999 4600 template<typename T, typename R, typename A0>
<> 149:156823d33999 4601 Callback<R(A0)> callback(T *obj, R (T::*func)(A0)) {
<> 149:156823d33999 4602 return Callback<R(A0)>(obj, func);
<> 149:156823d33999 4603 }
<> 149:156823d33999 4604
<> 149:156823d33999 4605 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4606 *
<> 149:156823d33999 4607 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4608 * @param method Member function to attach
<> 149:156823d33999 4609 * @return Callback with infered type
<> 149:156823d33999 4610 */
<> 149:156823d33999 4611 template<typename T, typename R, typename A0>
<> 149:156823d33999 4612 Callback<R(A0)> callback(const T *obj, R (T::*func)(A0) const) {
<> 149:156823d33999 4613 return Callback<R(A0)>(obj, func);
<> 149:156823d33999 4614 }
<> 149:156823d33999 4615
<> 149:156823d33999 4616 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4617 *
<> 149:156823d33999 4618 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4619 * @param method Member function to attach
<> 149:156823d33999 4620 * @return Callback with infered type
<> 149:156823d33999 4621 */
<> 149:156823d33999 4622 template<typename T, typename R, typename A0>
<> 149:156823d33999 4623 Callback<R(A0)> callback(volatile T *obj, R (T::*func)(A0) volatile) {
<> 149:156823d33999 4624 return Callback<R(A0)>(obj, func);
<> 149:156823d33999 4625 }
<> 149:156823d33999 4626
<> 149:156823d33999 4627 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4628 *
<> 149:156823d33999 4629 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4630 * @param method Member function to attach
<> 149:156823d33999 4631 * @return Callback with infered type
<> 149:156823d33999 4632 */
<> 149:156823d33999 4633 template<typename T, typename R, typename A0>
<> 149:156823d33999 4634 Callback<R(A0)> callback(const volatile T *obj, R (T::*func)(A0) const volatile) {
<> 149:156823d33999 4635 return Callback<R(A0)>(obj, func);
<> 149:156823d33999 4636 }
<> 149:156823d33999 4637
<> 149:156823d33999 4638 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4639 *
<> 149:156823d33999 4640 * @param func Static function to attach
<> 149:156823d33999 4641 * @param arg Pointer argument to function
<> 149:156823d33999 4642 * @return Callback with infered type
<> 149:156823d33999 4643 */
<> 149:156823d33999 4644 template <typename R, typename A0>
<> 149:156823d33999 4645 Callback<R(A0)> callback(R (*func)(void*, A0), void *arg) {
<> 149:156823d33999 4646 return Callback<R(A0)>(func, arg);
<> 149:156823d33999 4647 }
<> 149:156823d33999 4648
<> 149:156823d33999 4649 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4650 *
<> 149:156823d33999 4651 * @param func Static function to attach
<> 149:156823d33999 4652 * @param arg Pointer argument to function
<> 149:156823d33999 4653 * @return Callback with infered type
<> 149:156823d33999 4654 */
<> 149:156823d33999 4655 template <typename R, typename A0>
<> 149:156823d33999 4656 Callback<R(A0)> callback(R (*func)(const void*, A0), const void *arg) {
<> 149:156823d33999 4657 return Callback<R(A0)>(func, arg);
<> 149:156823d33999 4658 }
<> 149:156823d33999 4659
<> 149:156823d33999 4660 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4661 *
<> 149:156823d33999 4662 * @param func Static function to attach
<> 149:156823d33999 4663 * @param arg Pointer argument to function
<> 149:156823d33999 4664 * @return Callback with infered type
<> 149:156823d33999 4665 */
<> 149:156823d33999 4666 template <typename R, typename A0>
<> 149:156823d33999 4667 Callback<R(A0)> callback(R (*func)(volatile void*, A0), volatile void *arg) {
<> 149:156823d33999 4668 return Callback<R(A0)>(func, arg);
<> 149:156823d33999 4669 }
<> 149:156823d33999 4670
<> 149:156823d33999 4671 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4672 *
<> 149:156823d33999 4673 * @param func Static function to attach
<> 149:156823d33999 4674 * @param arg Pointer argument to function
<> 149:156823d33999 4675 * @return Callback with infered type
<> 149:156823d33999 4676 */
<> 149:156823d33999 4677 template <typename R, typename A0>
<> 149:156823d33999 4678 Callback<R(A0)> callback(R (*func)(const volatile void*, A0), const volatile void *arg) {
<> 149:156823d33999 4679 return Callback<R(A0)>(func, arg);
<> 149:156823d33999 4680 }
<> 149:156823d33999 4681
<> 149:156823d33999 4682 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4683 *
<> 149:156823d33999 4684 * @param func Static function to attach
<> 149:156823d33999 4685 * @param arg Pointer argument to function
<> 149:156823d33999 4686 * @return Callback with infered type
<> 149:156823d33999 4687 */
<> 149:156823d33999 4688 template <typename T, typename R, typename A0>
<> 149:156823d33999 4689 Callback<R(A0)> callback(R (*func)(T*, A0), T *arg) {
<> 149:156823d33999 4690 return Callback<R(A0)>(func, arg);
<> 149:156823d33999 4691 }
<> 149:156823d33999 4692
<> 149:156823d33999 4693 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4694 *
<> 149:156823d33999 4695 * @param func Static function to attach
<> 149:156823d33999 4696 * @param arg Pointer argument to function
<> 149:156823d33999 4697 * @return Callback with infered type
<> 149:156823d33999 4698 */
<> 149:156823d33999 4699 template <typename T, typename R, typename A0>
<> 149:156823d33999 4700 Callback<R(A0)> callback(R (*func)(const T*, A0), const T *arg) {
<> 149:156823d33999 4701 return Callback<R(A0)>(func, arg);
<> 149:156823d33999 4702 }
<> 149:156823d33999 4703
<> 149:156823d33999 4704 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4705 *
<> 149:156823d33999 4706 * @param func Static function to attach
<> 149:156823d33999 4707 * @param arg Pointer argument to function
<> 149:156823d33999 4708 * @return Callback with infered type
<> 149:156823d33999 4709 */
<> 149:156823d33999 4710 template <typename T, typename R, typename A0>
<> 149:156823d33999 4711 Callback<R(A0)> callback(R (*func)(volatile T*, A0), volatile T *arg) {
<> 149:156823d33999 4712 return Callback<R(A0)>(func, arg);
<> 149:156823d33999 4713 }
<> 149:156823d33999 4714
<> 149:156823d33999 4715 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4716 *
<> 149:156823d33999 4717 * @param func Static function to attach
<> 149:156823d33999 4718 * @param arg Pointer argument to function
<> 149:156823d33999 4719 * @return Callback with infered type
<> 149:156823d33999 4720 */
<> 149:156823d33999 4721 template <typename T, typename R, typename A0>
<> 149:156823d33999 4722 Callback<R(A0)> callback(R (*func)(const volatile T*, A0), const volatile T *arg) {
<> 149:156823d33999 4723 return Callback<R(A0)>(func, arg);
<> 149:156823d33999 4724 }
<> 149:156823d33999 4725
<> 149:156823d33999 4726 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4727 *
<> 149:156823d33999 4728 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4729 * @param func Static function to attach
<> 149:156823d33999 4730 * @return Callback with infered type
<> 149:156823d33999 4731 * @deprecated
<> 149:156823d33999 4732 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4733 */
<> 149:156823d33999 4734 template <typename R, typename A0>
<> 149:156823d33999 4735 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4736 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4737 Callback<R(A0)> callback(void *obj, R (*func)(void*, A0)) {
<> 149:156823d33999 4738 return Callback<R(A0)>(func, obj);
<> 149:156823d33999 4739 }
<> 149:156823d33999 4740
<> 149:156823d33999 4741 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4742 *
<> 149:156823d33999 4743 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4744 * @param func Static function to attach
<> 149:156823d33999 4745 * @return Callback with infered type
<> 149:156823d33999 4746 * @deprecated
<> 149:156823d33999 4747 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4748 */
<> 149:156823d33999 4749 template <typename R, typename A0>
<> 149:156823d33999 4750 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4751 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4752 Callback<R(A0)> callback(const void *obj, R (*func)(const void*, A0)) {
<> 149:156823d33999 4753 return Callback<R(A0)>(func, obj);
<> 149:156823d33999 4754 }
<> 149:156823d33999 4755
<> 149:156823d33999 4756 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4757 *
<> 149:156823d33999 4758 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4759 * @param func Static function to attach
<> 149:156823d33999 4760 * @return Callback with infered type
<> 149:156823d33999 4761 * @deprecated
<> 149:156823d33999 4762 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4763 */
<> 149:156823d33999 4764 template <typename R, typename A0>
<> 149:156823d33999 4765 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4766 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4767 Callback<R(A0)> callback(volatile void *obj, R (*func)(volatile void*, A0)) {
<> 149:156823d33999 4768 return Callback<R(A0)>(func, obj);
<> 149:156823d33999 4769 }
<> 149:156823d33999 4770
<> 149:156823d33999 4771 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4772 *
<> 149:156823d33999 4773 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4774 * @param func Static function to attach
<> 149:156823d33999 4775 * @return Callback with infered type
<> 149:156823d33999 4776 * @deprecated
<> 149:156823d33999 4777 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4778 */
<> 149:156823d33999 4779 template <typename R, typename A0>
<> 149:156823d33999 4780 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4781 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4782 Callback<R(A0)> callback(const volatile void *obj, R (*func)(const volatile void*, A0)) {
<> 149:156823d33999 4783 return Callback<R(A0)>(func, obj);
<> 149:156823d33999 4784 }
<> 149:156823d33999 4785
<> 149:156823d33999 4786 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4787 *
<> 149:156823d33999 4788 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4789 * @param func Static function to attach
<> 149:156823d33999 4790 * @return Callback with infered type
<> 149:156823d33999 4791 * @deprecated
<> 149:156823d33999 4792 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4793 */
<> 149:156823d33999 4794 template <typename T, typename R, typename A0>
<> 149:156823d33999 4795 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4796 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4797 Callback<R(A0)> callback(T *obj, R (*func)(T*, A0)) {
<> 149:156823d33999 4798 return Callback<R(A0)>(func, obj);
<> 149:156823d33999 4799 }
<> 149:156823d33999 4800
<> 149:156823d33999 4801 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4802 *
<> 149:156823d33999 4803 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4804 * @param func Static function to attach
<> 149:156823d33999 4805 * @return Callback with infered type
<> 149:156823d33999 4806 * @deprecated
<> 149:156823d33999 4807 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4808 */
<> 149:156823d33999 4809 template <typename T, typename R, typename A0>
<> 149:156823d33999 4810 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4811 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4812 Callback<R(A0)> callback(const T *obj, R (*func)(const T*, A0)) {
<> 149:156823d33999 4813 return Callback<R(A0)>(func, obj);
<> 149:156823d33999 4814 }
<> 149:156823d33999 4815
<> 149:156823d33999 4816 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4817 *
<> 149:156823d33999 4818 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4819 * @param func Static function to attach
<> 149:156823d33999 4820 * @return Callback with infered type
<> 149:156823d33999 4821 * @deprecated
<> 149:156823d33999 4822 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4823 */
<> 149:156823d33999 4824 template <typename T, typename R, typename A0>
<> 149:156823d33999 4825 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4826 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4827 Callback<R(A0)> callback(volatile T *obj, R (*func)(volatile T*, A0)) {
<> 149:156823d33999 4828 return Callback<R(A0)>(func, obj);
<> 149:156823d33999 4829 }
<> 149:156823d33999 4830
<> 149:156823d33999 4831 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4832 *
<> 149:156823d33999 4833 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4834 * @param func Static function to attach
<> 149:156823d33999 4835 * @return Callback with infered type
<> 149:156823d33999 4836 * @deprecated
<> 149:156823d33999 4837 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 4838 */
<> 149:156823d33999 4839 template <typename T, typename R, typename A0>
<> 149:156823d33999 4840 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 4841 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 4842 Callback<R(A0)> callback(const volatile T *obj, R (*func)(const volatile T*, A0)) {
<> 149:156823d33999 4843 return Callback<R(A0)>(func, obj);
<> 149:156823d33999 4844 }
<> 149:156823d33999 4845
<> 149:156823d33999 4846
<> 149:156823d33999 4847 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4848 *
<> 149:156823d33999 4849 * @param func Static function to attach
<> 149:156823d33999 4850 * @return Callback with infered type
<> 149:156823d33999 4851 */
<> 149:156823d33999 4852 template <typename R, typename A0, typename A1>
<> 149:156823d33999 4853 Callback<R(A0, A1)> callback(R (*func)(A0, A1) = 0) {
<> 149:156823d33999 4854 return Callback<R(A0, A1)>(func);
<> 149:156823d33999 4855 }
<> 149:156823d33999 4856
<> 149:156823d33999 4857 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4858 *
<> 149:156823d33999 4859 * @param func Static function to attach
<> 149:156823d33999 4860 * @return Callback with infered type
<> 149:156823d33999 4861 */
<> 149:156823d33999 4862 template <typename R, typename A0, typename A1>
<> 149:156823d33999 4863 Callback<R(A0, A1)> callback(const Callback<R(A0, A1)> &func) {
<> 149:156823d33999 4864 return Callback<R(A0, A1)>(func);
<> 149:156823d33999 4865 }
<> 149:156823d33999 4866
<> 149:156823d33999 4867 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4868 *
<> 149:156823d33999 4869 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4870 * @param method Member function to attach
<> 149:156823d33999 4871 * @return Callback with infered type
<> 149:156823d33999 4872 */
<> 149:156823d33999 4873 template<typename T, typename R, typename A0, typename A1>
<> 149:156823d33999 4874 Callback<R(A0, A1)> callback(T *obj, R (T::*func)(A0, A1)) {
<> 149:156823d33999 4875 return Callback<R(A0, A1)>(obj, func);
<> 149:156823d33999 4876 }
<> 149:156823d33999 4877
<> 149:156823d33999 4878 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4879 *
<> 149:156823d33999 4880 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4881 * @param method Member function to attach
<> 149:156823d33999 4882 * @return Callback with infered type
<> 149:156823d33999 4883 */
<> 149:156823d33999 4884 template<typename T, typename R, typename A0, typename A1>
<> 149:156823d33999 4885 Callback<R(A0, A1)> callback(const T *obj, R (T::*func)(A0, A1) const) {
<> 149:156823d33999 4886 return Callback<R(A0, A1)>(obj, func);
<> 149:156823d33999 4887 }
<> 149:156823d33999 4888
<> 149:156823d33999 4889 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4890 *
<> 149:156823d33999 4891 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4892 * @param method Member function to attach
<> 149:156823d33999 4893 * @return Callback with infered type
<> 149:156823d33999 4894 */
<> 149:156823d33999 4895 template<typename T, typename R, typename A0, typename A1>
<> 149:156823d33999 4896 Callback<R(A0, A1)> callback(volatile T *obj, R (T::*func)(A0, A1) volatile) {
<> 149:156823d33999 4897 return Callback<R(A0, A1)>(obj, func);
<> 149:156823d33999 4898 }
<> 149:156823d33999 4899
<> 149:156823d33999 4900 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4901 *
<> 149:156823d33999 4902 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 4903 * @param method Member function to attach
<> 149:156823d33999 4904 * @return Callback with infered type
<> 149:156823d33999 4905 */
<> 149:156823d33999 4906 template<typename T, typename R, typename A0, typename A1>
<> 149:156823d33999 4907 Callback<R(A0, A1)> callback(const volatile T *obj, R (T::*func)(A0, A1) const volatile) {
<> 149:156823d33999 4908 return Callback<R(A0, A1)>(obj, func);
<> 149:156823d33999 4909 }
<> 149:156823d33999 4910
<> 149:156823d33999 4911 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4912 *
<> 149:156823d33999 4913 * @param func Static function to attach
<> 149:156823d33999 4914 * @param arg Pointer argument to function
<> 149:156823d33999 4915 * @return Callback with infered type
<> 149:156823d33999 4916 */
<> 149:156823d33999 4917 template <typename R, typename A0, typename A1>
<> 149:156823d33999 4918 Callback<R(A0, A1)> callback(R (*func)(void*, A0, A1), void *arg) {
<> 149:156823d33999 4919 return Callback<R(A0, A1)>(func, arg);
<> 149:156823d33999 4920 }
<> 149:156823d33999 4921
<> 149:156823d33999 4922 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4923 *
<> 149:156823d33999 4924 * @param func Static function to attach
<> 149:156823d33999 4925 * @param arg Pointer argument to function
<> 149:156823d33999 4926 * @return Callback with infered type
<> 149:156823d33999 4927 */
<> 149:156823d33999 4928 template <typename R, typename A0, typename A1>
<> 149:156823d33999 4929 Callback<R(A0, A1)> callback(R (*func)(const void*, A0, A1), const void *arg) {
<> 149:156823d33999 4930 return Callback<R(A0, A1)>(func, arg);
<> 149:156823d33999 4931 }
<> 149:156823d33999 4932
<> 149:156823d33999 4933 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4934 *
<> 149:156823d33999 4935 * @param func Static function to attach
<> 149:156823d33999 4936 * @param arg Pointer argument to function
<> 149:156823d33999 4937 * @return Callback with infered type
<> 149:156823d33999 4938 */
<> 149:156823d33999 4939 template <typename R, typename A0, typename A1>
<> 149:156823d33999 4940 Callback<R(A0, A1)> callback(R (*func)(volatile void*, A0, A1), volatile void *arg) {
<> 149:156823d33999 4941 return Callback<R(A0, A1)>(func, arg);
<> 149:156823d33999 4942 }
<> 149:156823d33999 4943
<> 149:156823d33999 4944 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4945 *
<> 149:156823d33999 4946 * @param func Static function to attach
<> 149:156823d33999 4947 * @param arg Pointer argument to function
<> 149:156823d33999 4948 * @return Callback with infered type
<> 149:156823d33999 4949 */
<> 149:156823d33999 4950 template <typename R, typename A0, typename A1>
<> 149:156823d33999 4951 Callback<R(A0, A1)> callback(R (*func)(const volatile void*, A0, A1), const volatile void *arg) {
<> 149:156823d33999 4952 return Callback<R(A0, A1)>(func, arg);
<> 149:156823d33999 4953 }
<> 149:156823d33999 4954
<> 149:156823d33999 4955 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4956 *
<> 149:156823d33999 4957 * @param func Static function to attach
<> 149:156823d33999 4958 * @param arg Pointer argument to function
<> 149:156823d33999 4959 * @return Callback with infered type
<> 149:156823d33999 4960 */
<> 149:156823d33999 4961 template <typename T, typename R, typename A0, typename A1>
<> 149:156823d33999 4962 Callback<R(A0, A1)> callback(R (*func)(T*, A0, A1), T *arg) {
<> 149:156823d33999 4963 return Callback<R(A0, A1)>(func, arg);
<> 149:156823d33999 4964 }
<> 149:156823d33999 4965
<> 149:156823d33999 4966 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4967 *
<> 149:156823d33999 4968 * @param func Static function to attach
<> 149:156823d33999 4969 * @param arg Pointer argument to function
<> 149:156823d33999 4970 * @return Callback with infered type
<> 149:156823d33999 4971 */
<> 149:156823d33999 4972 template <typename T, typename R, typename A0, typename A1>
<> 149:156823d33999 4973 Callback<R(A0, A1)> callback(R (*func)(const T*, A0, A1), const T *arg) {
<> 149:156823d33999 4974 return Callback<R(A0, A1)>(func, arg);
<> 149:156823d33999 4975 }
<> 149:156823d33999 4976
<> 149:156823d33999 4977 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4978 *
<> 149:156823d33999 4979 * @param func Static function to attach
<> 149:156823d33999 4980 * @param arg Pointer argument to function
<> 149:156823d33999 4981 * @return Callback with infered type
<> 149:156823d33999 4982 */
<> 149:156823d33999 4983 template <typename T, typename R, typename A0, typename A1>
<> 149:156823d33999 4984 Callback<R(A0, A1)> callback(R (*func)(volatile T*, A0, A1), volatile T *arg) {
<> 149:156823d33999 4985 return Callback<R(A0, A1)>(func, arg);
<> 149:156823d33999 4986 }
<> 149:156823d33999 4987
<> 149:156823d33999 4988 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 4989 *
<> 149:156823d33999 4990 * @param func Static function to attach
<> 149:156823d33999 4991 * @param arg Pointer argument to function
<> 149:156823d33999 4992 * @return Callback with infered type
<> 149:156823d33999 4993 */
<> 149:156823d33999 4994 template <typename T, typename R, typename A0, typename A1>
<> 149:156823d33999 4995 Callback<R(A0, A1)> callback(R (*func)(const volatile T*, A0, A1), const volatile T *arg) {
<> 149:156823d33999 4996 return Callback<R(A0, A1)>(func, arg);
<> 149:156823d33999 4997 }
<> 149:156823d33999 4998
<> 149:156823d33999 4999 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5000 *
<> 149:156823d33999 5001 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5002 * @param func Static function to attach
<> 149:156823d33999 5003 * @return Callback with infered type
<> 149:156823d33999 5004 * @deprecated
<> 149:156823d33999 5005 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5006 */
<> 149:156823d33999 5007 template <typename R, typename A0, typename A1>
<> 149:156823d33999 5008 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5009 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5010 Callback<R(A0, A1)> callback(void *obj, R (*func)(void*, A0, A1)) {
<> 149:156823d33999 5011 return Callback<R(A0, A1)>(func, obj);
<> 149:156823d33999 5012 }
<> 149:156823d33999 5013
<> 149:156823d33999 5014 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5015 *
<> 149:156823d33999 5016 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5017 * @param func Static function to attach
<> 149:156823d33999 5018 * @return Callback with infered type
<> 149:156823d33999 5019 * @deprecated
<> 149:156823d33999 5020 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5021 */
<> 149:156823d33999 5022 template <typename R, typename A0, typename A1>
<> 149:156823d33999 5023 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5024 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5025 Callback<R(A0, A1)> callback(const void *obj, R (*func)(const void*, A0, A1)) {
<> 149:156823d33999 5026 return Callback<R(A0, A1)>(func, obj);
<> 149:156823d33999 5027 }
<> 149:156823d33999 5028
<> 149:156823d33999 5029 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5030 *
<> 149:156823d33999 5031 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5032 * @param func Static function to attach
<> 149:156823d33999 5033 * @return Callback with infered type
<> 149:156823d33999 5034 * @deprecated
<> 149:156823d33999 5035 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5036 */
<> 149:156823d33999 5037 template <typename R, typename A0, typename A1>
<> 149:156823d33999 5038 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5039 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5040 Callback<R(A0, A1)> callback(volatile void *obj, R (*func)(volatile void*, A0, A1)) {
<> 149:156823d33999 5041 return Callback<R(A0, A1)>(func, obj);
<> 149:156823d33999 5042 }
<> 149:156823d33999 5043
<> 149:156823d33999 5044 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5045 *
<> 149:156823d33999 5046 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5047 * @param func Static function to attach
<> 149:156823d33999 5048 * @return Callback with infered type
<> 149:156823d33999 5049 * @deprecated
<> 149:156823d33999 5050 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5051 */
<> 149:156823d33999 5052 template <typename R, typename A0, typename A1>
<> 149:156823d33999 5053 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5054 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5055 Callback<R(A0, A1)> callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1)) {
<> 149:156823d33999 5056 return Callback<R(A0, A1)>(func, obj);
<> 149:156823d33999 5057 }
<> 149:156823d33999 5058
<> 149:156823d33999 5059 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5060 *
<> 149:156823d33999 5061 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5062 * @param func Static function to attach
<> 149:156823d33999 5063 * @return Callback with infered type
<> 149:156823d33999 5064 * @deprecated
<> 149:156823d33999 5065 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5066 */
<> 149:156823d33999 5067 template <typename T, typename R, typename A0, typename A1>
<> 149:156823d33999 5068 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5069 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5070 Callback<R(A0, A1)> callback(T *obj, R (*func)(T*, A0, A1)) {
<> 149:156823d33999 5071 return Callback<R(A0, A1)>(func, obj);
<> 149:156823d33999 5072 }
<> 149:156823d33999 5073
<> 149:156823d33999 5074 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5075 *
<> 149:156823d33999 5076 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5077 * @param func Static function to attach
<> 149:156823d33999 5078 * @return Callback with infered type
<> 149:156823d33999 5079 * @deprecated
<> 149:156823d33999 5080 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5081 */
<> 149:156823d33999 5082 template <typename T, typename R, typename A0, typename A1>
<> 149:156823d33999 5083 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5084 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5085 Callback<R(A0, A1)> callback(const T *obj, R (*func)(const T*, A0, A1)) {
<> 149:156823d33999 5086 return Callback<R(A0, A1)>(func, obj);
<> 149:156823d33999 5087 }
<> 149:156823d33999 5088
<> 149:156823d33999 5089 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5090 *
<> 149:156823d33999 5091 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5092 * @param func Static function to attach
<> 149:156823d33999 5093 * @return Callback with infered type
<> 149:156823d33999 5094 * @deprecated
<> 149:156823d33999 5095 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5096 */
<> 149:156823d33999 5097 template <typename T, typename R, typename A0, typename A1>
<> 149:156823d33999 5098 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5099 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5100 Callback<R(A0, A1)> callback(volatile T *obj, R (*func)(volatile T*, A0, A1)) {
<> 149:156823d33999 5101 return Callback<R(A0, A1)>(func, obj);
<> 149:156823d33999 5102 }
<> 149:156823d33999 5103
<> 149:156823d33999 5104 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5105 *
<> 149:156823d33999 5106 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5107 * @param func Static function to attach
<> 149:156823d33999 5108 * @return Callback with infered type
<> 149:156823d33999 5109 * @deprecated
<> 149:156823d33999 5110 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5111 */
<> 149:156823d33999 5112 template <typename T, typename R, typename A0, typename A1>
<> 149:156823d33999 5113 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5114 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5115 Callback<R(A0, A1)> callback(const volatile T *obj, R (*func)(const volatile T*, A0, A1)) {
<> 149:156823d33999 5116 return Callback<R(A0, A1)>(func, obj);
<> 149:156823d33999 5117 }
<> 149:156823d33999 5118
<> 149:156823d33999 5119
<> 149:156823d33999 5120 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5121 *
<> 149:156823d33999 5122 * @param func Static function to attach
<> 149:156823d33999 5123 * @return Callback with infered type
<> 149:156823d33999 5124 */
<> 149:156823d33999 5125 template <typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5126 Callback<R(A0, A1, A2)> callback(R (*func)(A0, A1, A2) = 0) {
<> 149:156823d33999 5127 return Callback<R(A0, A1, A2)>(func);
<> 149:156823d33999 5128 }
<> 149:156823d33999 5129
<> 149:156823d33999 5130 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5131 *
<> 149:156823d33999 5132 * @param func Static function to attach
<> 149:156823d33999 5133 * @return Callback with infered type
<> 149:156823d33999 5134 */
<> 149:156823d33999 5135 template <typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5136 Callback<R(A0, A1, A2)> callback(const Callback<R(A0, A1, A2)> &func) {
<> 149:156823d33999 5137 return Callback<R(A0, A1, A2)>(func);
<> 149:156823d33999 5138 }
<> 149:156823d33999 5139
<> 149:156823d33999 5140 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5141 *
<> 149:156823d33999 5142 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5143 * @param method Member function to attach
<> 149:156823d33999 5144 * @return Callback with infered type
<> 149:156823d33999 5145 */
<> 149:156823d33999 5146 template<typename T, typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5147 Callback<R(A0, A1, A2)> callback(T *obj, R (T::*func)(A0, A1, A2)) {
<> 149:156823d33999 5148 return Callback<R(A0, A1, A2)>(obj, func);
<> 149:156823d33999 5149 }
<> 149:156823d33999 5150
<> 149:156823d33999 5151 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5152 *
<> 149:156823d33999 5153 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5154 * @param method Member function to attach
<> 149:156823d33999 5155 * @return Callback with infered type
<> 149:156823d33999 5156 */
<> 149:156823d33999 5157 template<typename T, typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5158 Callback<R(A0, A1, A2)> callback(const T *obj, R (T::*func)(A0, A1, A2) const) {
<> 149:156823d33999 5159 return Callback<R(A0, A1, A2)>(obj, func);
<> 149:156823d33999 5160 }
<> 149:156823d33999 5161
<> 149:156823d33999 5162 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5163 *
<> 149:156823d33999 5164 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5165 * @param method Member function to attach
<> 149:156823d33999 5166 * @return Callback with infered type
<> 149:156823d33999 5167 */
<> 149:156823d33999 5168 template<typename T, typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5169 Callback<R(A0, A1, A2)> callback(volatile T *obj, R (T::*func)(A0, A1, A2) volatile) {
<> 149:156823d33999 5170 return Callback<R(A0, A1, A2)>(obj, func);
<> 149:156823d33999 5171 }
<> 149:156823d33999 5172
<> 149:156823d33999 5173 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5174 *
<> 149:156823d33999 5175 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5176 * @param method Member function to attach
<> 149:156823d33999 5177 * @return Callback with infered type
<> 149:156823d33999 5178 */
<> 149:156823d33999 5179 template<typename T, typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5180 Callback<R(A0, A1, A2)> callback(const volatile T *obj, R (T::*func)(A0, A1, A2) const volatile) {
<> 149:156823d33999 5181 return Callback<R(A0, A1, A2)>(obj, func);
<> 149:156823d33999 5182 }
<> 149:156823d33999 5183
<> 149:156823d33999 5184 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5185 *
<> 149:156823d33999 5186 * @param func Static function to attach
<> 149:156823d33999 5187 * @param arg Pointer argument to function
<> 149:156823d33999 5188 * @return Callback with infered type
<> 149:156823d33999 5189 */
<> 149:156823d33999 5190 template <typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5191 Callback<R(A0, A1, A2)> callback(R (*func)(void*, A0, A1, A2), void *arg) {
<> 149:156823d33999 5192 return Callback<R(A0, A1, A2)>(func, arg);
<> 149:156823d33999 5193 }
<> 149:156823d33999 5194
<> 149:156823d33999 5195 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5196 *
<> 149:156823d33999 5197 * @param func Static function to attach
<> 149:156823d33999 5198 * @param arg Pointer argument to function
<> 149:156823d33999 5199 * @return Callback with infered type
<> 149:156823d33999 5200 */
<> 149:156823d33999 5201 template <typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5202 Callback<R(A0, A1, A2)> callback(R (*func)(const void*, A0, A1, A2), const void *arg) {
<> 149:156823d33999 5203 return Callback<R(A0, A1, A2)>(func, arg);
<> 149:156823d33999 5204 }
<> 149:156823d33999 5205
<> 149:156823d33999 5206 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5207 *
<> 149:156823d33999 5208 * @param func Static function to attach
<> 149:156823d33999 5209 * @param arg Pointer argument to function
<> 149:156823d33999 5210 * @return Callback with infered type
<> 149:156823d33999 5211 */
<> 149:156823d33999 5212 template <typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5213 Callback<R(A0, A1, A2)> callback(R (*func)(volatile void*, A0, A1, A2), volatile void *arg) {
<> 149:156823d33999 5214 return Callback<R(A0, A1, A2)>(func, arg);
<> 149:156823d33999 5215 }
<> 149:156823d33999 5216
<> 149:156823d33999 5217 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5218 *
<> 149:156823d33999 5219 * @param func Static function to attach
<> 149:156823d33999 5220 * @param arg Pointer argument to function
<> 149:156823d33999 5221 * @return Callback with infered type
<> 149:156823d33999 5222 */
<> 149:156823d33999 5223 template <typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5224 Callback<R(A0, A1, A2)> callback(R (*func)(const volatile void*, A0, A1, A2), const volatile void *arg) {
<> 149:156823d33999 5225 return Callback<R(A0, A1, A2)>(func, arg);
<> 149:156823d33999 5226 }
<> 149:156823d33999 5227
<> 149:156823d33999 5228 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5229 *
<> 149:156823d33999 5230 * @param func Static function to attach
<> 149:156823d33999 5231 * @param arg Pointer argument to function
<> 149:156823d33999 5232 * @return Callback with infered type
<> 149:156823d33999 5233 */
<> 149:156823d33999 5234 template <typename T, typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5235 Callback<R(A0, A1, A2)> callback(R (*func)(T*, A0, A1, A2), T *arg) {
<> 149:156823d33999 5236 return Callback<R(A0, A1, A2)>(func, arg);
<> 149:156823d33999 5237 }
<> 149:156823d33999 5238
<> 149:156823d33999 5239 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5240 *
<> 149:156823d33999 5241 * @param func Static function to attach
<> 149:156823d33999 5242 * @param arg Pointer argument to function
<> 149:156823d33999 5243 * @return Callback with infered type
<> 149:156823d33999 5244 */
<> 149:156823d33999 5245 template <typename T, typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5246 Callback<R(A0, A1, A2)> callback(R (*func)(const T*, A0, A1, A2), const T *arg) {
<> 149:156823d33999 5247 return Callback<R(A0, A1, A2)>(func, arg);
<> 149:156823d33999 5248 }
<> 149:156823d33999 5249
<> 149:156823d33999 5250 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5251 *
<> 149:156823d33999 5252 * @param func Static function to attach
<> 149:156823d33999 5253 * @param arg Pointer argument to function
<> 149:156823d33999 5254 * @return Callback with infered type
<> 149:156823d33999 5255 */
<> 149:156823d33999 5256 template <typename T, typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5257 Callback<R(A0, A1, A2)> callback(R (*func)(volatile T*, A0, A1, A2), volatile T *arg) {
<> 149:156823d33999 5258 return Callback<R(A0, A1, A2)>(func, arg);
<> 149:156823d33999 5259 }
<> 149:156823d33999 5260
<> 149:156823d33999 5261 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5262 *
<> 149:156823d33999 5263 * @param func Static function to attach
<> 149:156823d33999 5264 * @param arg Pointer argument to function
<> 149:156823d33999 5265 * @return Callback with infered type
<> 149:156823d33999 5266 */
<> 149:156823d33999 5267 template <typename T, typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5268 Callback<R(A0, A1, A2)> callback(R (*func)(const volatile T*, A0, A1, A2), const volatile T *arg) {
<> 149:156823d33999 5269 return Callback<R(A0, A1, A2)>(func, arg);
<> 149:156823d33999 5270 }
<> 149:156823d33999 5271
<> 149:156823d33999 5272 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5273 *
<> 149:156823d33999 5274 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5275 * @param func Static function to attach
<> 149:156823d33999 5276 * @return Callback with infered type
<> 149:156823d33999 5277 * @deprecated
<> 149:156823d33999 5278 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5279 */
<> 149:156823d33999 5280 template <typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5281 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5282 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5283 Callback<R(A0, A1, A2)> callback(void *obj, R (*func)(void*, A0, A1, A2)) {
<> 149:156823d33999 5284 return Callback<R(A0, A1, A2)>(func, obj);
<> 149:156823d33999 5285 }
<> 149:156823d33999 5286
<> 149:156823d33999 5287 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5288 *
<> 149:156823d33999 5289 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5290 * @param func Static function to attach
<> 149:156823d33999 5291 * @return Callback with infered type
<> 149:156823d33999 5292 * @deprecated
<> 149:156823d33999 5293 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5294 */
<> 149:156823d33999 5295 template <typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5296 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5297 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5298 Callback<R(A0, A1, A2)> callback(const void *obj, R (*func)(const void*, A0, A1, A2)) {
<> 149:156823d33999 5299 return Callback<R(A0, A1, A2)>(func, obj);
<> 149:156823d33999 5300 }
<> 149:156823d33999 5301
<> 149:156823d33999 5302 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5303 *
<> 149:156823d33999 5304 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5305 * @param func Static function to attach
<> 149:156823d33999 5306 * @return Callback with infered type
<> 149:156823d33999 5307 * @deprecated
<> 149:156823d33999 5308 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5309 */
<> 149:156823d33999 5310 template <typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5311 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5312 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5313 Callback<R(A0, A1, A2)> callback(volatile void *obj, R (*func)(volatile void*, A0, A1, A2)) {
<> 149:156823d33999 5314 return Callback<R(A0, A1, A2)>(func, obj);
<> 149:156823d33999 5315 }
<> 149:156823d33999 5316
<> 149:156823d33999 5317 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5318 *
<> 149:156823d33999 5319 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5320 * @param func Static function to attach
<> 149:156823d33999 5321 * @return Callback with infered type
<> 149:156823d33999 5322 * @deprecated
<> 149:156823d33999 5323 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5324 */
<> 149:156823d33999 5325 template <typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5326 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5327 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5328 Callback<R(A0, A1, A2)> callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2)) {
<> 149:156823d33999 5329 return Callback<R(A0, A1, A2)>(func, obj);
<> 149:156823d33999 5330 }
<> 149:156823d33999 5331
<> 149:156823d33999 5332 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5333 *
<> 149:156823d33999 5334 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5335 * @param func Static function to attach
<> 149:156823d33999 5336 * @return Callback with infered type
<> 149:156823d33999 5337 * @deprecated
<> 149:156823d33999 5338 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5339 */
<> 149:156823d33999 5340 template <typename T, typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5341 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5342 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5343 Callback<R(A0, A1, A2)> callback(T *obj, R (*func)(T*, A0, A1, A2)) {
<> 149:156823d33999 5344 return Callback<R(A0, A1, A2)>(func, obj);
<> 149:156823d33999 5345 }
<> 149:156823d33999 5346
<> 149:156823d33999 5347 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5348 *
<> 149:156823d33999 5349 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5350 * @param func Static function to attach
<> 149:156823d33999 5351 * @return Callback with infered type
<> 149:156823d33999 5352 * @deprecated
<> 149:156823d33999 5353 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5354 */
<> 149:156823d33999 5355 template <typename T, typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5356 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5357 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5358 Callback<R(A0, A1, A2)> callback(const T *obj, R (*func)(const T*, A0, A1, A2)) {
<> 149:156823d33999 5359 return Callback<R(A0, A1, A2)>(func, obj);
<> 149:156823d33999 5360 }
<> 149:156823d33999 5361
<> 149:156823d33999 5362 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5363 *
<> 149:156823d33999 5364 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5365 * @param func Static function to attach
<> 149:156823d33999 5366 * @return Callback with infered type
<> 149:156823d33999 5367 * @deprecated
<> 149:156823d33999 5368 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5369 */
<> 149:156823d33999 5370 template <typename T, typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5371 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5372 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5373 Callback<R(A0, A1, A2)> callback(volatile T *obj, R (*func)(volatile T*, A0, A1, A2)) {
<> 149:156823d33999 5374 return Callback<R(A0, A1, A2)>(func, obj);
<> 149:156823d33999 5375 }
<> 149:156823d33999 5376
<> 149:156823d33999 5377 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5378 *
<> 149:156823d33999 5379 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5380 * @param func Static function to attach
<> 149:156823d33999 5381 * @return Callback with infered type
<> 149:156823d33999 5382 * @deprecated
<> 149:156823d33999 5383 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5384 */
<> 149:156823d33999 5385 template <typename T, typename R, typename A0, typename A1, typename A2>
<> 149:156823d33999 5386 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5387 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5388 Callback<R(A0, A1, A2)> callback(const volatile T *obj, R (*func)(const volatile T*, A0, A1, A2)) {
<> 149:156823d33999 5389 return Callback<R(A0, A1, A2)>(func, obj);
<> 149:156823d33999 5390 }
<> 149:156823d33999 5391
<> 149:156823d33999 5392
<> 149:156823d33999 5393 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5394 *
<> 149:156823d33999 5395 * @param func Static function to attach
<> 149:156823d33999 5396 * @return Callback with infered type
<> 149:156823d33999 5397 */
<> 149:156823d33999 5398 template <typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5399 Callback<R(A0, A1, A2, A3)> callback(R (*func)(A0, A1, A2, A3) = 0) {
<> 149:156823d33999 5400 return Callback<R(A0, A1, A2, A3)>(func);
<> 149:156823d33999 5401 }
<> 149:156823d33999 5402
<> 149:156823d33999 5403 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5404 *
<> 149:156823d33999 5405 * @param func Static function to attach
<> 149:156823d33999 5406 * @return Callback with infered type
<> 149:156823d33999 5407 */
<> 149:156823d33999 5408 template <typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5409 Callback<R(A0, A1, A2, A3)> callback(const Callback<R(A0, A1, A2, A3)> &func) {
<> 149:156823d33999 5410 return Callback<R(A0, A1, A2, A3)>(func);
<> 149:156823d33999 5411 }
<> 149:156823d33999 5412
<> 149:156823d33999 5413 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5414 *
<> 149:156823d33999 5415 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5416 * @param method Member function to attach
<> 149:156823d33999 5417 * @return Callback with infered type
<> 149:156823d33999 5418 */
<> 149:156823d33999 5419 template<typename T, typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5420 Callback<R(A0, A1, A2, A3)> callback(T *obj, R (T::*func)(A0, A1, A2, A3)) {
<> 149:156823d33999 5421 return Callback<R(A0, A1, A2, A3)>(obj, func);
<> 149:156823d33999 5422 }
<> 149:156823d33999 5423
<> 149:156823d33999 5424 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5425 *
<> 149:156823d33999 5426 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5427 * @param method Member function to attach
<> 149:156823d33999 5428 * @return Callback with infered type
<> 149:156823d33999 5429 */
<> 149:156823d33999 5430 template<typename T, typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5431 Callback<R(A0, A1, A2, A3)> callback(const T *obj, R (T::*func)(A0, A1, A2, A3) const) {
<> 149:156823d33999 5432 return Callback<R(A0, A1, A2, A3)>(obj, func);
<> 149:156823d33999 5433 }
<> 149:156823d33999 5434
<> 149:156823d33999 5435 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5436 *
<> 149:156823d33999 5437 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5438 * @param method Member function to attach
<> 149:156823d33999 5439 * @return Callback with infered type
<> 149:156823d33999 5440 */
<> 149:156823d33999 5441 template<typename T, typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5442 Callback<R(A0, A1, A2, A3)> callback(volatile T *obj, R (T::*func)(A0, A1, A2, A3) volatile) {
<> 149:156823d33999 5443 return Callback<R(A0, A1, A2, A3)>(obj, func);
<> 149:156823d33999 5444 }
<> 149:156823d33999 5445
<> 149:156823d33999 5446 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5447 *
<> 149:156823d33999 5448 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5449 * @param method Member function to attach
<> 149:156823d33999 5450 * @return Callback with infered type
<> 149:156823d33999 5451 */
<> 149:156823d33999 5452 template<typename T, typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5453 Callback<R(A0, A1, A2, A3)> callback(const volatile T *obj, R (T::*func)(A0, A1, A2, A3) const volatile) {
<> 149:156823d33999 5454 return Callback<R(A0, A1, A2, A3)>(obj, func);
<> 149:156823d33999 5455 }
<> 149:156823d33999 5456
<> 149:156823d33999 5457 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5458 *
<> 149:156823d33999 5459 * @param func Static function to attach
<> 149:156823d33999 5460 * @param arg Pointer argument to function
<> 149:156823d33999 5461 * @return Callback with infered type
<> 149:156823d33999 5462 */
<> 149:156823d33999 5463 template <typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5464 Callback<R(A0, A1, A2, A3)> callback(R (*func)(void*, A0, A1, A2, A3), void *arg) {
<> 149:156823d33999 5465 return Callback<R(A0, A1, A2, A3)>(func, arg);
<> 149:156823d33999 5466 }
<> 149:156823d33999 5467
<> 149:156823d33999 5468 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5469 *
<> 149:156823d33999 5470 * @param func Static function to attach
<> 149:156823d33999 5471 * @param arg Pointer argument to function
<> 149:156823d33999 5472 * @return Callback with infered type
<> 149:156823d33999 5473 */
<> 149:156823d33999 5474 template <typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5475 Callback<R(A0, A1, A2, A3)> callback(R (*func)(const void*, A0, A1, A2, A3), const void *arg) {
<> 149:156823d33999 5476 return Callback<R(A0, A1, A2, A3)>(func, arg);
<> 149:156823d33999 5477 }
<> 149:156823d33999 5478
<> 149:156823d33999 5479 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5480 *
<> 149:156823d33999 5481 * @param func Static function to attach
<> 149:156823d33999 5482 * @param arg Pointer argument to function
<> 149:156823d33999 5483 * @return Callback with infered type
<> 149:156823d33999 5484 */
<> 149:156823d33999 5485 template <typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5486 Callback<R(A0, A1, A2, A3)> callback(R (*func)(volatile void*, A0, A1, A2, A3), volatile void *arg) {
<> 149:156823d33999 5487 return Callback<R(A0, A1, A2, A3)>(func, arg);
<> 149:156823d33999 5488 }
<> 149:156823d33999 5489
<> 149:156823d33999 5490 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5491 *
<> 149:156823d33999 5492 * @param func Static function to attach
<> 149:156823d33999 5493 * @param arg Pointer argument to function
<> 149:156823d33999 5494 * @return Callback with infered type
<> 149:156823d33999 5495 */
<> 149:156823d33999 5496 template <typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5497 Callback<R(A0, A1, A2, A3)> callback(R (*func)(const volatile void*, A0, A1, A2, A3), const volatile void *arg) {
<> 149:156823d33999 5498 return Callback<R(A0, A1, A2, A3)>(func, arg);
<> 149:156823d33999 5499 }
<> 149:156823d33999 5500
<> 149:156823d33999 5501 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5502 *
<> 149:156823d33999 5503 * @param func Static function to attach
<> 149:156823d33999 5504 * @param arg Pointer argument to function
<> 149:156823d33999 5505 * @return Callback with infered type
<> 149:156823d33999 5506 */
<> 149:156823d33999 5507 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5508 Callback<R(A0, A1, A2, A3)> callback(R (*func)(T*, A0, A1, A2, A3), T *arg) {
<> 149:156823d33999 5509 return Callback<R(A0, A1, A2, A3)>(func, arg);
<> 149:156823d33999 5510 }
<> 149:156823d33999 5511
<> 149:156823d33999 5512 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5513 *
<> 149:156823d33999 5514 * @param func Static function to attach
<> 149:156823d33999 5515 * @param arg Pointer argument to function
<> 149:156823d33999 5516 * @return Callback with infered type
<> 149:156823d33999 5517 */
<> 149:156823d33999 5518 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5519 Callback<R(A0, A1, A2, A3)> callback(R (*func)(const T*, A0, A1, A2, A3), const T *arg) {
<> 149:156823d33999 5520 return Callback<R(A0, A1, A2, A3)>(func, arg);
<> 149:156823d33999 5521 }
<> 149:156823d33999 5522
<> 149:156823d33999 5523 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5524 *
<> 149:156823d33999 5525 * @param func Static function to attach
<> 149:156823d33999 5526 * @param arg Pointer argument to function
<> 149:156823d33999 5527 * @return Callback with infered type
<> 149:156823d33999 5528 */
<> 149:156823d33999 5529 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5530 Callback<R(A0, A1, A2, A3)> callback(R (*func)(volatile T*, A0, A1, A2, A3), volatile T *arg) {
<> 149:156823d33999 5531 return Callback<R(A0, A1, A2, A3)>(func, arg);
<> 149:156823d33999 5532 }
<> 149:156823d33999 5533
<> 149:156823d33999 5534 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5535 *
<> 149:156823d33999 5536 * @param func Static function to attach
<> 149:156823d33999 5537 * @param arg Pointer argument to function
<> 149:156823d33999 5538 * @return Callback with infered type
<> 149:156823d33999 5539 */
<> 149:156823d33999 5540 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5541 Callback<R(A0, A1, A2, A3)> callback(R (*func)(const volatile T*, A0, A1, A2, A3), const volatile T *arg) {
<> 149:156823d33999 5542 return Callback<R(A0, A1, A2, A3)>(func, arg);
<> 149:156823d33999 5543 }
<> 149:156823d33999 5544
<> 149:156823d33999 5545 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5546 *
<> 149:156823d33999 5547 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5548 * @param func Static function to attach
<> 149:156823d33999 5549 * @return Callback with infered type
<> 149:156823d33999 5550 * @deprecated
<> 149:156823d33999 5551 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5552 */
<> 149:156823d33999 5553 template <typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5554 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5555 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5556 Callback<R(A0, A1, A2, A3)> callback(void *obj, R (*func)(void*, A0, A1, A2, A3)) {
<> 149:156823d33999 5557 return Callback<R(A0, A1, A2, A3)>(func, obj);
<> 149:156823d33999 5558 }
<> 149:156823d33999 5559
<> 149:156823d33999 5560 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5561 *
<> 149:156823d33999 5562 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5563 * @param func Static function to attach
<> 149:156823d33999 5564 * @return Callback with infered type
<> 149:156823d33999 5565 * @deprecated
<> 149:156823d33999 5566 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5567 */
<> 149:156823d33999 5568 template <typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5569 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5570 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5571 Callback<R(A0, A1, A2, A3)> callback(const void *obj, R (*func)(const void*, A0, A1, A2, A3)) {
<> 149:156823d33999 5572 return Callback<R(A0, A1, A2, A3)>(func, obj);
<> 149:156823d33999 5573 }
<> 149:156823d33999 5574
<> 149:156823d33999 5575 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5576 *
<> 149:156823d33999 5577 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5578 * @param func Static function to attach
<> 149:156823d33999 5579 * @return Callback with infered type
<> 149:156823d33999 5580 * @deprecated
<> 149:156823d33999 5581 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5582 */
<> 149:156823d33999 5583 template <typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5584 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5585 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5586 Callback<R(A0, A1, A2, A3)> callback(volatile void *obj, R (*func)(volatile void*, A0, A1, A2, A3)) {
<> 149:156823d33999 5587 return Callback<R(A0, A1, A2, A3)>(func, obj);
<> 149:156823d33999 5588 }
<> 149:156823d33999 5589
<> 149:156823d33999 5590 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5591 *
<> 149:156823d33999 5592 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5593 * @param func Static function to attach
<> 149:156823d33999 5594 * @return Callback with infered type
<> 149:156823d33999 5595 * @deprecated
<> 149:156823d33999 5596 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5597 */
<> 149:156823d33999 5598 template <typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5599 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5600 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5601 Callback<R(A0, A1, A2, A3)> callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2, A3)) {
<> 149:156823d33999 5602 return Callback<R(A0, A1, A2, A3)>(func, obj);
<> 149:156823d33999 5603 }
<> 149:156823d33999 5604
<> 149:156823d33999 5605 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5606 *
<> 149:156823d33999 5607 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5608 * @param func Static function to attach
<> 149:156823d33999 5609 * @return Callback with infered type
<> 149:156823d33999 5610 * @deprecated
<> 149:156823d33999 5611 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5612 */
<> 149:156823d33999 5613 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5614 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5615 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5616 Callback<R(A0, A1, A2, A3)> callback(T *obj, R (*func)(T*, A0, A1, A2, A3)) {
<> 149:156823d33999 5617 return Callback<R(A0, A1, A2, A3)>(func, obj);
<> 149:156823d33999 5618 }
<> 149:156823d33999 5619
<> 149:156823d33999 5620 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5621 *
<> 149:156823d33999 5622 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5623 * @param func Static function to attach
<> 149:156823d33999 5624 * @return Callback with infered type
<> 149:156823d33999 5625 * @deprecated
<> 149:156823d33999 5626 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5627 */
<> 149:156823d33999 5628 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5629 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5630 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5631 Callback<R(A0, A1, A2, A3)> callback(const T *obj, R (*func)(const T*, A0, A1, A2, A3)) {
<> 149:156823d33999 5632 return Callback<R(A0, A1, A2, A3)>(func, obj);
<> 149:156823d33999 5633 }
<> 149:156823d33999 5634
<> 149:156823d33999 5635 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5636 *
<> 149:156823d33999 5637 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5638 * @param func Static function to attach
<> 149:156823d33999 5639 * @return Callback with infered type
<> 149:156823d33999 5640 * @deprecated
<> 149:156823d33999 5641 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5642 */
<> 149:156823d33999 5643 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5644 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5645 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5646 Callback<R(A0, A1, A2, A3)> callback(volatile T *obj, R (*func)(volatile T*, A0, A1, A2, A3)) {
<> 149:156823d33999 5647 return Callback<R(A0, A1, A2, A3)>(func, obj);
<> 149:156823d33999 5648 }
<> 149:156823d33999 5649
<> 149:156823d33999 5650 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5651 *
<> 149:156823d33999 5652 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5653 * @param func Static function to attach
<> 149:156823d33999 5654 * @return Callback with infered type
<> 149:156823d33999 5655 * @deprecated
<> 149:156823d33999 5656 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5657 */
<> 149:156823d33999 5658 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
<> 149:156823d33999 5659 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5660 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5661 Callback<R(A0, A1, A2, A3)> callback(const volatile T *obj, R (*func)(const volatile T*, A0, A1, A2, A3)) {
<> 149:156823d33999 5662 return Callback<R(A0, A1, A2, A3)>(func, obj);
<> 149:156823d33999 5663 }
<> 149:156823d33999 5664
<> 149:156823d33999 5665
<> 149:156823d33999 5666 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5667 *
<> 149:156823d33999 5668 * @param func Static function to attach
<> 149:156823d33999 5669 * @return Callback with infered type
<> 149:156823d33999 5670 */
<> 149:156823d33999 5671 template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5672 Callback<R(A0, A1, A2, A3, A4)> callback(R (*func)(A0, A1, A2, A3, A4) = 0) {
<> 149:156823d33999 5673 return Callback<R(A0, A1, A2, A3, A4)>(func);
<> 149:156823d33999 5674 }
<> 149:156823d33999 5675
<> 149:156823d33999 5676 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5677 *
<> 149:156823d33999 5678 * @param func Static function to attach
<> 149:156823d33999 5679 * @return Callback with infered type
<> 149:156823d33999 5680 */
<> 149:156823d33999 5681 template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5682 Callback<R(A0, A1, A2, A3, A4)> callback(const Callback<R(A0, A1, A2, A3, A4)> &func) {
<> 149:156823d33999 5683 return Callback<R(A0, A1, A2, A3, A4)>(func);
<> 149:156823d33999 5684 }
<> 149:156823d33999 5685
<> 149:156823d33999 5686 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5687 *
<> 149:156823d33999 5688 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5689 * @param method Member function to attach
<> 149:156823d33999 5690 * @return Callback with infered type
<> 149:156823d33999 5691 */
<> 149:156823d33999 5692 template<typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5693 Callback<R(A0, A1, A2, A3, A4)> callback(T *obj, R (T::*func)(A0, A1, A2, A3, A4)) {
<> 149:156823d33999 5694 return Callback<R(A0, A1, A2, A3, A4)>(obj, func);
<> 149:156823d33999 5695 }
<> 149:156823d33999 5696
<> 149:156823d33999 5697 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5698 *
<> 149:156823d33999 5699 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5700 * @param method Member function to attach
<> 149:156823d33999 5701 * @return Callback with infered type
<> 149:156823d33999 5702 */
<> 149:156823d33999 5703 template<typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5704 Callback<R(A0, A1, A2, A3, A4)> callback(const T *obj, R (T::*func)(A0, A1, A2, A3, A4) const) {
<> 149:156823d33999 5705 return Callback<R(A0, A1, A2, A3, A4)>(obj, func);
<> 149:156823d33999 5706 }
<> 149:156823d33999 5707
<> 149:156823d33999 5708 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5709 *
<> 149:156823d33999 5710 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5711 * @param method Member function to attach
<> 149:156823d33999 5712 * @return Callback with infered type
<> 149:156823d33999 5713 */
<> 149:156823d33999 5714 template<typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5715 Callback<R(A0, A1, A2, A3, A4)> callback(volatile T *obj, R (T::*func)(A0, A1, A2, A3, A4) volatile) {
<> 149:156823d33999 5716 return Callback<R(A0, A1, A2, A3, A4)>(obj, func);
<> 149:156823d33999 5717 }
<> 149:156823d33999 5718
<> 149:156823d33999 5719 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5720 *
<> 149:156823d33999 5721 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5722 * @param method Member function to attach
<> 149:156823d33999 5723 * @return Callback with infered type
<> 149:156823d33999 5724 */
<> 149:156823d33999 5725 template<typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5726 Callback<R(A0, A1, A2, A3, A4)> callback(const volatile T *obj, R (T::*func)(A0, A1, A2, A3, A4) const volatile) {
<> 149:156823d33999 5727 return Callback<R(A0, A1, A2, A3, A4)>(obj, func);
<> 149:156823d33999 5728 }
<> 149:156823d33999 5729
<> 149:156823d33999 5730 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5731 *
<> 149:156823d33999 5732 * @param func Static function to attach
<> 149:156823d33999 5733 * @param arg Pointer argument to function
<> 149:156823d33999 5734 * @return Callback with infered type
<> 149:156823d33999 5735 */
<> 149:156823d33999 5736 template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5737 Callback<R(A0, A1, A2, A3, A4)> callback(R (*func)(void*, A0, A1, A2, A3, A4), void *arg) {
<> 149:156823d33999 5738 return Callback<R(A0, A1, A2, A3, A4)>(func, arg);
<> 149:156823d33999 5739 }
<> 149:156823d33999 5740
<> 149:156823d33999 5741 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5742 *
<> 149:156823d33999 5743 * @param func Static function to attach
<> 149:156823d33999 5744 * @param arg Pointer argument to function
<> 149:156823d33999 5745 * @return Callback with infered type
<> 149:156823d33999 5746 */
<> 149:156823d33999 5747 template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5748 Callback<R(A0, A1, A2, A3, A4)> callback(R (*func)(const void*, A0, A1, A2, A3, A4), const void *arg) {
<> 149:156823d33999 5749 return Callback<R(A0, A1, A2, A3, A4)>(func, arg);
<> 149:156823d33999 5750 }
<> 149:156823d33999 5751
<> 149:156823d33999 5752 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5753 *
<> 149:156823d33999 5754 * @param func Static function to attach
<> 149:156823d33999 5755 * @param arg Pointer argument to function
<> 149:156823d33999 5756 * @return Callback with infered type
<> 149:156823d33999 5757 */
<> 149:156823d33999 5758 template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5759 Callback<R(A0, A1, A2, A3, A4)> callback(R (*func)(volatile void*, A0, A1, A2, A3, A4), volatile void *arg) {
<> 149:156823d33999 5760 return Callback<R(A0, A1, A2, A3, A4)>(func, arg);
<> 149:156823d33999 5761 }
<> 149:156823d33999 5762
<> 149:156823d33999 5763 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5764 *
<> 149:156823d33999 5765 * @param func Static function to attach
<> 149:156823d33999 5766 * @param arg Pointer argument to function
<> 149:156823d33999 5767 * @return Callback with infered type
<> 149:156823d33999 5768 */
<> 149:156823d33999 5769 template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5770 Callback<R(A0, A1, A2, A3, A4)> callback(R (*func)(const volatile void*, A0, A1, A2, A3, A4), const volatile void *arg) {
<> 149:156823d33999 5771 return Callback<R(A0, A1, A2, A3, A4)>(func, arg);
<> 149:156823d33999 5772 }
<> 149:156823d33999 5773
<> 149:156823d33999 5774 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5775 *
<> 149:156823d33999 5776 * @param func Static function to attach
<> 149:156823d33999 5777 * @param arg Pointer argument to function
<> 149:156823d33999 5778 * @return Callback with infered type
<> 149:156823d33999 5779 */
<> 149:156823d33999 5780 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5781 Callback<R(A0, A1, A2, A3, A4)> callback(R (*func)(T*, A0, A1, A2, A3, A4), T *arg) {
<> 149:156823d33999 5782 return Callback<R(A0, A1, A2, A3, A4)>(func, arg);
<> 149:156823d33999 5783 }
<> 149:156823d33999 5784
<> 149:156823d33999 5785 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5786 *
<> 149:156823d33999 5787 * @param func Static function to attach
<> 149:156823d33999 5788 * @param arg Pointer argument to function
<> 149:156823d33999 5789 * @return Callback with infered type
<> 149:156823d33999 5790 */
<> 149:156823d33999 5791 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5792 Callback<R(A0, A1, A2, A3, A4)> callback(R (*func)(const T*, A0, A1, A2, A3, A4), const T *arg) {
<> 149:156823d33999 5793 return Callback<R(A0, A1, A2, A3, A4)>(func, arg);
<> 149:156823d33999 5794 }
<> 149:156823d33999 5795
<> 149:156823d33999 5796 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5797 *
<> 149:156823d33999 5798 * @param func Static function to attach
<> 149:156823d33999 5799 * @param arg Pointer argument to function
<> 149:156823d33999 5800 * @return Callback with infered type
<> 149:156823d33999 5801 */
<> 149:156823d33999 5802 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5803 Callback<R(A0, A1, A2, A3, A4)> callback(R (*func)(volatile T*, A0, A1, A2, A3, A4), volatile T *arg) {
<> 149:156823d33999 5804 return Callback<R(A0, A1, A2, A3, A4)>(func, arg);
<> 149:156823d33999 5805 }
<> 149:156823d33999 5806
<> 149:156823d33999 5807 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5808 *
<> 149:156823d33999 5809 * @param func Static function to attach
<> 149:156823d33999 5810 * @param arg Pointer argument to function
<> 149:156823d33999 5811 * @return Callback with infered type
<> 149:156823d33999 5812 */
<> 149:156823d33999 5813 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5814 Callback<R(A0, A1, A2, A3, A4)> callback(R (*func)(const volatile T*, A0, A1, A2, A3, A4), const volatile T *arg) {
<> 149:156823d33999 5815 return Callback<R(A0, A1, A2, A3, A4)>(func, arg);
<> 149:156823d33999 5816 }
<> 149:156823d33999 5817
<> 149:156823d33999 5818 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5819 *
<> 149:156823d33999 5820 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5821 * @param func Static function to attach
<> 149:156823d33999 5822 * @return Callback with infered type
<> 149:156823d33999 5823 * @deprecated
<> 149:156823d33999 5824 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5825 */
<> 149:156823d33999 5826 template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5827 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5828 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5829 Callback<R(A0, A1, A2, A3, A4)> callback(void *obj, R (*func)(void*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 5830 return Callback<R(A0, A1, A2, A3, A4)>(func, obj);
<> 149:156823d33999 5831 }
<> 149:156823d33999 5832
<> 149:156823d33999 5833 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5834 *
<> 149:156823d33999 5835 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5836 * @param func Static function to attach
<> 149:156823d33999 5837 * @return Callback with infered type
<> 149:156823d33999 5838 * @deprecated
<> 149:156823d33999 5839 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5840 */
<> 149:156823d33999 5841 template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5842 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5843 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5844 Callback<R(A0, A1, A2, A3, A4)> callback(const void *obj, R (*func)(const void*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 5845 return Callback<R(A0, A1, A2, A3, A4)>(func, obj);
<> 149:156823d33999 5846 }
<> 149:156823d33999 5847
<> 149:156823d33999 5848 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5849 *
<> 149:156823d33999 5850 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5851 * @param func Static function to attach
<> 149:156823d33999 5852 * @return Callback with infered type
<> 149:156823d33999 5853 * @deprecated
<> 149:156823d33999 5854 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5855 */
<> 149:156823d33999 5856 template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5857 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5858 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5859 Callback<R(A0, A1, A2, A3, A4)> callback(volatile void *obj, R (*func)(volatile void*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 5860 return Callback<R(A0, A1, A2, A3, A4)>(func, obj);
<> 149:156823d33999 5861 }
<> 149:156823d33999 5862
<> 149:156823d33999 5863 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5864 *
<> 149:156823d33999 5865 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5866 * @param func Static function to attach
<> 149:156823d33999 5867 * @return Callback with infered type
<> 149:156823d33999 5868 * @deprecated
<> 149:156823d33999 5869 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5870 */
<> 149:156823d33999 5871 template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5872 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5873 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5874 Callback<R(A0, A1, A2, A3, A4)> callback(const volatile void *obj, R (*func)(const volatile void*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 5875 return Callback<R(A0, A1, A2, A3, A4)>(func, obj);
<> 149:156823d33999 5876 }
<> 149:156823d33999 5877
<> 149:156823d33999 5878 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5879 *
<> 149:156823d33999 5880 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5881 * @param func Static function to attach
<> 149:156823d33999 5882 * @return Callback with infered type
<> 149:156823d33999 5883 * @deprecated
<> 149:156823d33999 5884 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5885 */
<> 149:156823d33999 5886 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5887 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5888 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5889 Callback<R(A0, A1, A2, A3, A4)> callback(T *obj, R (*func)(T*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 5890 return Callback<R(A0, A1, A2, A3, A4)>(func, obj);
<> 149:156823d33999 5891 }
<> 149:156823d33999 5892
<> 149:156823d33999 5893 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5894 *
<> 149:156823d33999 5895 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5896 * @param func Static function to attach
<> 149:156823d33999 5897 * @return Callback with infered type
<> 149:156823d33999 5898 * @deprecated
<> 149:156823d33999 5899 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5900 */
<> 149:156823d33999 5901 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5902 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5903 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5904 Callback<R(A0, A1, A2, A3, A4)> callback(const T *obj, R (*func)(const T*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 5905 return Callback<R(A0, A1, A2, A3, A4)>(func, obj);
<> 149:156823d33999 5906 }
<> 149:156823d33999 5907
<> 149:156823d33999 5908 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5909 *
<> 149:156823d33999 5910 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5911 * @param func Static function to attach
<> 149:156823d33999 5912 * @return Callback with infered type
<> 149:156823d33999 5913 * @deprecated
<> 149:156823d33999 5914 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5915 */
<> 149:156823d33999 5916 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5917 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5918 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5919 Callback<R(A0, A1, A2, A3, A4)> callback(volatile T *obj, R (*func)(volatile T*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 5920 return Callback<R(A0, A1, A2, A3, A4)>(func, obj);
<> 149:156823d33999 5921 }
<> 149:156823d33999 5922
<> 149:156823d33999 5923 /** Create a callback class with type infered from the arguments
<> 149:156823d33999 5924 *
<> 149:156823d33999 5925 * @param obj Optional pointer to object to bind to function
<> 149:156823d33999 5926 * @param func Static function to attach
<> 149:156823d33999 5927 * @return Callback with infered type
<> 149:156823d33999 5928 * @deprecated
<> 149:156823d33999 5929 * Arguments to callback have been reordered to callback(func, arg)
<> 149:156823d33999 5930 */
<> 149:156823d33999 5931 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
<> 149:156823d33999 5932 MBED_DEPRECATED_SINCE("mbed-os-5.1",
<> 149:156823d33999 5933 "Arguments to callback have been reordered to callback(func, arg)")
<> 149:156823d33999 5934 Callback<R(A0, A1, A2, A3, A4)> callback(const volatile T *obj, R (*func)(const volatile T*, A0, A1, A2, A3, A4)) {
<> 149:156823d33999 5935 return Callback<R(A0, A1, A2, A3, A4)>(func, obj);
<> 149:156823d33999 5936 }
<> 149:156823d33999 5937
<> 149:156823d33999 5938
<> 149:156823d33999 5939 } // namespace mbed
<> 149:156823d33999 5940
<> 149:156823d33999 5941 #endif
<> 149:156823d33999 5942
<> 149:156823d33999 5943
<> 149:156823d33999 5944 /** @}*/