ads1115 only

Fork of mbed by mbed official

Committer:
<>
Date:
Thu Oct 27 16:45:56 2016 +0100
Revision:
128:9bcdf88f62b0
Child:
130:d75b3fe1f5cb
Release 128 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

2966: Add kw24 support https://github.com/ARMmbed/mbed-os/pull/2966
3068: MultiTech mDot - clean up PeripheralPins.c and add new pin names https://github.com/ARMmbed/mbed-os/pull/3068
3089: Kinetis HAL: Remove clock initialization code from serial and ticker https://github.com/ARMmbed/mbed-os/pull/3089
2943: [NRF5] NVIC_SetVector functionality https://github.com/ARMmbed/mbed-os/pull/2943
2938: InterruptIn changes in NCS36510 HAL. https://github.com/ARMmbed/mbed-os/pull/2938
3108: Fix sleep function for NRF52. https://github.com/ARMmbed/mbed-os/pull/3108
3076: STM32F1: Correct timer master value reading https://github.com/ARMmbed/mbed-os/pull/3076
3085: Add LOWPOWERTIMER capability for NUCLEO_F303ZE https://github.com/ARMmbed/mbed-os/pull/3085
3046: [BEETLE] Update BLE stack on Beetle board https://github.com/ARMmbed/mbed-os/pull/3046
3122: [Silicon Labs] Update of Silicon Labs HAL https://github.com/ARMmbed/mbed-os/pull/3122
3022: OnSemi RAM usage fix https://github.com/ARMmbed/mbed-os/pull/3022
3121: STM32F3: Correct UART4 and UART5 defines when using DEVICE_SERIAL_ASYNCH https://github.com/ARMmbed/mbed-os/pull/3121
3142: Targets- NUMAKER_PFM_NUC47216 remove mbed 2 https://github.com/ARMmbed/mbed-os/pull/3142

Who changed what in which revision?

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