Development mbed library for MAX32630FTHR

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Dec 16 16:27:57 2016 +0000
Revision:
3:1198227e6421
Parent:
0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:5c4d7b2438d3 1 /* events
switches 0:5c4d7b2438d3 2 * Copyright (c) 2016 ARM Limited
switches 0:5c4d7b2438d3 3 *
switches 0:5c4d7b2438d3 4 * Licensed under the Apache License, Version 2.0 (the "License");
switches 0:5c4d7b2438d3 5 * you may not use this file except in compliance with the License.
switches 0:5c4d7b2438d3 6 * You may obtain a copy of the License at
switches 0:5c4d7b2438d3 7 *
switches 0:5c4d7b2438d3 8 * http://www.apache.org/licenses/LICENSE-2.0
switches 0:5c4d7b2438d3 9 *
switches 0:5c4d7b2438d3 10 * Unless required by applicable law or agreed to in writing, software
switches 0:5c4d7b2438d3 11 * distributed under the License is distributed on an "AS IS" BASIS,
switches 0:5c4d7b2438d3 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
switches 0:5c4d7b2438d3 13 * See the License for the specific language governing permissions and
switches 0:5c4d7b2438d3 14 * limitations under the License.
switches 0:5c4d7b2438d3 15 */
switches 0:5c4d7b2438d3 16 #ifndef EVENT_H
switches 0:5c4d7b2438d3 17 #define EVENT_H
switches 0:5c4d7b2438d3 18
switches 0:5c4d7b2438d3 19 #include "events/EventQueue.h"
switches 0:5c4d7b2438d3 20 #include "platform/mbed_assert.h"
switches 0:5c4d7b2438d3 21
switches 0:5c4d7b2438d3 22 namespace events {
switches 0:5c4d7b2438d3 23 /** \addtogroup events */
switches 0:5c4d7b2438d3 24 /** @{*/
switches 0:5c4d7b2438d3 25
switches 0:5c4d7b2438d3 26 /** Event
switches 0:5c4d7b2438d3 27 *
switches 0:5c4d7b2438d3 28 * Representation of an event for fine-grain dispatch control
switches 0:5c4d7b2438d3 29 */
switches 0:5c4d7b2438d3 30 template <typename F>
switches 0:5c4d7b2438d3 31 class Event;
switches 0:5c4d7b2438d3 32
switches 0:5c4d7b2438d3 33 /** Event
switches 0:5c4d7b2438d3 34 *
switches 0:5c4d7b2438d3 35 * Representation of an event for fine-grain dispatch control
switches 0:5c4d7b2438d3 36 */
switches 0:5c4d7b2438d3 37 template <>
switches 0:5c4d7b2438d3 38 class Event<void()> {
switches 0:5c4d7b2438d3 39 public:
switches 0:5c4d7b2438d3 40 /** Create an event
switches 0:5c4d7b2438d3 41 *
switches 0:5c4d7b2438d3 42 * Constructs an event bound to the specified event queue. The specified
switches 0:5c4d7b2438d3 43 * callback acts as the target for the event and is executed in the
switches 0:5c4d7b2438d3 44 * context of the event queue's dispatch loop once posted.
switches 0:5c4d7b2438d3 45 *
switches 0:5c4d7b2438d3 46 * @param q Event queue to dispatch on
switches 0:5c4d7b2438d3 47 * @param f Function to execute when the event is dispatched
switches 0:5c4d7b2438d3 48 * @param a0..a4 Arguments to pass to the callback
switches 0:5c4d7b2438d3 49 */
switches 0:5c4d7b2438d3 50 template <typename F>
switches 0:5c4d7b2438d3 51 Event(EventQueue *q, F f) {
switches 0:5c4d7b2438d3 52 _event = static_cast<struct event *>(
switches 0:5c4d7b2438d3 53 equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F)));
switches 0:5c4d7b2438d3 54
switches 0:5c4d7b2438d3 55 if (_event) {
switches 0:5c4d7b2438d3 56 _event->equeue = &q->_equeue;
switches 0:5c4d7b2438d3 57 _event->id = 0;
switches 0:5c4d7b2438d3 58 _event->delay = 0;
switches 0:5c4d7b2438d3 59 _event->period = -1;
switches 0:5c4d7b2438d3 60
switches 0:5c4d7b2438d3 61 _event->post = &Event::event_post<F>;
switches 0:5c4d7b2438d3 62 _event->dtor = &Event::event_dtor<F>;
switches 0:5c4d7b2438d3 63
switches 0:5c4d7b2438d3 64 new (_event+1) F(f);
switches 0:5c4d7b2438d3 65
switches 0:5c4d7b2438d3 66 _event->ref = 1;
switches 0:5c4d7b2438d3 67 }
switches 0:5c4d7b2438d3 68 }
switches 0:5c4d7b2438d3 69
switches 0:5c4d7b2438d3 70 /** Copy constructor for events
switches 0:5c4d7b2438d3 71 */
switches 0:5c4d7b2438d3 72 Event(const Event &e) {
switches 0:5c4d7b2438d3 73 _event = 0;
switches 0:5c4d7b2438d3 74 if (e._event) {
switches 0:5c4d7b2438d3 75 _event = e._event;
switches 0:5c4d7b2438d3 76 _event->ref += 1;
switches 0:5c4d7b2438d3 77 }
switches 0:5c4d7b2438d3 78 }
switches 0:5c4d7b2438d3 79
switches 0:5c4d7b2438d3 80 /** Assignment operator for events
switches 0:5c4d7b2438d3 81 */
switches 0:5c4d7b2438d3 82 Event &operator=(const Event &that) {
switches 0:5c4d7b2438d3 83 if (this != &that) {
switches 0:5c4d7b2438d3 84 this->~Event();
switches 0:5c4d7b2438d3 85 new (this) Event(that);
switches 0:5c4d7b2438d3 86 }
switches 0:5c4d7b2438d3 87
switches 0:5c4d7b2438d3 88 return *this;
switches 0:5c4d7b2438d3 89 }
switches 0:5c4d7b2438d3 90
switches 0:5c4d7b2438d3 91 /** Destructor for events
switches 0:5c4d7b2438d3 92 */
switches 0:5c4d7b2438d3 93 ~Event() {
switches 0:5c4d7b2438d3 94 if (_event) {
switches 0:5c4d7b2438d3 95 _event->ref -= 1;
switches 0:5c4d7b2438d3 96 if (_event->ref == 0) {
switches 0:5c4d7b2438d3 97 _event->dtor(_event);
switches 0:5c4d7b2438d3 98 equeue_dealloc(_event->equeue, _event);
switches 0:5c4d7b2438d3 99 }
switches 0:5c4d7b2438d3 100 }
switches 0:5c4d7b2438d3 101 }
switches 0:5c4d7b2438d3 102
switches 0:5c4d7b2438d3 103 /** Configure the delay of an event
switches 0:5c4d7b2438d3 104 *
switches 0:5c4d7b2438d3 105 * @param delay Millisecond delay before dispatching the event
switches 0:5c4d7b2438d3 106 */
switches 0:5c4d7b2438d3 107 void delay(int delay) {
switches 0:5c4d7b2438d3 108 if (_event) {
switches 0:5c4d7b2438d3 109 _event->delay = delay;
switches 0:5c4d7b2438d3 110 }
switches 0:5c4d7b2438d3 111 }
switches 0:5c4d7b2438d3 112
switches 0:5c4d7b2438d3 113 /** Configure the period of an event
switches 0:5c4d7b2438d3 114 *
switches 0:5c4d7b2438d3 115 * @param period Millisecond period for repeatedly dispatching an event
switches 0:5c4d7b2438d3 116 */
switches 0:5c4d7b2438d3 117 void period(int period) {
switches 0:5c4d7b2438d3 118 if (_event) {
switches 0:5c4d7b2438d3 119 _event->period = period;
switches 0:5c4d7b2438d3 120 }
switches 0:5c4d7b2438d3 121 }
switches 0:5c4d7b2438d3 122
switches 0:5c4d7b2438d3 123 /** Posts an event onto the underlying event queue
switches 0:5c4d7b2438d3 124 *
switches 0:5c4d7b2438d3 125 * The event is posted to the underlying queue and is executed in the
switches 0:5c4d7b2438d3 126 * context of the event queue's dispatch loop.
switches 0:5c4d7b2438d3 127 *
switches 0:5c4d7b2438d3 128 * The post function is irq safe and can act as a mechanism for moving
switches 0:5c4d7b2438d3 129 * events out of irq contexts.
switches 0:5c4d7b2438d3 130 *
switches 0:5c4d7b2438d3 131 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 132 * @return A unique id that represents the posted event and can
switches 0:5c4d7b2438d3 133 * be passed to EventQueue::cancel, or an id of 0 if
switches 0:5c4d7b2438d3 134 * there is not enough memory to allocate the event.
switches 0:5c4d7b2438d3 135 */
switches 0:5c4d7b2438d3 136 int post() const {
switches 0:5c4d7b2438d3 137 if (!_event) {
switches 0:5c4d7b2438d3 138 return 0;
switches 0:5c4d7b2438d3 139 }
switches 0:5c4d7b2438d3 140
switches 0:5c4d7b2438d3 141 _event->id = _event->post(_event);
switches 0:5c4d7b2438d3 142 return _event->id;
switches 0:5c4d7b2438d3 143 }
switches 0:5c4d7b2438d3 144
switches 0:5c4d7b2438d3 145 /** Posts an event onto the underlying event queue, returning void
switches 0:5c4d7b2438d3 146 *
switches 0:5c4d7b2438d3 147 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 148 */
switches 0:5c4d7b2438d3 149 void call() const {
switches 0:5c4d7b2438d3 150 MBED_UNUSED int id = post();
switches 0:5c4d7b2438d3 151 MBED_ASSERT(id);
switches 0:5c4d7b2438d3 152 }
switches 0:5c4d7b2438d3 153
switches 0:5c4d7b2438d3 154 /** Posts an event onto the underlying event queue, returning void
switches 0:5c4d7b2438d3 155 *
switches 0:5c4d7b2438d3 156 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 157 */
switches 0:5c4d7b2438d3 158 void operator()() const {
switches 0:5c4d7b2438d3 159 return call();
switches 0:5c4d7b2438d3 160 }
switches 0:5c4d7b2438d3 161
switches 0:5c4d7b2438d3 162 /** Static thunk for passing as C-style function
switches 0:5c4d7b2438d3 163 *
switches 0:5c4d7b2438d3 164 * @param func Event to call passed as a void pointer
switches 0:5c4d7b2438d3 165 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 166 */
switches 0:5c4d7b2438d3 167 static void thunk(void *func) {
switches 0:5c4d7b2438d3 168 return static_cast<Event*>(func)->call();
switches 0:5c4d7b2438d3 169 }
switches 0:5c4d7b2438d3 170
switches 0:5c4d7b2438d3 171 /** Cancels the most recently posted event
switches 0:5c4d7b2438d3 172 *
switches 0:5c4d7b2438d3 173 * Attempts to cancel the most recently posted event. It is safe to call
switches 0:5c4d7b2438d3 174 * cancel after an event has already been dispatched.
switches 0:5c4d7b2438d3 175 *
switches 0:5c4d7b2438d3 176 * The cancel function is irq safe.
switches 0:5c4d7b2438d3 177 *
switches 0:5c4d7b2438d3 178 * If called while the event queue's dispatch loop is active, the cancel
switches 0:5c4d7b2438d3 179 * function does not garuntee that the event will not execute after it
switches 0:5c4d7b2438d3 180 * returns, as the event may have already begun executing.
switches 0:5c4d7b2438d3 181 */
switches 0:5c4d7b2438d3 182 void cancel() const {
switches 0:5c4d7b2438d3 183 if (_event) {
switches 0:5c4d7b2438d3 184 equeue_cancel(_event->equeue, _event->id);
switches 0:5c4d7b2438d3 185 }
switches 0:5c4d7b2438d3 186 }
switches 0:5c4d7b2438d3 187
switches 0:5c4d7b2438d3 188 private:
switches 0:5c4d7b2438d3 189 struct event {
switches 0:5c4d7b2438d3 190 unsigned ref;
switches 0:5c4d7b2438d3 191 equeue_t *equeue;
switches 0:5c4d7b2438d3 192 int id;
switches 0:5c4d7b2438d3 193
switches 0:5c4d7b2438d3 194 int delay;
switches 0:5c4d7b2438d3 195 int period;
switches 0:5c4d7b2438d3 196
switches 0:5c4d7b2438d3 197 int (*post)(struct event *);
switches 0:5c4d7b2438d3 198 void (*dtor)(struct event *);
switches 0:5c4d7b2438d3 199
switches 0:5c4d7b2438d3 200 // F follows
switches 0:5c4d7b2438d3 201 } *_event;
switches 0:5c4d7b2438d3 202
switches 0:5c4d7b2438d3 203 // Event attributes
switches 0:5c4d7b2438d3 204 template <typename F>
switches 0:5c4d7b2438d3 205 static int event_post(struct event *e) {
switches 0:5c4d7b2438d3 206 typedef EventQueue::context00<F> C;
switches 0:5c4d7b2438d3 207 void *p = equeue_alloc(e->equeue, sizeof(C));
switches 0:5c4d7b2438d3 208 if (!p) {
switches 0:5c4d7b2438d3 209 return 0;
switches 0:5c4d7b2438d3 210 }
switches 0:5c4d7b2438d3 211
switches 0:5c4d7b2438d3 212 new (p) C(*(F*)(e + 1));
switches 0:5c4d7b2438d3 213 equeue_event_delay(p, e->delay);
switches 0:5c4d7b2438d3 214 equeue_event_period(p, e->period);
switches 0:5c4d7b2438d3 215 equeue_event_dtor(p, &EventQueue::function_dtor<C>);
switches 0:5c4d7b2438d3 216 return equeue_post(e->equeue, &EventQueue::function_call<C>, p);
switches 0:5c4d7b2438d3 217 }
switches 0:5c4d7b2438d3 218
switches 0:5c4d7b2438d3 219 template <typename F>
switches 0:5c4d7b2438d3 220 static void event_dtor(struct event *e) {
switches 0:5c4d7b2438d3 221 ((F*)(e + 1))->~F();
switches 0:5c4d7b2438d3 222 }
switches 0:5c4d7b2438d3 223
switches 0:5c4d7b2438d3 224 public:
switches 0:5c4d7b2438d3 225 /** Create an event
switches 0:5c4d7b2438d3 226 * @see Event::Event
switches 0:5c4d7b2438d3 227 */
switches 0:5c4d7b2438d3 228 template <typename F, typename C0>
switches 0:5c4d7b2438d3 229 Event(EventQueue *q, F f, C0 c0) {
switches 0:5c4d7b2438d3 230 new (this) Event(q, EventQueue::context10<F, C0>(f, c0));
switches 0:5c4d7b2438d3 231 }
switches 0:5c4d7b2438d3 232
switches 0:5c4d7b2438d3 233 /** Create an event
switches 0:5c4d7b2438d3 234 * @see Event::Event
switches 0:5c4d7b2438d3 235 */
switches 0:5c4d7b2438d3 236 template <typename F, typename C0, typename C1>
switches 0:5c4d7b2438d3 237 Event(EventQueue *q, F f, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 238 new (this) Event(q, EventQueue::context20<F, C0, C1>(f, c0, c1));
switches 0:5c4d7b2438d3 239 }
switches 0:5c4d7b2438d3 240
switches 0:5c4d7b2438d3 241 /** Create an event
switches 0:5c4d7b2438d3 242 * @see Event::Event
switches 0:5c4d7b2438d3 243 */
switches 0:5c4d7b2438d3 244 template <typename F, typename C0, typename C1, typename C2>
switches 0:5c4d7b2438d3 245 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 246 new (this) Event(q, EventQueue::context30<F, C0, C1, C2>(f, c0, c1, c2));
switches 0:5c4d7b2438d3 247 }
switches 0:5c4d7b2438d3 248
switches 0:5c4d7b2438d3 249 /** Create an event
switches 0:5c4d7b2438d3 250 * @see Event::Event
switches 0:5c4d7b2438d3 251 */
switches 0:5c4d7b2438d3 252 template <typename F, typename C0, typename C1, typename C2, typename C3>
switches 0:5c4d7b2438d3 253 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 254 new (this) Event(q, EventQueue::context40<F, C0, C1, C2, C3>(f, c0, c1, c2, c3));
switches 0:5c4d7b2438d3 255 }
switches 0:5c4d7b2438d3 256
switches 0:5c4d7b2438d3 257 /** Create an event
switches 0:5c4d7b2438d3 258 * @see Event::Event
switches 0:5c4d7b2438d3 259 */
switches 0:5c4d7b2438d3 260 template <typename F, typename C0, typename C1, typename C2, typename C3, typename C4>
switches 0:5c4d7b2438d3 261 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 262 new (this) Event(q, EventQueue::context50<F, C0, C1, C2, C3, C4>(f, c0, c1, c2, c3, c4));
switches 0:5c4d7b2438d3 263 }
switches 0:5c4d7b2438d3 264
switches 0:5c4d7b2438d3 265 /** Create an event
switches 0:5c4d7b2438d3 266 * @see Event::Event
switches 0:5c4d7b2438d3 267 */
switches 0:5c4d7b2438d3 268 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 269 Event(EventQueue *q, T *obj, R (T::*method)(B0), B0 b0) {
switches 0:5c4d7b2438d3 270 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 271 }
switches 0:5c4d7b2438d3 272
switches 0:5c4d7b2438d3 273 /** Create an event
switches 0:5c4d7b2438d3 274 * @see Event::Event
switches 0:5c4d7b2438d3 275 */
switches 0:5c4d7b2438d3 276 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 277 Event(EventQueue *q, const T *obj, R (T::*method)(B0) const, B0 b0) {
switches 0:5c4d7b2438d3 278 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 279 }
switches 0:5c4d7b2438d3 280
switches 0:5c4d7b2438d3 281 /** Create an event
switches 0:5c4d7b2438d3 282 * @see Event::Event
switches 0:5c4d7b2438d3 283 */
switches 0:5c4d7b2438d3 284 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 285 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0) volatile, B0 b0) {
switches 0:5c4d7b2438d3 286 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 287 }
switches 0:5c4d7b2438d3 288
switches 0:5c4d7b2438d3 289 /** Create an event
switches 0:5c4d7b2438d3 290 * @see Event::Event
switches 0:5c4d7b2438d3 291 */
switches 0:5c4d7b2438d3 292 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 293 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0) const volatile, B0 b0) {
switches 0:5c4d7b2438d3 294 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 295 }
switches 0:5c4d7b2438d3 296
switches 0:5c4d7b2438d3 297 /** Create an event
switches 0:5c4d7b2438d3 298 * @see Event::Event
switches 0:5c4d7b2438d3 299 */
switches 0:5c4d7b2438d3 300 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 301 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1), B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 302 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 303 }
switches 0:5c4d7b2438d3 304
switches 0:5c4d7b2438d3 305 /** Create an event
switches 0:5c4d7b2438d3 306 * @see Event::Event
switches 0:5c4d7b2438d3 307 */
switches 0:5c4d7b2438d3 308 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 309 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1) const, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 310 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 311 }
switches 0:5c4d7b2438d3 312
switches 0:5c4d7b2438d3 313 /** Create an event
switches 0:5c4d7b2438d3 314 * @see Event::Event
switches 0:5c4d7b2438d3 315 */
switches 0:5c4d7b2438d3 316 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 317 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1) volatile, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 318 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 319 }
switches 0:5c4d7b2438d3 320
switches 0:5c4d7b2438d3 321 /** Create an event
switches 0:5c4d7b2438d3 322 * @see Event::Event
switches 0:5c4d7b2438d3 323 */
switches 0:5c4d7b2438d3 324 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 325 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1) const volatile, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 326 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 327 }
switches 0:5c4d7b2438d3 328
switches 0:5c4d7b2438d3 329 /** Create an event
switches 0:5c4d7b2438d3 330 * @see Event::Event
switches 0:5c4d7b2438d3 331 */
switches 0:5c4d7b2438d3 332 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 333 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2), B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 334 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 335 }
switches 0:5c4d7b2438d3 336
switches 0:5c4d7b2438d3 337 /** Create an event
switches 0:5c4d7b2438d3 338 * @see Event::Event
switches 0:5c4d7b2438d3 339 */
switches 0:5c4d7b2438d3 340 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 341 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2) const, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 342 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 343 }
switches 0:5c4d7b2438d3 344
switches 0:5c4d7b2438d3 345 /** Create an event
switches 0:5c4d7b2438d3 346 * @see Event::Event
switches 0:5c4d7b2438d3 347 */
switches 0:5c4d7b2438d3 348 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 349 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2) volatile, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 350 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 351 }
switches 0:5c4d7b2438d3 352
switches 0:5c4d7b2438d3 353 /** Create an event
switches 0:5c4d7b2438d3 354 * @see Event::Event
switches 0:5c4d7b2438d3 355 */
switches 0:5c4d7b2438d3 356 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 357 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2) const volatile, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 358 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 359 }
switches 0:5c4d7b2438d3 360
switches 0:5c4d7b2438d3 361 /** Create an event
switches 0:5c4d7b2438d3 362 * @see Event::Event
switches 0:5c4d7b2438d3 363 */
switches 0:5c4d7b2438d3 364 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 365 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3), B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 366 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 367 }
switches 0:5c4d7b2438d3 368
switches 0:5c4d7b2438d3 369 /** Create an event
switches 0:5c4d7b2438d3 370 * @see Event::Event
switches 0:5c4d7b2438d3 371 */
switches 0:5c4d7b2438d3 372 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 373 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3) const, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 374 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 375 }
switches 0:5c4d7b2438d3 376
switches 0:5c4d7b2438d3 377 /** Create an event
switches 0:5c4d7b2438d3 378 * @see Event::Event
switches 0:5c4d7b2438d3 379 */
switches 0:5c4d7b2438d3 380 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 381 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3) volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 382 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 383 }
switches 0:5c4d7b2438d3 384
switches 0:5c4d7b2438d3 385 /** Create an event
switches 0:5c4d7b2438d3 386 * @see Event::Event
switches 0:5c4d7b2438d3 387 */
switches 0:5c4d7b2438d3 388 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 389 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, B3) const volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 390 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 391 }
switches 0:5c4d7b2438d3 392
switches 0:5c4d7b2438d3 393 /** Create an event
switches 0:5c4d7b2438d3 394 * @see Event::Event
switches 0:5c4d7b2438d3 395 */
switches 0:5c4d7b2438d3 396 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 397 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, B4), B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 398 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 399 }
switches 0:5c4d7b2438d3 400
switches 0:5c4d7b2438d3 401 /** Create an event
switches 0:5c4d7b2438d3 402 * @see Event::Event
switches 0:5c4d7b2438d3 403 */
switches 0:5c4d7b2438d3 404 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 405 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3, B4) const, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 406 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 407 }
switches 0:5c4d7b2438d3 408
switches 0:5c4d7b2438d3 409 /** Create an event
switches 0:5c4d7b2438d3 410 * @see Event::Event
switches 0:5c4d7b2438d3 411 */
switches 0:5c4d7b2438d3 412 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 413 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4) volatile, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 414 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 415 }
switches 0:5c4d7b2438d3 416
switches 0:5c4d7b2438d3 417 /** Create an event
switches 0:5c4d7b2438d3 418 * @see Event::Event
switches 0:5c4d7b2438d3 419 */
switches 0:5c4d7b2438d3 420 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 421 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4) const volatile, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 422 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 423 }
switches 0:5c4d7b2438d3 424 };
switches 0:5c4d7b2438d3 425
switches 0:5c4d7b2438d3 426 /** Event
switches 0:5c4d7b2438d3 427 *
switches 0:5c4d7b2438d3 428 * Representation of an event for fine-grain dispatch control
switches 0:5c4d7b2438d3 429 */
switches 0:5c4d7b2438d3 430 template <typename A0>
switches 0:5c4d7b2438d3 431 class Event<void(A0)> {
switches 0:5c4d7b2438d3 432 public:
switches 0:5c4d7b2438d3 433 /** Create an event
switches 0:5c4d7b2438d3 434 *
switches 0:5c4d7b2438d3 435 * Constructs an event bound to the specified event queue. The specified
switches 0:5c4d7b2438d3 436 * callback acts as the target for the event and is executed in the
switches 0:5c4d7b2438d3 437 * context of the event queue's dispatch loop once posted.
switches 0:5c4d7b2438d3 438 *
switches 0:5c4d7b2438d3 439 * @param q Event queue to dispatch on
switches 0:5c4d7b2438d3 440 * @param f Function to execute when the event is dispatched
switches 0:5c4d7b2438d3 441 * @param a0..a4 Arguments to pass to the callback
switches 0:5c4d7b2438d3 442 */
switches 0:5c4d7b2438d3 443 template <typename F>
switches 0:5c4d7b2438d3 444 Event(EventQueue *q, F f) {
switches 0:5c4d7b2438d3 445 _event = static_cast<struct event *>(
switches 0:5c4d7b2438d3 446 equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F)));
switches 0:5c4d7b2438d3 447
switches 0:5c4d7b2438d3 448 if (_event) {
switches 0:5c4d7b2438d3 449 _event->equeue = &q->_equeue;
switches 0:5c4d7b2438d3 450 _event->id = 0;
switches 0:5c4d7b2438d3 451 _event->delay = 0;
switches 0:5c4d7b2438d3 452 _event->period = -1;
switches 0:5c4d7b2438d3 453
switches 0:5c4d7b2438d3 454 _event->post = &Event::event_post<F>;
switches 0:5c4d7b2438d3 455 _event->dtor = &Event::event_dtor<F>;
switches 0:5c4d7b2438d3 456
switches 0:5c4d7b2438d3 457 new (_event+1) F(f);
switches 0:5c4d7b2438d3 458
switches 0:5c4d7b2438d3 459 _event->ref = 1;
switches 0:5c4d7b2438d3 460 }
switches 0:5c4d7b2438d3 461 }
switches 0:5c4d7b2438d3 462
switches 0:5c4d7b2438d3 463 /** Copy constructor for events
switches 0:5c4d7b2438d3 464 */
switches 0:5c4d7b2438d3 465 Event(const Event &e) {
switches 0:5c4d7b2438d3 466 _event = 0;
switches 0:5c4d7b2438d3 467 if (e._event) {
switches 0:5c4d7b2438d3 468 _event = e._event;
switches 0:5c4d7b2438d3 469 _event->ref += 1;
switches 0:5c4d7b2438d3 470 }
switches 0:5c4d7b2438d3 471 }
switches 0:5c4d7b2438d3 472
switches 0:5c4d7b2438d3 473 /** Assignment operator for events
switches 0:5c4d7b2438d3 474 */
switches 0:5c4d7b2438d3 475 Event &operator=(const Event &that) {
switches 0:5c4d7b2438d3 476 if (this != &that) {
switches 0:5c4d7b2438d3 477 this->~Event();
switches 0:5c4d7b2438d3 478 new (this) Event(that);
switches 0:5c4d7b2438d3 479 }
switches 0:5c4d7b2438d3 480
switches 0:5c4d7b2438d3 481 return *this;
switches 0:5c4d7b2438d3 482 }
switches 0:5c4d7b2438d3 483
switches 0:5c4d7b2438d3 484 /** Destructor for events
switches 0:5c4d7b2438d3 485 */
switches 0:5c4d7b2438d3 486 ~Event() {
switches 0:5c4d7b2438d3 487 if (_event) {
switches 0:5c4d7b2438d3 488 _event->ref -= 1;
switches 0:5c4d7b2438d3 489 if (_event->ref == 0) {
switches 0:5c4d7b2438d3 490 _event->dtor(_event);
switches 0:5c4d7b2438d3 491 equeue_dealloc(_event->equeue, _event);
switches 0:5c4d7b2438d3 492 }
switches 0:5c4d7b2438d3 493 }
switches 0:5c4d7b2438d3 494 }
switches 0:5c4d7b2438d3 495
switches 0:5c4d7b2438d3 496 /** Configure the delay of an event
switches 0:5c4d7b2438d3 497 *
switches 0:5c4d7b2438d3 498 * @param delay Millisecond delay before dispatching the event
switches 0:5c4d7b2438d3 499 */
switches 0:5c4d7b2438d3 500 void delay(int delay) {
switches 0:5c4d7b2438d3 501 if (_event) {
switches 0:5c4d7b2438d3 502 _event->delay = delay;
switches 0:5c4d7b2438d3 503 }
switches 0:5c4d7b2438d3 504 }
switches 0:5c4d7b2438d3 505
switches 0:5c4d7b2438d3 506 /** Configure the period of an event
switches 0:5c4d7b2438d3 507 *
switches 0:5c4d7b2438d3 508 * @param period Millisecond period for repeatedly dispatching an event
switches 0:5c4d7b2438d3 509 */
switches 0:5c4d7b2438d3 510 void period(int period) {
switches 0:5c4d7b2438d3 511 if (_event) {
switches 0:5c4d7b2438d3 512 _event->period = period;
switches 0:5c4d7b2438d3 513 }
switches 0:5c4d7b2438d3 514 }
switches 0:5c4d7b2438d3 515
switches 0:5c4d7b2438d3 516 /** Posts an event onto the underlying event queue
switches 0:5c4d7b2438d3 517 *
switches 0:5c4d7b2438d3 518 * The event is posted to the underlying queue and is executed in the
switches 0:5c4d7b2438d3 519 * context of the event queue's dispatch loop.
switches 0:5c4d7b2438d3 520 *
switches 0:5c4d7b2438d3 521 * The post function is irq safe and can act as a mechanism for moving
switches 0:5c4d7b2438d3 522 * events out of irq contexts.
switches 0:5c4d7b2438d3 523 *
switches 0:5c4d7b2438d3 524 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 525 * @return A unique id that represents the posted event and can
switches 0:5c4d7b2438d3 526 * be passed to EventQueue::cancel, or an id of 0 if
switches 0:5c4d7b2438d3 527 * there is not enough memory to allocate the event.
switches 0:5c4d7b2438d3 528 */
switches 0:5c4d7b2438d3 529 int post(A0 a0) const {
switches 0:5c4d7b2438d3 530 if (!_event) {
switches 0:5c4d7b2438d3 531 return 0;
switches 0:5c4d7b2438d3 532 }
switches 0:5c4d7b2438d3 533
switches 0:5c4d7b2438d3 534 _event->id = _event->post(_event, a0);
switches 0:5c4d7b2438d3 535 return _event->id;
switches 0:5c4d7b2438d3 536 }
switches 0:5c4d7b2438d3 537
switches 0:5c4d7b2438d3 538 /** Posts an event onto the underlying event queue, returning void
switches 0:5c4d7b2438d3 539 *
switches 0:5c4d7b2438d3 540 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 541 */
switches 0:5c4d7b2438d3 542 void call(A0 a0) const {
switches 0:5c4d7b2438d3 543 MBED_UNUSED int id = post(a0);
switches 0:5c4d7b2438d3 544 MBED_ASSERT(id);
switches 0:5c4d7b2438d3 545 }
switches 0:5c4d7b2438d3 546
switches 0:5c4d7b2438d3 547 /** Posts an event onto the underlying event queue, returning void
switches 0:5c4d7b2438d3 548 *
switches 0:5c4d7b2438d3 549 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 550 */
switches 0:5c4d7b2438d3 551 void operator()(A0 a0) const {
switches 0:5c4d7b2438d3 552 return call(a0);
switches 0:5c4d7b2438d3 553 }
switches 0:5c4d7b2438d3 554
switches 0:5c4d7b2438d3 555 /** Static thunk for passing as C-style function
switches 0:5c4d7b2438d3 556 *
switches 0:5c4d7b2438d3 557 * @param func Event to call passed as a void pointer
switches 0:5c4d7b2438d3 558 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 559 */
switches 0:5c4d7b2438d3 560 static void thunk(void *func, A0 a0) {
switches 0:5c4d7b2438d3 561 return static_cast<Event*>(func)->call(a0);
switches 0:5c4d7b2438d3 562 }
switches 0:5c4d7b2438d3 563
switches 0:5c4d7b2438d3 564 /** Cancels the most recently posted event
switches 0:5c4d7b2438d3 565 *
switches 0:5c4d7b2438d3 566 * Attempts to cancel the most recently posted event. It is safe to call
switches 0:5c4d7b2438d3 567 * cancel after an event has already been dispatched.
switches 0:5c4d7b2438d3 568 *
switches 0:5c4d7b2438d3 569 * The cancel function is irq safe.
switches 0:5c4d7b2438d3 570 *
switches 0:5c4d7b2438d3 571 * If called while the event queue's dispatch loop is active, the cancel
switches 0:5c4d7b2438d3 572 * function does not garuntee that the event will not execute after it
switches 0:5c4d7b2438d3 573 * returns, as the event may have already begun executing.
switches 0:5c4d7b2438d3 574 */
switches 0:5c4d7b2438d3 575 void cancel() const {
switches 0:5c4d7b2438d3 576 if (_event) {
switches 0:5c4d7b2438d3 577 equeue_cancel(_event->equeue, _event->id);
switches 0:5c4d7b2438d3 578 }
switches 0:5c4d7b2438d3 579 }
switches 0:5c4d7b2438d3 580
switches 0:5c4d7b2438d3 581 private:
switches 0:5c4d7b2438d3 582 struct event {
switches 0:5c4d7b2438d3 583 unsigned ref;
switches 0:5c4d7b2438d3 584 equeue_t *equeue;
switches 0:5c4d7b2438d3 585 int id;
switches 0:5c4d7b2438d3 586
switches 0:5c4d7b2438d3 587 int delay;
switches 0:5c4d7b2438d3 588 int period;
switches 0:5c4d7b2438d3 589
switches 0:5c4d7b2438d3 590 int (*post)(struct event *, A0 a0);
switches 0:5c4d7b2438d3 591 void (*dtor)(struct event *);
switches 0:5c4d7b2438d3 592
switches 0:5c4d7b2438d3 593 // F follows
switches 0:5c4d7b2438d3 594 } *_event;
switches 0:5c4d7b2438d3 595
switches 0:5c4d7b2438d3 596 // Event attributes
switches 0:5c4d7b2438d3 597 template <typename F>
switches 0:5c4d7b2438d3 598 static int event_post(struct event *e, A0 a0) {
switches 0:5c4d7b2438d3 599 typedef EventQueue::context10<F, A0> C;
switches 0:5c4d7b2438d3 600 void *p = equeue_alloc(e->equeue, sizeof(C));
switches 0:5c4d7b2438d3 601 if (!p) {
switches 0:5c4d7b2438d3 602 return 0;
switches 0:5c4d7b2438d3 603 }
switches 0:5c4d7b2438d3 604
switches 0:5c4d7b2438d3 605 new (p) C(*(F*)(e + 1), a0);
switches 0:5c4d7b2438d3 606 equeue_event_delay(p, e->delay);
switches 0:5c4d7b2438d3 607 equeue_event_period(p, e->period);
switches 0:5c4d7b2438d3 608 equeue_event_dtor(p, &EventQueue::function_dtor<C>);
switches 0:5c4d7b2438d3 609 return equeue_post(e->equeue, &EventQueue::function_call<C>, p);
switches 0:5c4d7b2438d3 610 }
switches 0:5c4d7b2438d3 611
switches 0:5c4d7b2438d3 612 template <typename F>
switches 0:5c4d7b2438d3 613 static void event_dtor(struct event *e) {
switches 0:5c4d7b2438d3 614 ((F*)(e + 1))->~F();
switches 0:5c4d7b2438d3 615 }
switches 0:5c4d7b2438d3 616
switches 0:5c4d7b2438d3 617 public:
switches 0:5c4d7b2438d3 618 /** Create an event
switches 0:5c4d7b2438d3 619 * @see Event::Event
switches 0:5c4d7b2438d3 620 */
switches 0:5c4d7b2438d3 621 template <typename F, typename C0>
switches 0:5c4d7b2438d3 622 Event(EventQueue *q, F f, C0 c0) {
switches 0:5c4d7b2438d3 623 new (this) Event(q, EventQueue::context11<F, C0, A0>(f, c0));
switches 0:5c4d7b2438d3 624 }
switches 0:5c4d7b2438d3 625
switches 0:5c4d7b2438d3 626 /** Create an event
switches 0:5c4d7b2438d3 627 * @see Event::Event
switches 0:5c4d7b2438d3 628 */
switches 0:5c4d7b2438d3 629 template <typename F, typename C0, typename C1>
switches 0:5c4d7b2438d3 630 Event(EventQueue *q, F f, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 631 new (this) Event(q, EventQueue::context21<F, C0, C1, A0>(f, c0, c1));
switches 0:5c4d7b2438d3 632 }
switches 0:5c4d7b2438d3 633
switches 0:5c4d7b2438d3 634 /** Create an event
switches 0:5c4d7b2438d3 635 * @see Event::Event
switches 0:5c4d7b2438d3 636 */
switches 0:5c4d7b2438d3 637 template <typename F, typename C0, typename C1, typename C2>
switches 0:5c4d7b2438d3 638 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 639 new (this) Event(q, EventQueue::context31<F, C0, C1, C2, A0>(f, c0, c1, c2));
switches 0:5c4d7b2438d3 640 }
switches 0:5c4d7b2438d3 641
switches 0:5c4d7b2438d3 642 /** Create an event
switches 0:5c4d7b2438d3 643 * @see Event::Event
switches 0:5c4d7b2438d3 644 */
switches 0:5c4d7b2438d3 645 template <typename F, typename C0, typename C1, typename C2, typename C3>
switches 0:5c4d7b2438d3 646 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 647 new (this) Event(q, EventQueue::context41<F, C0, C1, C2, C3, A0>(f, c0, c1, c2, c3));
switches 0:5c4d7b2438d3 648 }
switches 0:5c4d7b2438d3 649
switches 0:5c4d7b2438d3 650 /** Create an event
switches 0:5c4d7b2438d3 651 * @see Event::Event
switches 0:5c4d7b2438d3 652 */
switches 0:5c4d7b2438d3 653 template <typename F, typename C0, typename C1, typename C2, typename C3, typename C4>
switches 0:5c4d7b2438d3 654 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 655 new (this) Event(q, EventQueue::context51<F, C0, C1, C2, C3, C4, A0>(f, c0, c1, c2, c3, c4));
switches 0:5c4d7b2438d3 656 }
switches 0:5c4d7b2438d3 657
switches 0:5c4d7b2438d3 658 /** Create an event
switches 0:5c4d7b2438d3 659 * @see Event::Event
switches 0:5c4d7b2438d3 660 */
switches 0:5c4d7b2438d3 661 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 662 Event(EventQueue *q, T *obj, R (T::*method)(B0, A0), B0 b0) {
switches 0:5c4d7b2438d3 663 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 664 }
switches 0:5c4d7b2438d3 665
switches 0:5c4d7b2438d3 666 /** Create an event
switches 0:5c4d7b2438d3 667 * @see Event::Event
switches 0:5c4d7b2438d3 668 */
switches 0:5c4d7b2438d3 669 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 670 Event(EventQueue *q, const T *obj, R (T::*method)(B0, A0) const, B0 b0) {
switches 0:5c4d7b2438d3 671 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 672 }
switches 0:5c4d7b2438d3 673
switches 0:5c4d7b2438d3 674 /** Create an event
switches 0:5c4d7b2438d3 675 * @see Event::Event
switches 0:5c4d7b2438d3 676 */
switches 0:5c4d7b2438d3 677 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 678 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, A0) volatile, B0 b0) {
switches 0:5c4d7b2438d3 679 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 680 }
switches 0:5c4d7b2438d3 681
switches 0:5c4d7b2438d3 682 /** Create an event
switches 0:5c4d7b2438d3 683 * @see Event::Event
switches 0:5c4d7b2438d3 684 */
switches 0:5c4d7b2438d3 685 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 686 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, A0) const volatile, B0 b0) {
switches 0:5c4d7b2438d3 687 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 688 }
switches 0:5c4d7b2438d3 689
switches 0:5c4d7b2438d3 690 /** Create an event
switches 0:5c4d7b2438d3 691 * @see Event::Event
switches 0:5c4d7b2438d3 692 */
switches 0:5c4d7b2438d3 693 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 694 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, A0), B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 695 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 696 }
switches 0:5c4d7b2438d3 697
switches 0:5c4d7b2438d3 698 /** Create an event
switches 0:5c4d7b2438d3 699 * @see Event::Event
switches 0:5c4d7b2438d3 700 */
switches 0:5c4d7b2438d3 701 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 702 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, A0) const, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 703 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 704 }
switches 0:5c4d7b2438d3 705
switches 0:5c4d7b2438d3 706 /** Create an event
switches 0:5c4d7b2438d3 707 * @see Event::Event
switches 0:5c4d7b2438d3 708 */
switches 0:5c4d7b2438d3 709 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 710 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, A0) volatile, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 711 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 712 }
switches 0:5c4d7b2438d3 713
switches 0:5c4d7b2438d3 714 /** Create an event
switches 0:5c4d7b2438d3 715 * @see Event::Event
switches 0:5c4d7b2438d3 716 */
switches 0:5c4d7b2438d3 717 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 718 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, A0) const volatile, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 719 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 720 }
switches 0:5c4d7b2438d3 721
switches 0:5c4d7b2438d3 722 /** Create an event
switches 0:5c4d7b2438d3 723 * @see Event::Event
switches 0:5c4d7b2438d3 724 */
switches 0:5c4d7b2438d3 725 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 726 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, A0), B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 727 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 728 }
switches 0:5c4d7b2438d3 729
switches 0:5c4d7b2438d3 730 /** Create an event
switches 0:5c4d7b2438d3 731 * @see Event::Event
switches 0:5c4d7b2438d3 732 */
switches 0:5c4d7b2438d3 733 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 734 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, A0) const, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 735 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 736 }
switches 0:5c4d7b2438d3 737
switches 0:5c4d7b2438d3 738 /** Create an event
switches 0:5c4d7b2438d3 739 * @see Event::Event
switches 0:5c4d7b2438d3 740 */
switches 0:5c4d7b2438d3 741 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 742 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, A0) volatile, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 743 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 744 }
switches 0:5c4d7b2438d3 745
switches 0:5c4d7b2438d3 746 /** Create an event
switches 0:5c4d7b2438d3 747 * @see Event::Event
switches 0:5c4d7b2438d3 748 */
switches 0:5c4d7b2438d3 749 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 750 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, A0) const volatile, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 751 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 752 }
switches 0:5c4d7b2438d3 753
switches 0:5c4d7b2438d3 754 /** Create an event
switches 0:5c4d7b2438d3 755 * @see Event::Event
switches 0:5c4d7b2438d3 756 */
switches 0:5c4d7b2438d3 757 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 758 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, A0), B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 759 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 760 }
switches 0:5c4d7b2438d3 761
switches 0:5c4d7b2438d3 762 /** Create an event
switches 0:5c4d7b2438d3 763 * @see Event::Event
switches 0:5c4d7b2438d3 764 */
switches 0:5c4d7b2438d3 765 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 766 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3, A0) const, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 767 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 768 }
switches 0:5c4d7b2438d3 769
switches 0:5c4d7b2438d3 770 /** Create an event
switches 0:5c4d7b2438d3 771 * @see Event::Event
switches 0:5c4d7b2438d3 772 */
switches 0:5c4d7b2438d3 773 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 774 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0) volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 775 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 776 }
switches 0:5c4d7b2438d3 777
switches 0:5c4d7b2438d3 778 /** Create an event
switches 0:5c4d7b2438d3 779 * @see Event::Event
switches 0:5c4d7b2438d3 780 */
switches 0:5c4d7b2438d3 781 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 782 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0) const volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 783 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 784 }
switches 0:5c4d7b2438d3 785
switches 0:5c4d7b2438d3 786 /** Create an event
switches 0:5c4d7b2438d3 787 * @see Event::Event
switches 0:5c4d7b2438d3 788 */
switches 0:5c4d7b2438d3 789 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 790 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0), B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 791 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 792 }
switches 0:5c4d7b2438d3 793
switches 0:5c4d7b2438d3 794 /** Create an event
switches 0:5c4d7b2438d3 795 * @see Event::Event
switches 0:5c4d7b2438d3 796 */
switches 0:5c4d7b2438d3 797 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 798 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0) const, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 799 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 800 }
switches 0:5c4d7b2438d3 801
switches 0:5c4d7b2438d3 802 /** Create an event
switches 0:5c4d7b2438d3 803 * @see Event::Event
switches 0:5c4d7b2438d3 804 */
switches 0:5c4d7b2438d3 805 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 806 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0) volatile, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 807 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 808 }
switches 0:5c4d7b2438d3 809
switches 0:5c4d7b2438d3 810 /** Create an event
switches 0:5c4d7b2438d3 811 * @see Event::Event
switches 0:5c4d7b2438d3 812 */
switches 0:5c4d7b2438d3 813 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 814 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0) const volatile, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 815 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 816 }
switches 0:5c4d7b2438d3 817 };
switches 0:5c4d7b2438d3 818
switches 0:5c4d7b2438d3 819 /** Event
switches 0:5c4d7b2438d3 820 *
switches 0:5c4d7b2438d3 821 * Representation of an event for fine-grain dispatch control
switches 0:5c4d7b2438d3 822 */
switches 0:5c4d7b2438d3 823 template <typename A0, typename A1>
switches 0:5c4d7b2438d3 824 class Event<void(A0, A1)> {
switches 0:5c4d7b2438d3 825 public:
switches 0:5c4d7b2438d3 826 /** Create an event
switches 0:5c4d7b2438d3 827 *
switches 0:5c4d7b2438d3 828 * Constructs an event bound to the specified event queue. The specified
switches 0:5c4d7b2438d3 829 * callback acts as the target for the event and is executed in the
switches 0:5c4d7b2438d3 830 * context of the event queue's dispatch loop once posted.
switches 0:5c4d7b2438d3 831 *
switches 0:5c4d7b2438d3 832 * @param q Event queue to dispatch on
switches 0:5c4d7b2438d3 833 * @param f Function to execute when the event is dispatched
switches 0:5c4d7b2438d3 834 * @param a0..a4 Arguments to pass to the callback
switches 0:5c4d7b2438d3 835 */
switches 0:5c4d7b2438d3 836 template <typename F>
switches 0:5c4d7b2438d3 837 Event(EventQueue *q, F f) {
switches 0:5c4d7b2438d3 838 _event = static_cast<struct event *>(
switches 0:5c4d7b2438d3 839 equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F)));
switches 0:5c4d7b2438d3 840
switches 0:5c4d7b2438d3 841 if (_event) {
switches 0:5c4d7b2438d3 842 _event->equeue = &q->_equeue;
switches 0:5c4d7b2438d3 843 _event->id = 0;
switches 0:5c4d7b2438d3 844 _event->delay = 0;
switches 0:5c4d7b2438d3 845 _event->period = -1;
switches 0:5c4d7b2438d3 846
switches 0:5c4d7b2438d3 847 _event->post = &Event::event_post<F>;
switches 0:5c4d7b2438d3 848 _event->dtor = &Event::event_dtor<F>;
switches 0:5c4d7b2438d3 849
switches 0:5c4d7b2438d3 850 new (_event+1) F(f);
switches 0:5c4d7b2438d3 851
switches 0:5c4d7b2438d3 852 _event->ref = 1;
switches 0:5c4d7b2438d3 853 }
switches 0:5c4d7b2438d3 854 }
switches 0:5c4d7b2438d3 855
switches 0:5c4d7b2438d3 856 /** Copy constructor for events
switches 0:5c4d7b2438d3 857 */
switches 0:5c4d7b2438d3 858 Event(const Event &e) {
switches 0:5c4d7b2438d3 859 _event = 0;
switches 0:5c4d7b2438d3 860 if (e._event) {
switches 0:5c4d7b2438d3 861 _event = e._event;
switches 0:5c4d7b2438d3 862 _event->ref += 1;
switches 0:5c4d7b2438d3 863 }
switches 0:5c4d7b2438d3 864 }
switches 0:5c4d7b2438d3 865
switches 0:5c4d7b2438d3 866 /** Assignment operator for events
switches 0:5c4d7b2438d3 867 */
switches 0:5c4d7b2438d3 868 Event &operator=(const Event &that) {
switches 0:5c4d7b2438d3 869 if (this != &that) {
switches 0:5c4d7b2438d3 870 this->~Event();
switches 0:5c4d7b2438d3 871 new (this) Event(that);
switches 0:5c4d7b2438d3 872 }
switches 0:5c4d7b2438d3 873
switches 0:5c4d7b2438d3 874 return *this;
switches 0:5c4d7b2438d3 875 }
switches 0:5c4d7b2438d3 876
switches 0:5c4d7b2438d3 877 /** Destructor for events
switches 0:5c4d7b2438d3 878 */
switches 0:5c4d7b2438d3 879 ~Event() {
switches 0:5c4d7b2438d3 880 if (_event) {
switches 0:5c4d7b2438d3 881 _event->ref -= 1;
switches 0:5c4d7b2438d3 882 if (_event->ref == 0) {
switches 0:5c4d7b2438d3 883 _event->dtor(_event);
switches 0:5c4d7b2438d3 884 equeue_dealloc(_event->equeue, _event);
switches 0:5c4d7b2438d3 885 }
switches 0:5c4d7b2438d3 886 }
switches 0:5c4d7b2438d3 887 }
switches 0:5c4d7b2438d3 888
switches 0:5c4d7b2438d3 889 /** Configure the delay of an event
switches 0:5c4d7b2438d3 890 *
switches 0:5c4d7b2438d3 891 * @param delay Millisecond delay before dispatching the event
switches 0:5c4d7b2438d3 892 */
switches 0:5c4d7b2438d3 893 void delay(int delay) {
switches 0:5c4d7b2438d3 894 if (_event) {
switches 0:5c4d7b2438d3 895 _event->delay = delay;
switches 0:5c4d7b2438d3 896 }
switches 0:5c4d7b2438d3 897 }
switches 0:5c4d7b2438d3 898
switches 0:5c4d7b2438d3 899 /** Configure the period of an event
switches 0:5c4d7b2438d3 900 *
switches 0:5c4d7b2438d3 901 * @param period Millisecond period for repeatedly dispatching an event
switches 0:5c4d7b2438d3 902 */
switches 0:5c4d7b2438d3 903 void period(int period) {
switches 0:5c4d7b2438d3 904 if (_event) {
switches 0:5c4d7b2438d3 905 _event->period = period;
switches 0:5c4d7b2438d3 906 }
switches 0:5c4d7b2438d3 907 }
switches 0:5c4d7b2438d3 908
switches 0:5c4d7b2438d3 909 /** Posts an event onto the underlying event queue
switches 0:5c4d7b2438d3 910 *
switches 0:5c4d7b2438d3 911 * The event is posted to the underlying queue and is executed in the
switches 0:5c4d7b2438d3 912 * context of the event queue's dispatch loop.
switches 0:5c4d7b2438d3 913 *
switches 0:5c4d7b2438d3 914 * The post function is irq safe and can act as a mechanism for moving
switches 0:5c4d7b2438d3 915 * events out of irq contexts.
switches 0:5c4d7b2438d3 916 *
switches 0:5c4d7b2438d3 917 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 918 * @return A unique id that represents the posted event and can
switches 0:5c4d7b2438d3 919 * be passed to EventQueue::cancel, or an id of 0 if
switches 0:5c4d7b2438d3 920 * there is not enough memory to allocate the event.
switches 0:5c4d7b2438d3 921 */
switches 0:5c4d7b2438d3 922 int post(A0 a0, A1 a1) const {
switches 0:5c4d7b2438d3 923 if (!_event) {
switches 0:5c4d7b2438d3 924 return 0;
switches 0:5c4d7b2438d3 925 }
switches 0:5c4d7b2438d3 926
switches 0:5c4d7b2438d3 927 _event->id = _event->post(_event, a0, a1);
switches 0:5c4d7b2438d3 928 return _event->id;
switches 0:5c4d7b2438d3 929 }
switches 0:5c4d7b2438d3 930
switches 0:5c4d7b2438d3 931 /** Posts an event onto the underlying event queue, returning void
switches 0:5c4d7b2438d3 932 *
switches 0:5c4d7b2438d3 933 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 934 */
switches 0:5c4d7b2438d3 935 void call(A0 a0, A1 a1) const {
switches 0:5c4d7b2438d3 936 MBED_UNUSED int id = post(a0, a1);
switches 0:5c4d7b2438d3 937 MBED_ASSERT(id);
switches 0:5c4d7b2438d3 938 }
switches 0:5c4d7b2438d3 939
switches 0:5c4d7b2438d3 940 /** Posts an event onto the underlying event queue, returning void
switches 0:5c4d7b2438d3 941 *
switches 0:5c4d7b2438d3 942 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 943 */
switches 0:5c4d7b2438d3 944 void operator()(A0 a0, A1 a1) const {
switches 0:5c4d7b2438d3 945 return call(a0, a1);
switches 0:5c4d7b2438d3 946 }
switches 0:5c4d7b2438d3 947
switches 0:5c4d7b2438d3 948 /** Static thunk for passing as C-style function
switches 0:5c4d7b2438d3 949 *
switches 0:5c4d7b2438d3 950 * @param func Event to call passed as a void pointer
switches 0:5c4d7b2438d3 951 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 952 */
switches 0:5c4d7b2438d3 953 static void thunk(void *func, A0 a0, A1 a1) {
switches 0:5c4d7b2438d3 954 return static_cast<Event*>(func)->call(a0, a1);
switches 0:5c4d7b2438d3 955 }
switches 0:5c4d7b2438d3 956
switches 0:5c4d7b2438d3 957 /** Cancels the most recently posted event
switches 0:5c4d7b2438d3 958 *
switches 0:5c4d7b2438d3 959 * Attempts to cancel the most recently posted event. It is safe to call
switches 0:5c4d7b2438d3 960 * cancel after an event has already been dispatched.
switches 0:5c4d7b2438d3 961 *
switches 0:5c4d7b2438d3 962 * The cancel function is irq safe.
switches 0:5c4d7b2438d3 963 *
switches 0:5c4d7b2438d3 964 * If called while the event queue's dispatch loop is active, the cancel
switches 0:5c4d7b2438d3 965 * function does not garuntee that the event will not execute after it
switches 0:5c4d7b2438d3 966 * returns, as the event may have already begun executing.
switches 0:5c4d7b2438d3 967 */
switches 0:5c4d7b2438d3 968 void cancel() const {
switches 0:5c4d7b2438d3 969 if (_event) {
switches 0:5c4d7b2438d3 970 equeue_cancel(_event->equeue, _event->id);
switches 0:5c4d7b2438d3 971 }
switches 0:5c4d7b2438d3 972 }
switches 0:5c4d7b2438d3 973
switches 0:5c4d7b2438d3 974 private:
switches 0:5c4d7b2438d3 975 struct event {
switches 0:5c4d7b2438d3 976 unsigned ref;
switches 0:5c4d7b2438d3 977 equeue_t *equeue;
switches 0:5c4d7b2438d3 978 int id;
switches 0:5c4d7b2438d3 979
switches 0:5c4d7b2438d3 980 int delay;
switches 0:5c4d7b2438d3 981 int period;
switches 0:5c4d7b2438d3 982
switches 0:5c4d7b2438d3 983 int (*post)(struct event *, A0 a0, A1 a1);
switches 0:5c4d7b2438d3 984 void (*dtor)(struct event *);
switches 0:5c4d7b2438d3 985
switches 0:5c4d7b2438d3 986 // F follows
switches 0:5c4d7b2438d3 987 } *_event;
switches 0:5c4d7b2438d3 988
switches 0:5c4d7b2438d3 989 // Event attributes
switches 0:5c4d7b2438d3 990 template <typename F>
switches 0:5c4d7b2438d3 991 static int event_post(struct event *e, A0 a0, A1 a1) {
switches 0:5c4d7b2438d3 992 typedef EventQueue::context20<F, A0, A1> C;
switches 0:5c4d7b2438d3 993 void *p = equeue_alloc(e->equeue, sizeof(C));
switches 0:5c4d7b2438d3 994 if (!p) {
switches 0:5c4d7b2438d3 995 return 0;
switches 0:5c4d7b2438d3 996 }
switches 0:5c4d7b2438d3 997
switches 0:5c4d7b2438d3 998 new (p) C(*(F*)(e + 1), a0, a1);
switches 0:5c4d7b2438d3 999 equeue_event_delay(p, e->delay);
switches 0:5c4d7b2438d3 1000 equeue_event_period(p, e->period);
switches 0:5c4d7b2438d3 1001 equeue_event_dtor(p, &EventQueue::function_dtor<C>);
switches 0:5c4d7b2438d3 1002 return equeue_post(e->equeue, &EventQueue::function_call<C>, p);
switches 0:5c4d7b2438d3 1003 }
switches 0:5c4d7b2438d3 1004
switches 0:5c4d7b2438d3 1005 template <typename F>
switches 0:5c4d7b2438d3 1006 static void event_dtor(struct event *e) {
switches 0:5c4d7b2438d3 1007 ((F*)(e + 1))->~F();
switches 0:5c4d7b2438d3 1008 }
switches 0:5c4d7b2438d3 1009
switches 0:5c4d7b2438d3 1010 public:
switches 0:5c4d7b2438d3 1011 /** Create an event
switches 0:5c4d7b2438d3 1012 * @see Event::Event
switches 0:5c4d7b2438d3 1013 */
switches 0:5c4d7b2438d3 1014 template <typename F, typename C0>
switches 0:5c4d7b2438d3 1015 Event(EventQueue *q, F f, C0 c0) {
switches 0:5c4d7b2438d3 1016 new (this) Event(q, EventQueue::context12<F, C0, A0, A1>(f, c0));
switches 0:5c4d7b2438d3 1017 }
switches 0:5c4d7b2438d3 1018
switches 0:5c4d7b2438d3 1019 /** Create an event
switches 0:5c4d7b2438d3 1020 * @see Event::Event
switches 0:5c4d7b2438d3 1021 */
switches 0:5c4d7b2438d3 1022 template <typename F, typename C0, typename C1>
switches 0:5c4d7b2438d3 1023 Event(EventQueue *q, F f, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 1024 new (this) Event(q, EventQueue::context22<F, C0, C1, A0, A1>(f, c0, c1));
switches 0:5c4d7b2438d3 1025 }
switches 0:5c4d7b2438d3 1026
switches 0:5c4d7b2438d3 1027 /** Create an event
switches 0:5c4d7b2438d3 1028 * @see Event::Event
switches 0:5c4d7b2438d3 1029 */
switches 0:5c4d7b2438d3 1030 template <typename F, typename C0, typename C1, typename C2>
switches 0:5c4d7b2438d3 1031 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 1032 new (this) Event(q, EventQueue::context32<F, C0, C1, C2, A0, A1>(f, c0, c1, c2));
switches 0:5c4d7b2438d3 1033 }
switches 0:5c4d7b2438d3 1034
switches 0:5c4d7b2438d3 1035 /** Create an event
switches 0:5c4d7b2438d3 1036 * @see Event::Event
switches 0:5c4d7b2438d3 1037 */
switches 0:5c4d7b2438d3 1038 template <typename F, typename C0, typename C1, typename C2, typename C3>
switches 0:5c4d7b2438d3 1039 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 1040 new (this) Event(q, EventQueue::context42<F, C0, C1, C2, C3, A0, A1>(f, c0, c1, c2, c3));
switches 0:5c4d7b2438d3 1041 }
switches 0:5c4d7b2438d3 1042
switches 0:5c4d7b2438d3 1043 /** Create an event
switches 0:5c4d7b2438d3 1044 * @see Event::Event
switches 0:5c4d7b2438d3 1045 */
switches 0:5c4d7b2438d3 1046 template <typename F, typename C0, typename C1, typename C2, typename C3, typename C4>
switches 0:5c4d7b2438d3 1047 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 1048 new (this) Event(q, EventQueue::context52<F, C0, C1, C2, C3, C4, A0, A1>(f, c0, c1, c2, c3, c4));
switches 0:5c4d7b2438d3 1049 }
switches 0:5c4d7b2438d3 1050
switches 0:5c4d7b2438d3 1051 /** Create an event
switches 0:5c4d7b2438d3 1052 * @see Event::Event
switches 0:5c4d7b2438d3 1053 */
switches 0:5c4d7b2438d3 1054 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 1055 Event(EventQueue *q, T *obj, R (T::*method)(B0, A0, A1), B0 b0) {
switches 0:5c4d7b2438d3 1056 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 1057 }
switches 0:5c4d7b2438d3 1058
switches 0:5c4d7b2438d3 1059 /** Create an event
switches 0:5c4d7b2438d3 1060 * @see Event::Event
switches 0:5c4d7b2438d3 1061 */
switches 0:5c4d7b2438d3 1062 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 1063 Event(EventQueue *q, const T *obj, R (T::*method)(B0, A0, A1) const, B0 b0) {
switches 0:5c4d7b2438d3 1064 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 1065 }
switches 0:5c4d7b2438d3 1066
switches 0:5c4d7b2438d3 1067 /** Create an event
switches 0:5c4d7b2438d3 1068 * @see Event::Event
switches 0:5c4d7b2438d3 1069 */
switches 0:5c4d7b2438d3 1070 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 1071 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, A0, A1) volatile, B0 b0) {
switches 0:5c4d7b2438d3 1072 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 1073 }
switches 0:5c4d7b2438d3 1074
switches 0:5c4d7b2438d3 1075 /** Create an event
switches 0:5c4d7b2438d3 1076 * @see Event::Event
switches 0:5c4d7b2438d3 1077 */
switches 0:5c4d7b2438d3 1078 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 1079 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, A0, A1) const volatile, B0 b0) {
switches 0:5c4d7b2438d3 1080 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 1081 }
switches 0:5c4d7b2438d3 1082
switches 0:5c4d7b2438d3 1083 /** Create an event
switches 0:5c4d7b2438d3 1084 * @see Event::Event
switches 0:5c4d7b2438d3 1085 */
switches 0:5c4d7b2438d3 1086 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 1087 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, A0, A1), B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 1088 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 1089 }
switches 0:5c4d7b2438d3 1090
switches 0:5c4d7b2438d3 1091 /** Create an event
switches 0:5c4d7b2438d3 1092 * @see Event::Event
switches 0:5c4d7b2438d3 1093 */
switches 0:5c4d7b2438d3 1094 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 1095 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, A0, A1) const, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 1096 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 1097 }
switches 0:5c4d7b2438d3 1098
switches 0:5c4d7b2438d3 1099 /** Create an event
switches 0:5c4d7b2438d3 1100 * @see Event::Event
switches 0:5c4d7b2438d3 1101 */
switches 0:5c4d7b2438d3 1102 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 1103 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, A0, A1) volatile, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 1104 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 1105 }
switches 0:5c4d7b2438d3 1106
switches 0:5c4d7b2438d3 1107 /** Create an event
switches 0:5c4d7b2438d3 1108 * @see Event::Event
switches 0:5c4d7b2438d3 1109 */
switches 0:5c4d7b2438d3 1110 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 1111 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, A0, A1) const volatile, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 1112 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 1113 }
switches 0:5c4d7b2438d3 1114
switches 0:5c4d7b2438d3 1115 /** Create an event
switches 0:5c4d7b2438d3 1116 * @see Event::Event
switches 0:5c4d7b2438d3 1117 */
switches 0:5c4d7b2438d3 1118 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 1119 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, A0, A1), B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 1120 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 1121 }
switches 0:5c4d7b2438d3 1122
switches 0:5c4d7b2438d3 1123 /** Create an event
switches 0:5c4d7b2438d3 1124 * @see Event::Event
switches 0:5c4d7b2438d3 1125 */
switches 0:5c4d7b2438d3 1126 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 1127 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, A0, A1) const, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 1128 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 1129 }
switches 0:5c4d7b2438d3 1130
switches 0:5c4d7b2438d3 1131 /** Create an event
switches 0:5c4d7b2438d3 1132 * @see Event::Event
switches 0:5c4d7b2438d3 1133 */
switches 0:5c4d7b2438d3 1134 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 1135 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1) volatile, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 1136 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 1137 }
switches 0:5c4d7b2438d3 1138
switches 0:5c4d7b2438d3 1139 /** Create an event
switches 0:5c4d7b2438d3 1140 * @see Event::Event
switches 0:5c4d7b2438d3 1141 */
switches 0:5c4d7b2438d3 1142 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 1143 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1) const volatile, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 1144 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 1145 }
switches 0:5c4d7b2438d3 1146
switches 0:5c4d7b2438d3 1147 /** Create an event
switches 0:5c4d7b2438d3 1148 * @see Event::Event
switches 0:5c4d7b2438d3 1149 */
switches 0:5c4d7b2438d3 1150 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 1151 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1), B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 1152 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 1153 }
switches 0:5c4d7b2438d3 1154
switches 0:5c4d7b2438d3 1155 /** Create an event
switches 0:5c4d7b2438d3 1156 * @see Event::Event
switches 0:5c4d7b2438d3 1157 */
switches 0:5c4d7b2438d3 1158 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 1159 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1) const, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 1160 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 1161 }
switches 0:5c4d7b2438d3 1162
switches 0:5c4d7b2438d3 1163 /** Create an event
switches 0:5c4d7b2438d3 1164 * @see Event::Event
switches 0:5c4d7b2438d3 1165 */
switches 0:5c4d7b2438d3 1166 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 1167 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1) volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 1168 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 1169 }
switches 0:5c4d7b2438d3 1170
switches 0:5c4d7b2438d3 1171 /** Create an event
switches 0:5c4d7b2438d3 1172 * @see Event::Event
switches 0:5c4d7b2438d3 1173 */
switches 0:5c4d7b2438d3 1174 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 1175 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1) const volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 1176 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 1177 }
switches 0:5c4d7b2438d3 1178
switches 0:5c4d7b2438d3 1179 /** Create an event
switches 0:5c4d7b2438d3 1180 * @see Event::Event
switches 0:5c4d7b2438d3 1181 */
switches 0:5c4d7b2438d3 1182 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 1183 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1), B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 1184 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 1185 }
switches 0:5c4d7b2438d3 1186
switches 0:5c4d7b2438d3 1187 /** Create an event
switches 0:5c4d7b2438d3 1188 * @see Event::Event
switches 0:5c4d7b2438d3 1189 */
switches 0:5c4d7b2438d3 1190 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 1191 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1) const, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 1192 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 1193 }
switches 0:5c4d7b2438d3 1194
switches 0:5c4d7b2438d3 1195 /** Create an event
switches 0:5c4d7b2438d3 1196 * @see Event::Event
switches 0:5c4d7b2438d3 1197 */
switches 0:5c4d7b2438d3 1198 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 1199 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1) volatile, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 1200 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 1201 }
switches 0:5c4d7b2438d3 1202
switches 0:5c4d7b2438d3 1203 /** Create an event
switches 0:5c4d7b2438d3 1204 * @see Event::Event
switches 0:5c4d7b2438d3 1205 */
switches 0:5c4d7b2438d3 1206 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 1207 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1) const volatile, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 1208 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 1209 }
switches 0:5c4d7b2438d3 1210 };
switches 0:5c4d7b2438d3 1211
switches 0:5c4d7b2438d3 1212 /** Event
switches 0:5c4d7b2438d3 1213 *
switches 0:5c4d7b2438d3 1214 * Representation of an event for fine-grain dispatch control
switches 0:5c4d7b2438d3 1215 */
switches 0:5c4d7b2438d3 1216 template <typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 1217 class Event<void(A0, A1, A2)> {
switches 0:5c4d7b2438d3 1218 public:
switches 0:5c4d7b2438d3 1219 /** Create an event
switches 0:5c4d7b2438d3 1220 *
switches 0:5c4d7b2438d3 1221 * Constructs an event bound to the specified event queue. The specified
switches 0:5c4d7b2438d3 1222 * callback acts as the target for the event and is executed in the
switches 0:5c4d7b2438d3 1223 * context of the event queue's dispatch loop once posted.
switches 0:5c4d7b2438d3 1224 *
switches 0:5c4d7b2438d3 1225 * @param q Event queue to dispatch on
switches 0:5c4d7b2438d3 1226 * @param f Function to execute when the event is dispatched
switches 0:5c4d7b2438d3 1227 * @param a0..a4 Arguments to pass to the callback
switches 0:5c4d7b2438d3 1228 */
switches 0:5c4d7b2438d3 1229 template <typename F>
switches 0:5c4d7b2438d3 1230 Event(EventQueue *q, F f) {
switches 0:5c4d7b2438d3 1231 _event = static_cast<struct event *>(
switches 0:5c4d7b2438d3 1232 equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F)));
switches 0:5c4d7b2438d3 1233
switches 0:5c4d7b2438d3 1234 if (_event) {
switches 0:5c4d7b2438d3 1235 _event->equeue = &q->_equeue;
switches 0:5c4d7b2438d3 1236 _event->id = 0;
switches 0:5c4d7b2438d3 1237 _event->delay = 0;
switches 0:5c4d7b2438d3 1238 _event->period = -1;
switches 0:5c4d7b2438d3 1239
switches 0:5c4d7b2438d3 1240 _event->post = &Event::event_post<F>;
switches 0:5c4d7b2438d3 1241 _event->dtor = &Event::event_dtor<F>;
switches 0:5c4d7b2438d3 1242
switches 0:5c4d7b2438d3 1243 new (_event+1) F(f);
switches 0:5c4d7b2438d3 1244
switches 0:5c4d7b2438d3 1245 _event->ref = 1;
switches 0:5c4d7b2438d3 1246 }
switches 0:5c4d7b2438d3 1247 }
switches 0:5c4d7b2438d3 1248
switches 0:5c4d7b2438d3 1249 /** Copy constructor for events
switches 0:5c4d7b2438d3 1250 */
switches 0:5c4d7b2438d3 1251 Event(const Event &e) {
switches 0:5c4d7b2438d3 1252 _event = 0;
switches 0:5c4d7b2438d3 1253 if (e._event) {
switches 0:5c4d7b2438d3 1254 _event = e._event;
switches 0:5c4d7b2438d3 1255 _event->ref += 1;
switches 0:5c4d7b2438d3 1256 }
switches 0:5c4d7b2438d3 1257 }
switches 0:5c4d7b2438d3 1258
switches 0:5c4d7b2438d3 1259 /** Assignment operator for events
switches 0:5c4d7b2438d3 1260 */
switches 0:5c4d7b2438d3 1261 Event &operator=(const Event &that) {
switches 0:5c4d7b2438d3 1262 if (this != &that) {
switches 0:5c4d7b2438d3 1263 this->~Event();
switches 0:5c4d7b2438d3 1264 new (this) Event(that);
switches 0:5c4d7b2438d3 1265 }
switches 0:5c4d7b2438d3 1266
switches 0:5c4d7b2438d3 1267 return *this;
switches 0:5c4d7b2438d3 1268 }
switches 0:5c4d7b2438d3 1269
switches 0:5c4d7b2438d3 1270 /** Destructor for events
switches 0:5c4d7b2438d3 1271 */
switches 0:5c4d7b2438d3 1272 ~Event() {
switches 0:5c4d7b2438d3 1273 if (_event) {
switches 0:5c4d7b2438d3 1274 _event->ref -= 1;
switches 0:5c4d7b2438d3 1275 if (_event->ref == 0) {
switches 0:5c4d7b2438d3 1276 _event->dtor(_event);
switches 0:5c4d7b2438d3 1277 equeue_dealloc(_event->equeue, _event);
switches 0:5c4d7b2438d3 1278 }
switches 0:5c4d7b2438d3 1279 }
switches 0:5c4d7b2438d3 1280 }
switches 0:5c4d7b2438d3 1281
switches 0:5c4d7b2438d3 1282 /** Configure the delay of an event
switches 0:5c4d7b2438d3 1283 *
switches 0:5c4d7b2438d3 1284 * @param delay Millisecond delay before dispatching the event
switches 0:5c4d7b2438d3 1285 */
switches 0:5c4d7b2438d3 1286 void delay(int delay) {
switches 0:5c4d7b2438d3 1287 if (_event) {
switches 0:5c4d7b2438d3 1288 _event->delay = delay;
switches 0:5c4d7b2438d3 1289 }
switches 0:5c4d7b2438d3 1290 }
switches 0:5c4d7b2438d3 1291
switches 0:5c4d7b2438d3 1292 /** Configure the period of an event
switches 0:5c4d7b2438d3 1293 *
switches 0:5c4d7b2438d3 1294 * @param period Millisecond period for repeatedly dispatching an event
switches 0:5c4d7b2438d3 1295 */
switches 0:5c4d7b2438d3 1296 void period(int period) {
switches 0:5c4d7b2438d3 1297 if (_event) {
switches 0:5c4d7b2438d3 1298 _event->period = period;
switches 0:5c4d7b2438d3 1299 }
switches 0:5c4d7b2438d3 1300 }
switches 0:5c4d7b2438d3 1301
switches 0:5c4d7b2438d3 1302 /** Posts an event onto the underlying event queue
switches 0:5c4d7b2438d3 1303 *
switches 0:5c4d7b2438d3 1304 * The event is posted to the underlying queue and is executed in the
switches 0:5c4d7b2438d3 1305 * context of the event queue's dispatch loop.
switches 0:5c4d7b2438d3 1306 *
switches 0:5c4d7b2438d3 1307 * The post function is irq safe and can act as a mechanism for moving
switches 0:5c4d7b2438d3 1308 * events out of irq contexts.
switches 0:5c4d7b2438d3 1309 *
switches 0:5c4d7b2438d3 1310 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 1311 * @return A unique id that represents the posted event and can
switches 0:5c4d7b2438d3 1312 * be passed to EventQueue::cancel, or an id of 0 if
switches 0:5c4d7b2438d3 1313 * there is not enough memory to allocate the event.
switches 0:5c4d7b2438d3 1314 */
switches 0:5c4d7b2438d3 1315 int post(A0 a0, A1 a1, A2 a2) const {
switches 0:5c4d7b2438d3 1316 if (!_event) {
switches 0:5c4d7b2438d3 1317 return 0;
switches 0:5c4d7b2438d3 1318 }
switches 0:5c4d7b2438d3 1319
switches 0:5c4d7b2438d3 1320 _event->id = _event->post(_event, a0, a1, a2);
switches 0:5c4d7b2438d3 1321 return _event->id;
switches 0:5c4d7b2438d3 1322 }
switches 0:5c4d7b2438d3 1323
switches 0:5c4d7b2438d3 1324 /** Posts an event onto the underlying event queue, returning void
switches 0:5c4d7b2438d3 1325 *
switches 0:5c4d7b2438d3 1326 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 1327 */
switches 0:5c4d7b2438d3 1328 void call(A0 a0, A1 a1, A2 a2) const {
switches 0:5c4d7b2438d3 1329 MBED_UNUSED int id = post(a0, a1, a2);
switches 0:5c4d7b2438d3 1330 MBED_ASSERT(id);
switches 0:5c4d7b2438d3 1331 }
switches 0:5c4d7b2438d3 1332
switches 0:5c4d7b2438d3 1333 /** Posts an event onto the underlying event queue, returning void
switches 0:5c4d7b2438d3 1334 *
switches 0:5c4d7b2438d3 1335 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 1336 */
switches 0:5c4d7b2438d3 1337 void operator()(A0 a0, A1 a1, A2 a2) const {
switches 0:5c4d7b2438d3 1338 return call(a0, a1, a2);
switches 0:5c4d7b2438d3 1339 }
switches 0:5c4d7b2438d3 1340
switches 0:5c4d7b2438d3 1341 /** Static thunk for passing as C-style function
switches 0:5c4d7b2438d3 1342 *
switches 0:5c4d7b2438d3 1343 * @param func Event to call passed as a void pointer
switches 0:5c4d7b2438d3 1344 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 1345 */
switches 0:5c4d7b2438d3 1346 static void thunk(void *func, A0 a0, A1 a1, A2 a2) {
switches 0:5c4d7b2438d3 1347 return static_cast<Event*>(func)->call(a0, a1, a2);
switches 0:5c4d7b2438d3 1348 }
switches 0:5c4d7b2438d3 1349
switches 0:5c4d7b2438d3 1350 /** Cancels the most recently posted event
switches 0:5c4d7b2438d3 1351 *
switches 0:5c4d7b2438d3 1352 * Attempts to cancel the most recently posted event. It is safe to call
switches 0:5c4d7b2438d3 1353 * cancel after an event has already been dispatched.
switches 0:5c4d7b2438d3 1354 *
switches 0:5c4d7b2438d3 1355 * The cancel function is irq safe.
switches 0:5c4d7b2438d3 1356 *
switches 0:5c4d7b2438d3 1357 * If called while the event queue's dispatch loop is active, the cancel
switches 0:5c4d7b2438d3 1358 * function does not garuntee that the event will not execute after it
switches 0:5c4d7b2438d3 1359 * returns, as the event may have already begun executing.
switches 0:5c4d7b2438d3 1360 */
switches 0:5c4d7b2438d3 1361 void cancel() const {
switches 0:5c4d7b2438d3 1362 if (_event) {
switches 0:5c4d7b2438d3 1363 equeue_cancel(_event->equeue, _event->id);
switches 0:5c4d7b2438d3 1364 }
switches 0:5c4d7b2438d3 1365 }
switches 0:5c4d7b2438d3 1366
switches 0:5c4d7b2438d3 1367 private:
switches 0:5c4d7b2438d3 1368 struct event {
switches 0:5c4d7b2438d3 1369 unsigned ref;
switches 0:5c4d7b2438d3 1370 equeue_t *equeue;
switches 0:5c4d7b2438d3 1371 int id;
switches 0:5c4d7b2438d3 1372
switches 0:5c4d7b2438d3 1373 int delay;
switches 0:5c4d7b2438d3 1374 int period;
switches 0:5c4d7b2438d3 1375
switches 0:5c4d7b2438d3 1376 int (*post)(struct event *, A0 a0, A1 a1, A2 a2);
switches 0:5c4d7b2438d3 1377 void (*dtor)(struct event *);
switches 0:5c4d7b2438d3 1378
switches 0:5c4d7b2438d3 1379 // F follows
switches 0:5c4d7b2438d3 1380 } *_event;
switches 0:5c4d7b2438d3 1381
switches 0:5c4d7b2438d3 1382 // Event attributes
switches 0:5c4d7b2438d3 1383 template <typename F>
switches 0:5c4d7b2438d3 1384 static int event_post(struct event *e, A0 a0, A1 a1, A2 a2) {
switches 0:5c4d7b2438d3 1385 typedef EventQueue::context30<F, A0, A1, A2> C;
switches 0:5c4d7b2438d3 1386 void *p = equeue_alloc(e->equeue, sizeof(C));
switches 0:5c4d7b2438d3 1387 if (!p) {
switches 0:5c4d7b2438d3 1388 return 0;
switches 0:5c4d7b2438d3 1389 }
switches 0:5c4d7b2438d3 1390
switches 0:5c4d7b2438d3 1391 new (p) C(*(F*)(e + 1), a0, a1, a2);
switches 0:5c4d7b2438d3 1392 equeue_event_delay(p, e->delay);
switches 0:5c4d7b2438d3 1393 equeue_event_period(p, e->period);
switches 0:5c4d7b2438d3 1394 equeue_event_dtor(p, &EventQueue::function_dtor<C>);
switches 0:5c4d7b2438d3 1395 return equeue_post(e->equeue, &EventQueue::function_call<C>, p);
switches 0:5c4d7b2438d3 1396 }
switches 0:5c4d7b2438d3 1397
switches 0:5c4d7b2438d3 1398 template <typename F>
switches 0:5c4d7b2438d3 1399 static void event_dtor(struct event *e) {
switches 0:5c4d7b2438d3 1400 ((F*)(e + 1))->~F();
switches 0:5c4d7b2438d3 1401 }
switches 0:5c4d7b2438d3 1402
switches 0:5c4d7b2438d3 1403 public:
switches 0:5c4d7b2438d3 1404 /** Create an event
switches 0:5c4d7b2438d3 1405 * @see Event::Event
switches 0:5c4d7b2438d3 1406 */
switches 0:5c4d7b2438d3 1407 template <typename F, typename C0>
switches 0:5c4d7b2438d3 1408 Event(EventQueue *q, F f, C0 c0) {
switches 0:5c4d7b2438d3 1409 new (this) Event(q, EventQueue::context13<F, C0, A0, A1, A2>(f, c0));
switches 0:5c4d7b2438d3 1410 }
switches 0:5c4d7b2438d3 1411
switches 0:5c4d7b2438d3 1412 /** Create an event
switches 0:5c4d7b2438d3 1413 * @see Event::Event
switches 0:5c4d7b2438d3 1414 */
switches 0:5c4d7b2438d3 1415 template <typename F, typename C0, typename C1>
switches 0:5c4d7b2438d3 1416 Event(EventQueue *q, F f, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 1417 new (this) Event(q, EventQueue::context23<F, C0, C1, A0, A1, A2>(f, c0, c1));
switches 0:5c4d7b2438d3 1418 }
switches 0:5c4d7b2438d3 1419
switches 0:5c4d7b2438d3 1420 /** Create an event
switches 0:5c4d7b2438d3 1421 * @see Event::Event
switches 0:5c4d7b2438d3 1422 */
switches 0:5c4d7b2438d3 1423 template <typename F, typename C0, typename C1, typename C2>
switches 0:5c4d7b2438d3 1424 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 1425 new (this) Event(q, EventQueue::context33<F, C0, C1, C2, A0, A1, A2>(f, c0, c1, c2));
switches 0:5c4d7b2438d3 1426 }
switches 0:5c4d7b2438d3 1427
switches 0:5c4d7b2438d3 1428 /** Create an event
switches 0:5c4d7b2438d3 1429 * @see Event::Event
switches 0:5c4d7b2438d3 1430 */
switches 0:5c4d7b2438d3 1431 template <typename F, typename C0, typename C1, typename C2, typename C3>
switches 0:5c4d7b2438d3 1432 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 1433 new (this) Event(q, EventQueue::context43<F, C0, C1, C2, C3, A0, A1, A2>(f, c0, c1, c2, c3));
switches 0:5c4d7b2438d3 1434 }
switches 0:5c4d7b2438d3 1435
switches 0:5c4d7b2438d3 1436 /** Create an event
switches 0:5c4d7b2438d3 1437 * @see Event::Event
switches 0:5c4d7b2438d3 1438 */
switches 0:5c4d7b2438d3 1439 template <typename F, typename C0, typename C1, typename C2, typename C3, typename C4>
switches 0:5c4d7b2438d3 1440 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 1441 new (this) Event(q, EventQueue::context53<F, C0, C1, C2, C3, C4, A0, A1, A2>(f, c0, c1, c2, c3, c4));
switches 0:5c4d7b2438d3 1442 }
switches 0:5c4d7b2438d3 1443
switches 0:5c4d7b2438d3 1444 /** Create an event
switches 0:5c4d7b2438d3 1445 * @see Event::Event
switches 0:5c4d7b2438d3 1446 */
switches 0:5c4d7b2438d3 1447 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 1448 Event(EventQueue *q, T *obj, R (T::*method)(B0, A0, A1, A2), B0 b0) {
switches 0:5c4d7b2438d3 1449 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 1450 }
switches 0:5c4d7b2438d3 1451
switches 0:5c4d7b2438d3 1452 /** Create an event
switches 0:5c4d7b2438d3 1453 * @see Event::Event
switches 0:5c4d7b2438d3 1454 */
switches 0:5c4d7b2438d3 1455 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 1456 Event(EventQueue *q, const T *obj, R (T::*method)(B0, A0, A1, A2) const, B0 b0) {
switches 0:5c4d7b2438d3 1457 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 1458 }
switches 0:5c4d7b2438d3 1459
switches 0:5c4d7b2438d3 1460 /** Create an event
switches 0:5c4d7b2438d3 1461 * @see Event::Event
switches 0:5c4d7b2438d3 1462 */
switches 0:5c4d7b2438d3 1463 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 1464 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, A0, A1, A2) volatile, B0 b0) {
switches 0:5c4d7b2438d3 1465 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 1466 }
switches 0:5c4d7b2438d3 1467
switches 0:5c4d7b2438d3 1468 /** Create an event
switches 0:5c4d7b2438d3 1469 * @see Event::Event
switches 0:5c4d7b2438d3 1470 */
switches 0:5c4d7b2438d3 1471 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 1472 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, A0, A1, A2) const volatile, B0 b0) {
switches 0:5c4d7b2438d3 1473 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 1474 }
switches 0:5c4d7b2438d3 1475
switches 0:5c4d7b2438d3 1476 /** Create an event
switches 0:5c4d7b2438d3 1477 * @see Event::Event
switches 0:5c4d7b2438d3 1478 */
switches 0:5c4d7b2438d3 1479 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 1480 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, A0, A1, A2), B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 1481 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 1482 }
switches 0:5c4d7b2438d3 1483
switches 0:5c4d7b2438d3 1484 /** Create an event
switches 0:5c4d7b2438d3 1485 * @see Event::Event
switches 0:5c4d7b2438d3 1486 */
switches 0:5c4d7b2438d3 1487 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 1488 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, A0, A1, A2) const, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 1489 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 1490 }
switches 0:5c4d7b2438d3 1491
switches 0:5c4d7b2438d3 1492 /** Create an event
switches 0:5c4d7b2438d3 1493 * @see Event::Event
switches 0:5c4d7b2438d3 1494 */
switches 0:5c4d7b2438d3 1495 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 1496 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2) volatile, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 1497 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 1498 }
switches 0:5c4d7b2438d3 1499
switches 0:5c4d7b2438d3 1500 /** Create an event
switches 0:5c4d7b2438d3 1501 * @see Event::Event
switches 0:5c4d7b2438d3 1502 */
switches 0:5c4d7b2438d3 1503 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 1504 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2) const volatile, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 1505 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 1506 }
switches 0:5c4d7b2438d3 1507
switches 0:5c4d7b2438d3 1508 /** Create an event
switches 0:5c4d7b2438d3 1509 * @see Event::Event
switches 0:5c4d7b2438d3 1510 */
switches 0:5c4d7b2438d3 1511 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 1512 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2), B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 1513 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 1514 }
switches 0:5c4d7b2438d3 1515
switches 0:5c4d7b2438d3 1516 /** Create an event
switches 0:5c4d7b2438d3 1517 * @see Event::Event
switches 0:5c4d7b2438d3 1518 */
switches 0:5c4d7b2438d3 1519 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 1520 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2) const, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 1521 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 1522 }
switches 0:5c4d7b2438d3 1523
switches 0:5c4d7b2438d3 1524 /** Create an event
switches 0:5c4d7b2438d3 1525 * @see Event::Event
switches 0:5c4d7b2438d3 1526 */
switches 0:5c4d7b2438d3 1527 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 1528 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2) volatile, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 1529 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 1530 }
switches 0:5c4d7b2438d3 1531
switches 0:5c4d7b2438d3 1532 /** Create an event
switches 0:5c4d7b2438d3 1533 * @see Event::Event
switches 0:5c4d7b2438d3 1534 */
switches 0:5c4d7b2438d3 1535 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 1536 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2) const volatile, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 1537 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 1538 }
switches 0:5c4d7b2438d3 1539
switches 0:5c4d7b2438d3 1540 /** Create an event
switches 0:5c4d7b2438d3 1541 * @see Event::Event
switches 0:5c4d7b2438d3 1542 */
switches 0:5c4d7b2438d3 1543 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 1544 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2), B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 1545 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 1546 }
switches 0:5c4d7b2438d3 1547
switches 0:5c4d7b2438d3 1548 /** Create an event
switches 0:5c4d7b2438d3 1549 * @see Event::Event
switches 0:5c4d7b2438d3 1550 */
switches 0:5c4d7b2438d3 1551 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 1552 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2) const, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 1553 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 1554 }
switches 0:5c4d7b2438d3 1555
switches 0:5c4d7b2438d3 1556 /** Create an event
switches 0:5c4d7b2438d3 1557 * @see Event::Event
switches 0:5c4d7b2438d3 1558 */
switches 0:5c4d7b2438d3 1559 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 1560 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2) volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 1561 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 1562 }
switches 0:5c4d7b2438d3 1563
switches 0:5c4d7b2438d3 1564 /** Create an event
switches 0:5c4d7b2438d3 1565 * @see Event::Event
switches 0:5c4d7b2438d3 1566 */
switches 0:5c4d7b2438d3 1567 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 1568 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2) const volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 1569 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 1570 }
switches 0:5c4d7b2438d3 1571
switches 0:5c4d7b2438d3 1572 /** Create an event
switches 0:5c4d7b2438d3 1573 * @see Event::Event
switches 0:5c4d7b2438d3 1574 */
switches 0:5c4d7b2438d3 1575 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 1576 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2), B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 1577 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 1578 }
switches 0:5c4d7b2438d3 1579
switches 0:5c4d7b2438d3 1580 /** Create an event
switches 0:5c4d7b2438d3 1581 * @see Event::Event
switches 0:5c4d7b2438d3 1582 */
switches 0:5c4d7b2438d3 1583 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 1584 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2) const, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 1585 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 1586 }
switches 0:5c4d7b2438d3 1587
switches 0:5c4d7b2438d3 1588 /** Create an event
switches 0:5c4d7b2438d3 1589 * @see Event::Event
switches 0:5c4d7b2438d3 1590 */
switches 0:5c4d7b2438d3 1591 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 1592 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2) volatile, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 1593 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 1594 }
switches 0:5c4d7b2438d3 1595
switches 0:5c4d7b2438d3 1596 /** Create an event
switches 0:5c4d7b2438d3 1597 * @see Event::Event
switches 0:5c4d7b2438d3 1598 */
switches 0:5c4d7b2438d3 1599 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 1600 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2) const volatile, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 1601 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 1602 }
switches 0:5c4d7b2438d3 1603 };
switches 0:5c4d7b2438d3 1604
switches 0:5c4d7b2438d3 1605 /** Event
switches 0:5c4d7b2438d3 1606 *
switches 0:5c4d7b2438d3 1607 * Representation of an event for fine-grain dispatch control
switches 0:5c4d7b2438d3 1608 */
switches 0:5c4d7b2438d3 1609 template <typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 1610 class Event<void(A0, A1, A2, A3)> {
switches 0:5c4d7b2438d3 1611 public:
switches 0:5c4d7b2438d3 1612 /** Create an event
switches 0:5c4d7b2438d3 1613 *
switches 0:5c4d7b2438d3 1614 * Constructs an event bound to the specified event queue. The specified
switches 0:5c4d7b2438d3 1615 * callback acts as the target for the event and is executed in the
switches 0:5c4d7b2438d3 1616 * context of the event queue's dispatch loop once posted.
switches 0:5c4d7b2438d3 1617 *
switches 0:5c4d7b2438d3 1618 * @param q Event queue to dispatch on
switches 0:5c4d7b2438d3 1619 * @param f Function to execute when the event is dispatched
switches 0:5c4d7b2438d3 1620 * @param a0..a4 Arguments to pass to the callback
switches 0:5c4d7b2438d3 1621 */
switches 0:5c4d7b2438d3 1622 template <typename F>
switches 0:5c4d7b2438d3 1623 Event(EventQueue *q, F f) {
switches 0:5c4d7b2438d3 1624 _event = static_cast<struct event *>(
switches 0:5c4d7b2438d3 1625 equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F)));
switches 0:5c4d7b2438d3 1626
switches 0:5c4d7b2438d3 1627 if (_event) {
switches 0:5c4d7b2438d3 1628 _event->equeue = &q->_equeue;
switches 0:5c4d7b2438d3 1629 _event->id = 0;
switches 0:5c4d7b2438d3 1630 _event->delay = 0;
switches 0:5c4d7b2438d3 1631 _event->period = -1;
switches 0:5c4d7b2438d3 1632
switches 0:5c4d7b2438d3 1633 _event->post = &Event::event_post<F>;
switches 0:5c4d7b2438d3 1634 _event->dtor = &Event::event_dtor<F>;
switches 0:5c4d7b2438d3 1635
switches 0:5c4d7b2438d3 1636 new (_event+1) F(f);
switches 0:5c4d7b2438d3 1637
switches 0:5c4d7b2438d3 1638 _event->ref = 1;
switches 0:5c4d7b2438d3 1639 }
switches 0:5c4d7b2438d3 1640 }
switches 0:5c4d7b2438d3 1641
switches 0:5c4d7b2438d3 1642 /** Copy constructor for events
switches 0:5c4d7b2438d3 1643 */
switches 0:5c4d7b2438d3 1644 Event(const Event &e) {
switches 0:5c4d7b2438d3 1645 _event = 0;
switches 0:5c4d7b2438d3 1646 if (e._event) {
switches 0:5c4d7b2438d3 1647 _event = e._event;
switches 0:5c4d7b2438d3 1648 _event->ref += 1;
switches 0:5c4d7b2438d3 1649 }
switches 0:5c4d7b2438d3 1650 }
switches 0:5c4d7b2438d3 1651
switches 0:5c4d7b2438d3 1652 /** Assignment operator for events
switches 0:5c4d7b2438d3 1653 */
switches 0:5c4d7b2438d3 1654 Event &operator=(const Event &that) {
switches 0:5c4d7b2438d3 1655 if (this != &that) {
switches 0:5c4d7b2438d3 1656 this->~Event();
switches 0:5c4d7b2438d3 1657 new (this) Event(that);
switches 0:5c4d7b2438d3 1658 }
switches 0:5c4d7b2438d3 1659
switches 0:5c4d7b2438d3 1660 return *this;
switches 0:5c4d7b2438d3 1661 }
switches 0:5c4d7b2438d3 1662
switches 0:5c4d7b2438d3 1663 /** Destructor for events
switches 0:5c4d7b2438d3 1664 */
switches 0:5c4d7b2438d3 1665 ~Event() {
switches 0:5c4d7b2438d3 1666 if (_event) {
switches 0:5c4d7b2438d3 1667 _event->ref -= 1;
switches 0:5c4d7b2438d3 1668 if (_event->ref == 0) {
switches 0:5c4d7b2438d3 1669 _event->dtor(_event);
switches 0:5c4d7b2438d3 1670 equeue_dealloc(_event->equeue, _event);
switches 0:5c4d7b2438d3 1671 }
switches 0:5c4d7b2438d3 1672 }
switches 0:5c4d7b2438d3 1673 }
switches 0:5c4d7b2438d3 1674
switches 0:5c4d7b2438d3 1675 /** Configure the delay of an event
switches 0:5c4d7b2438d3 1676 *
switches 0:5c4d7b2438d3 1677 * @param delay Millisecond delay before dispatching the event
switches 0:5c4d7b2438d3 1678 */
switches 0:5c4d7b2438d3 1679 void delay(int delay) {
switches 0:5c4d7b2438d3 1680 if (_event) {
switches 0:5c4d7b2438d3 1681 _event->delay = delay;
switches 0:5c4d7b2438d3 1682 }
switches 0:5c4d7b2438d3 1683 }
switches 0:5c4d7b2438d3 1684
switches 0:5c4d7b2438d3 1685 /** Configure the period of an event
switches 0:5c4d7b2438d3 1686 *
switches 0:5c4d7b2438d3 1687 * @param period Millisecond period for repeatedly dispatching an event
switches 0:5c4d7b2438d3 1688 */
switches 0:5c4d7b2438d3 1689 void period(int period) {
switches 0:5c4d7b2438d3 1690 if (_event) {
switches 0:5c4d7b2438d3 1691 _event->period = period;
switches 0:5c4d7b2438d3 1692 }
switches 0:5c4d7b2438d3 1693 }
switches 0:5c4d7b2438d3 1694
switches 0:5c4d7b2438d3 1695 /** Posts an event onto the underlying event queue
switches 0:5c4d7b2438d3 1696 *
switches 0:5c4d7b2438d3 1697 * The event is posted to the underlying queue and is executed in the
switches 0:5c4d7b2438d3 1698 * context of the event queue's dispatch loop.
switches 0:5c4d7b2438d3 1699 *
switches 0:5c4d7b2438d3 1700 * The post function is irq safe and can act as a mechanism for moving
switches 0:5c4d7b2438d3 1701 * events out of irq contexts.
switches 0:5c4d7b2438d3 1702 *
switches 0:5c4d7b2438d3 1703 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 1704 * @return A unique id that represents the posted event and can
switches 0:5c4d7b2438d3 1705 * be passed to EventQueue::cancel, or an id of 0 if
switches 0:5c4d7b2438d3 1706 * there is not enough memory to allocate the event.
switches 0:5c4d7b2438d3 1707 */
switches 0:5c4d7b2438d3 1708 int post(A0 a0, A1 a1, A2 a2, A3 a3) const {
switches 0:5c4d7b2438d3 1709 if (!_event) {
switches 0:5c4d7b2438d3 1710 return 0;
switches 0:5c4d7b2438d3 1711 }
switches 0:5c4d7b2438d3 1712
switches 0:5c4d7b2438d3 1713 _event->id = _event->post(_event, a0, a1, a2, a3);
switches 0:5c4d7b2438d3 1714 return _event->id;
switches 0:5c4d7b2438d3 1715 }
switches 0:5c4d7b2438d3 1716
switches 0:5c4d7b2438d3 1717 /** Posts an event onto the underlying event queue, returning void
switches 0:5c4d7b2438d3 1718 *
switches 0:5c4d7b2438d3 1719 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 1720 */
switches 0:5c4d7b2438d3 1721 void call(A0 a0, A1 a1, A2 a2, A3 a3) const {
switches 0:5c4d7b2438d3 1722 MBED_UNUSED int id = post(a0, a1, a2, a3);
switches 0:5c4d7b2438d3 1723 MBED_ASSERT(id);
switches 0:5c4d7b2438d3 1724 }
switches 0:5c4d7b2438d3 1725
switches 0:5c4d7b2438d3 1726 /** Posts an event onto the underlying event queue, returning void
switches 0:5c4d7b2438d3 1727 *
switches 0:5c4d7b2438d3 1728 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 1729 */
switches 0:5c4d7b2438d3 1730 void operator()(A0 a0, A1 a1, A2 a2, A3 a3) const {
switches 0:5c4d7b2438d3 1731 return call(a0, a1, a2, a3);
switches 0:5c4d7b2438d3 1732 }
switches 0:5c4d7b2438d3 1733
switches 0:5c4d7b2438d3 1734 /** Static thunk for passing as C-style function
switches 0:5c4d7b2438d3 1735 *
switches 0:5c4d7b2438d3 1736 * @param func Event to call passed as a void pointer
switches 0:5c4d7b2438d3 1737 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 1738 */
switches 0:5c4d7b2438d3 1739 static void thunk(void *func, A0 a0, A1 a1, A2 a2, A3 a3) {
switches 0:5c4d7b2438d3 1740 return static_cast<Event*>(func)->call(a0, a1, a2, a3);
switches 0:5c4d7b2438d3 1741 }
switches 0:5c4d7b2438d3 1742
switches 0:5c4d7b2438d3 1743 /** Cancels the most recently posted event
switches 0:5c4d7b2438d3 1744 *
switches 0:5c4d7b2438d3 1745 * Attempts to cancel the most recently posted event. It is safe to call
switches 0:5c4d7b2438d3 1746 * cancel after an event has already been dispatched.
switches 0:5c4d7b2438d3 1747 *
switches 0:5c4d7b2438d3 1748 * The cancel function is irq safe.
switches 0:5c4d7b2438d3 1749 *
switches 0:5c4d7b2438d3 1750 * If called while the event queue's dispatch loop is active, the cancel
switches 0:5c4d7b2438d3 1751 * function does not garuntee that the event will not execute after it
switches 0:5c4d7b2438d3 1752 * returns, as the event may have already begun executing.
switches 0:5c4d7b2438d3 1753 */
switches 0:5c4d7b2438d3 1754 void cancel() const {
switches 0:5c4d7b2438d3 1755 if (_event) {
switches 0:5c4d7b2438d3 1756 equeue_cancel(_event->equeue, _event->id);
switches 0:5c4d7b2438d3 1757 }
switches 0:5c4d7b2438d3 1758 }
switches 0:5c4d7b2438d3 1759
switches 0:5c4d7b2438d3 1760 private:
switches 0:5c4d7b2438d3 1761 struct event {
switches 0:5c4d7b2438d3 1762 unsigned ref;
switches 0:5c4d7b2438d3 1763 equeue_t *equeue;
switches 0:5c4d7b2438d3 1764 int id;
switches 0:5c4d7b2438d3 1765
switches 0:5c4d7b2438d3 1766 int delay;
switches 0:5c4d7b2438d3 1767 int period;
switches 0:5c4d7b2438d3 1768
switches 0:5c4d7b2438d3 1769 int (*post)(struct event *, A0 a0, A1 a1, A2 a2, A3 a3);
switches 0:5c4d7b2438d3 1770 void (*dtor)(struct event *);
switches 0:5c4d7b2438d3 1771
switches 0:5c4d7b2438d3 1772 // F follows
switches 0:5c4d7b2438d3 1773 } *_event;
switches 0:5c4d7b2438d3 1774
switches 0:5c4d7b2438d3 1775 // Event attributes
switches 0:5c4d7b2438d3 1776 template <typename F>
switches 0:5c4d7b2438d3 1777 static int event_post(struct event *e, A0 a0, A1 a1, A2 a2, A3 a3) {
switches 0:5c4d7b2438d3 1778 typedef EventQueue::context40<F, A0, A1, A2, A3> C;
switches 0:5c4d7b2438d3 1779 void *p = equeue_alloc(e->equeue, sizeof(C));
switches 0:5c4d7b2438d3 1780 if (!p) {
switches 0:5c4d7b2438d3 1781 return 0;
switches 0:5c4d7b2438d3 1782 }
switches 0:5c4d7b2438d3 1783
switches 0:5c4d7b2438d3 1784 new (p) C(*(F*)(e + 1), a0, a1, a2, a3);
switches 0:5c4d7b2438d3 1785 equeue_event_delay(p, e->delay);
switches 0:5c4d7b2438d3 1786 equeue_event_period(p, e->period);
switches 0:5c4d7b2438d3 1787 equeue_event_dtor(p, &EventQueue::function_dtor<C>);
switches 0:5c4d7b2438d3 1788 return equeue_post(e->equeue, &EventQueue::function_call<C>, p);
switches 0:5c4d7b2438d3 1789 }
switches 0:5c4d7b2438d3 1790
switches 0:5c4d7b2438d3 1791 template <typename F>
switches 0:5c4d7b2438d3 1792 static void event_dtor(struct event *e) {
switches 0:5c4d7b2438d3 1793 ((F*)(e + 1))->~F();
switches 0:5c4d7b2438d3 1794 }
switches 0:5c4d7b2438d3 1795
switches 0:5c4d7b2438d3 1796 public:
switches 0:5c4d7b2438d3 1797 /** Create an event
switches 0:5c4d7b2438d3 1798 * @see Event::Event
switches 0:5c4d7b2438d3 1799 */
switches 0:5c4d7b2438d3 1800 template <typename F, typename C0>
switches 0:5c4d7b2438d3 1801 Event(EventQueue *q, F f, C0 c0) {
switches 0:5c4d7b2438d3 1802 new (this) Event(q, EventQueue::context14<F, C0, A0, A1, A2, A3>(f, c0));
switches 0:5c4d7b2438d3 1803 }
switches 0:5c4d7b2438d3 1804
switches 0:5c4d7b2438d3 1805 /** Create an event
switches 0:5c4d7b2438d3 1806 * @see Event::Event
switches 0:5c4d7b2438d3 1807 */
switches 0:5c4d7b2438d3 1808 template <typename F, typename C0, typename C1>
switches 0:5c4d7b2438d3 1809 Event(EventQueue *q, F f, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 1810 new (this) Event(q, EventQueue::context24<F, C0, C1, A0, A1, A2, A3>(f, c0, c1));
switches 0:5c4d7b2438d3 1811 }
switches 0:5c4d7b2438d3 1812
switches 0:5c4d7b2438d3 1813 /** Create an event
switches 0:5c4d7b2438d3 1814 * @see Event::Event
switches 0:5c4d7b2438d3 1815 */
switches 0:5c4d7b2438d3 1816 template <typename F, typename C0, typename C1, typename C2>
switches 0:5c4d7b2438d3 1817 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 1818 new (this) Event(q, EventQueue::context34<F, C0, C1, C2, A0, A1, A2, A3>(f, c0, c1, c2));
switches 0:5c4d7b2438d3 1819 }
switches 0:5c4d7b2438d3 1820
switches 0:5c4d7b2438d3 1821 /** Create an event
switches 0:5c4d7b2438d3 1822 * @see Event::Event
switches 0:5c4d7b2438d3 1823 */
switches 0:5c4d7b2438d3 1824 template <typename F, typename C0, typename C1, typename C2, typename C3>
switches 0:5c4d7b2438d3 1825 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 1826 new (this) Event(q, EventQueue::context44<F, C0, C1, C2, C3, A0, A1, A2, A3>(f, c0, c1, c2, c3));
switches 0:5c4d7b2438d3 1827 }
switches 0:5c4d7b2438d3 1828
switches 0:5c4d7b2438d3 1829 /** Create an event
switches 0:5c4d7b2438d3 1830 * @see Event::Event
switches 0:5c4d7b2438d3 1831 */
switches 0:5c4d7b2438d3 1832 template <typename F, typename C0, typename C1, typename C2, typename C3, typename C4>
switches 0:5c4d7b2438d3 1833 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 1834 new (this) Event(q, EventQueue::context54<F, C0, C1, C2, C3, C4, A0, A1, A2, A3>(f, c0, c1, c2, c3, c4));
switches 0:5c4d7b2438d3 1835 }
switches 0:5c4d7b2438d3 1836
switches 0:5c4d7b2438d3 1837 /** Create an event
switches 0:5c4d7b2438d3 1838 * @see Event::Event
switches 0:5c4d7b2438d3 1839 */
switches 0:5c4d7b2438d3 1840 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 1841 Event(EventQueue *q, T *obj, R (T::*method)(B0, A0, A1, A2, A3), B0 b0) {
switches 0:5c4d7b2438d3 1842 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 1843 }
switches 0:5c4d7b2438d3 1844
switches 0:5c4d7b2438d3 1845 /** Create an event
switches 0:5c4d7b2438d3 1846 * @see Event::Event
switches 0:5c4d7b2438d3 1847 */
switches 0:5c4d7b2438d3 1848 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 1849 Event(EventQueue *q, const T *obj, R (T::*method)(B0, A0, A1, A2, A3) const, B0 b0) {
switches 0:5c4d7b2438d3 1850 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 1851 }
switches 0:5c4d7b2438d3 1852
switches 0:5c4d7b2438d3 1853 /** Create an event
switches 0:5c4d7b2438d3 1854 * @see Event::Event
switches 0:5c4d7b2438d3 1855 */
switches 0:5c4d7b2438d3 1856 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 1857 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3) volatile, B0 b0) {
switches 0:5c4d7b2438d3 1858 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 1859 }
switches 0:5c4d7b2438d3 1860
switches 0:5c4d7b2438d3 1861 /** Create an event
switches 0:5c4d7b2438d3 1862 * @see Event::Event
switches 0:5c4d7b2438d3 1863 */
switches 0:5c4d7b2438d3 1864 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 1865 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3) const volatile, B0 b0) {
switches 0:5c4d7b2438d3 1866 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 1867 }
switches 0:5c4d7b2438d3 1868
switches 0:5c4d7b2438d3 1869 /** Create an event
switches 0:5c4d7b2438d3 1870 * @see Event::Event
switches 0:5c4d7b2438d3 1871 */
switches 0:5c4d7b2438d3 1872 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 1873 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3), B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 1874 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 1875 }
switches 0:5c4d7b2438d3 1876
switches 0:5c4d7b2438d3 1877 /** Create an event
switches 0:5c4d7b2438d3 1878 * @see Event::Event
switches 0:5c4d7b2438d3 1879 */
switches 0:5c4d7b2438d3 1880 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 1881 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3) const, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 1882 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 1883 }
switches 0:5c4d7b2438d3 1884
switches 0:5c4d7b2438d3 1885 /** Create an event
switches 0:5c4d7b2438d3 1886 * @see Event::Event
switches 0:5c4d7b2438d3 1887 */
switches 0:5c4d7b2438d3 1888 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 1889 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3) volatile, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 1890 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 1891 }
switches 0:5c4d7b2438d3 1892
switches 0:5c4d7b2438d3 1893 /** Create an event
switches 0:5c4d7b2438d3 1894 * @see Event::Event
switches 0:5c4d7b2438d3 1895 */
switches 0:5c4d7b2438d3 1896 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 1897 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3) const volatile, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 1898 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 1899 }
switches 0:5c4d7b2438d3 1900
switches 0:5c4d7b2438d3 1901 /** Create an event
switches 0:5c4d7b2438d3 1902 * @see Event::Event
switches 0:5c4d7b2438d3 1903 */
switches 0:5c4d7b2438d3 1904 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 1905 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3), B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 1906 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 1907 }
switches 0:5c4d7b2438d3 1908
switches 0:5c4d7b2438d3 1909 /** Create an event
switches 0:5c4d7b2438d3 1910 * @see Event::Event
switches 0:5c4d7b2438d3 1911 */
switches 0:5c4d7b2438d3 1912 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 1913 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3) const, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 1914 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 1915 }
switches 0:5c4d7b2438d3 1916
switches 0:5c4d7b2438d3 1917 /** Create an event
switches 0:5c4d7b2438d3 1918 * @see Event::Event
switches 0:5c4d7b2438d3 1919 */
switches 0:5c4d7b2438d3 1920 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 1921 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3) volatile, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 1922 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 1923 }
switches 0:5c4d7b2438d3 1924
switches 0:5c4d7b2438d3 1925 /** Create an event
switches 0:5c4d7b2438d3 1926 * @see Event::Event
switches 0:5c4d7b2438d3 1927 */
switches 0:5c4d7b2438d3 1928 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 1929 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3) const volatile, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 1930 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 1931 }
switches 0:5c4d7b2438d3 1932
switches 0:5c4d7b2438d3 1933 /** Create an event
switches 0:5c4d7b2438d3 1934 * @see Event::Event
switches 0:5c4d7b2438d3 1935 */
switches 0:5c4d7b2438d3 1936 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 1937 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3), B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 1938 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 1939 }
switches 0:5c4d7b2438d3 1940
switches 0:5c4d7b2438d3 1941 /** Create an event
switches 0:5c4d7b2438d3 1942 * @see Event::Event
switches 0:5c4d7b2438d3 1943 */
switches 0:5c4d7b2438d3 1944 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 1945 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3) const, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 1946 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 1947 }
switches 0:5c4d7b2438d3 1948
switches 0:5c4d7b2438d3 1949 /** Create an event
switches 0:5c4d7b2438d3 1950 * @see Event::Event
switches 0:5c4d7b2438d3 1951 */
switches 0:5c4d7b2438d3 1952 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 1953 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3) volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 1954 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 1955 }
switches 0:5c4d7b2438d3 1956
switches 0:5c4d7b2438d3 1957 /** Create an event
switches 0:5c4d7b2438d3 1958 * @see Event::Event
switches 0:5c4d7b2438d3 1959 */
switches 0:5c4d7b2438d3 1960 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 1961 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3) const volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 1962 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 1963 }
switches 0:5c4d7b2438d3 1964
switches 0:5c4d7b2438d3 1965 /** Create an event
switches 0:5c4d7b2438d3 1966 * @see Event::Event
switches 0:5c4d7b2438d3 1967 */
switches 0:5c4d7b2438d3 1968 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 1969 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3), B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 1970 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 1971 }
switches 0:5c4d7b2438d3 1972
switches 0:5c4d7b2438d3 1973 /** Create an event
switches 0:5c4d7b2438d3 1974 * @see Event::Event
switches 0:5c4d7b2438d3 1975 */
switches 0:5c4d7b2438d3 1976 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 1977 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3) const, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 1978 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 1979 }
switches 0:5c4d7b2438d3 1980
switches 0:5c4d7b2438d3 1981 /** Create an event
switches 0:5c4d7b2438d3 1982 * @see Event::Event
switches 0:5c4d7b2438d3 1983 */
switches 0:5c4d7b2438d3 1984 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 1985 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3) volatile, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 1986 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 1987 }
switches 0:5c4d7b2438d3 1988
switches 0:5c4d7b2438d3 1989 /** Create an event
switches 0:5c4d7b2438d3 1990 * @see Event::Event
switches 0:5c4d7b2438d3 1991 */
switches 0:5c4d7b2438d3 1992 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 1993 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3) const volatile, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 1994 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 1995 }
switches 0:5c4d7b2438d3 1996 };
switches 0:5c4d7b2438d3 1997
switches 0:5c4d7b2438d3 1998 /** Event
switches 0:5c4d7b2438d3 1999 *
switches 0:5c4d7b2438d3 2000 * Representation of an event for fine-grain dispatch control
switches 0:5c4d7b2438d3 2001 */
switches 0:5c4d7b2438d3 2002 template <typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 2003 class Event<void(A0, A1, A2, A3, A4)> {
switches 0:5c4d7b2438d3 2004 public:
switches 0:5c4d7b2438d3 2005 /** Create an event
switches 0:5c4d7b2438d3 2006 *
switches 0:5c4d7b2438d3 2007 * Constructs an event bound to the specified event queue. The specified
switches 0:5c4d7b2438d3 2008 * callback acts as the target for the event and is executed in the
switches 0:5c4d7b2438d3 2009 * context of the event queue's dispatch loop once posted.
switches 0:5c4d7b2438d3 2010 *
switches 0:5c4d7b2438d3 2011 * @param q Event queue to dispatch on
switches 0:5c4d7b2438d3 2012 * @param f Function to execute when the event is dispatched
switches 0:5c4d7b2438d3 2013 * @param a0..a4 Arguments to pass to the callback
switches 0:5c4d7b2438d3 2014 */
switches 0:5c4d7b2438d3 2015 template <typename F>
switches 0:5c4d7b2438d3 2016 Event(EventQueue *q, F f) {
switches 0:5c4d7b2438d3 2017 _event = static_cast<struct event *>(
switches 0:5c4d7b2438d3 2018 equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F)));
switches 0:5c4d7b2438d3 2019
switches 0:5c4d7b2438d3 2020 if (_event) {
switches 0:5c4d7b2438d3 2021 _event->equeue = &q->_equeue;
switches 0:5c4d7b2438d3 2022 _event->id = 0;
switches 0:5c4d7b2438d3 2023 _event->delay = 0;
switches 0:5c4d7b2438d3 2024 _event->period = -1;
switches 0:5c4d7b2438d3 2025
switches 0:5c4d7b2438d3 2026 _event->post = &Event::event_post<F>;
switches 0:5c4d7b2438d3 2027 _event->dtor = &Event::event_dtor<F>;
switches 0:5c4d7b2438d3 2028
switches 0:5c4d7b2438d3 2029 new (_event+1) F(f);
switches 0:5c4d7b2438d3 2030
switches 0:5c4d7b2438d3 2031 _event->ref = 1;
switches 0:5c4d7b2438d3 2032 }
switches 0:5c4d7b2438d3 2033 }
switches 0:5c4d7b2438d3 2034
switches 0:5c4d7b2438d3 2035 /** Copy constructor for events
switches 0:5c4d7b2438d3 2036 */
switches 0:5c4d7b2438d3 2037 Event(const Event &e) {
switches 0:5c4d7b2438d3 2038 _event = 0;
switches 0:5c4d7b2438d3 2039 if (e._event) {
switches 0:5c4d7b2438d3 2040 _event = e._event;
switches 0:5c4d7b2438d3 2041 _event->ref += 1;
switches 0:5c4d7b2438d3 2042 }
switches 0:5c4d7b2438d3 2043 }
switches 0:5c4d7b2438d3 2044
switches 0:5c4d7b2438d3 2045 /** Assignment operator for events
switches 0:5c4d7b2438d3 2046 */
switches 0:5c4d7b2438d3 2047 Event &operator=(const Event &that) {
switches 0:5c4d7b2438d3 2048 if (this != &that) {
switches 0:5c4d7b2438d3 2049 this->~Event();
switches 0:5c4d7b2438d3 2050 new (this) Event(that);
switches 0:5c4d7b2438d3 2051 }
switches 0:5c4d7b2438d3 2052
switches 0:5c4d7b2438d3 2053 return *this;
switches 0:5c4d7b2438d3 2054 }
switches 0:5c4d7b2438d3 2055
switches 0:5c4d7b2438d3 2056 /** Destructor for events
switches 0:5c4d7b2438d3 2057 */
switches 0:5c4d7b2438d3 2058 ~Event() {
switches 0:5c4d7b2438d3 2059 if (_event) {
switches 0:5c4d7b2438d3 2060 _event->ref -= 1;
switches 0:5c4d7b2438d3 2061 if (_event->ref == 0) {
switches 0:5c4d7b2438d3 2062 _event->dtor(_event);
switches 0:5c4d7b2438d3 2063 equeue_dealloc(_event->equeue, _event);
switches 0:5c4d7b2438d3 2064 }
switches 0:5c4d7b2438d3 2065 }
switches 0:5c4d7b2438d3 2066 }
switches 0:5c4d7b2438d3 2067
switches 0:5c4d7b2438d3 2068 /** Configure the delay of an event
switches 0:5c4d7b2438d3 2069 *
switches 0:5c4d7b2438d3 2070 * @param delay Millisecond delay before dispatching the event
switches 0:5c4d7b2438d3 2071 */
switches 0:5c4d7b2438d3 2072 void delay(int delay) {
switches 0:5c4d7b2438d3 2073 if (_event) {
switches 0:5c4d7b2438d3 2074 _event->delay = delay;
switches 0:5c4d7b2438d3 2075 }
switches 0:5c4d7b2438d3 2076 }
switches 0:5c4d7b2438d3 2077
switches 0:5c4d7b2438d3 2078 /** Configure the period of an event
switches 0:5c4d7b2438d3 2079 *
switches 0:5c4d7b2438d3 2080 * @param period Millisecond period for repeatedly dispatching an event
switches 0:5c4d7b2438d3 2081 */
switches 0:5c4d7b2438d3 2082 void period(int period) {
switches 0:5c4d7b2438d3 2083 if (_event) {
switches 0:5c4d7b2438d3 2084 _event->period = period;
switches 0:5c4d7b2438d3 2085 }
switches 0:5c4d7b2438d3 2086 }
switches 0:5c4d7b2438d3 2087
switches 0:5c4d7b2438d3 2088 /** Posts an event onto the underlying event queue
switches 0:5c4d7b2438d3 2089 *
switches 0:5c4d7b2438d3 2090 * The event is posted to the underlying queue and is executed in the
switches 0:5c4d7b2438d3 2091 * context of the event queue's dispatch loop.
switches 0:5c4d7b2438d3 2092 *
switches 0:5c4d7b2438d3 2093 * The post function is irq safe and can act as a mechanism for moving
switches 0:5c4d7b2438d3 2094 * events out of irq contexts.
switches 0:5c4d7b2438d3 2095 *
switches 0:5c4d7b2438d3 2096 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 2097 * @return A unique id that represents the posted event and can
switches 0:5c4d7b2438d3 2098 * be passed to EventQueue::cancel, or an id of 0 if
switches 0:5c4d7b2438d3 2099 * there is not enough memory to allocate the event.
switches 0:5c4d7b2438d3 2100 */
switches 0:5c4d7b2438d3 2101 int post(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) const {
switches 0:5c4d7b2438d3 2102 if (!_event) {
switches 0:5c4d7b2438d3 2103 return 0;
switches 0:5c4d7b2438d3 2104 }
switches 0:5c4d7b2438d3 2105
switches 0:5c4d7b2438d3 2106 _event->id = _event->post(_event, a0, a1, a2, a3, a4);
switches 0:5c4d7b2438d3 2107 return _event->id;
switches 0:5c4d7b2438d3 2108 }
switches 0:5c4d7b2438d3 2109
switches 0:5c4d7b2438d3 2110 /** Posts an event onto the underlying event queue, returning void
switches 0:5c4d7b2438d3 2111 *
switches 0:5c4d7b2438d3 2112 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 2113 */
switches 0:5c4d7b2438d3 2114 void call(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) const {
switches 0:5c4d7b2438d3 2115 MBED_UNUSED int id = post(a0, a1, a2, a3, a4);
switches 0:5c4d7b2438d3 2116 MBED_ASSERT(id);
switches 0:5c4d7b2438d3 2117 }
switches 0:5c4d7b2438d3 2118
switches 0:5c4d7b2438d3 2119 /** Posts an event onto the underlying event queue, returning void
switches 0:5c4d7b2438d3 2120 *
switches 0:5c4d7b2438d3 2121 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 2122 */
switches 0:5c4d7b2438d3 2123 void operator()(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) const {
switches 0:5c4d7b2438d3 2124 return call(a0, a1, a2, a3, a4);
switches 0:5c4d7b2438d3 2125 }
switches 0:5c4d7b2438d3 2126
switches 0:5c4d7b2438d3 2127 /** Static thunk for passing as C-style function
switches 0:5c4d7b2438d3 2128 *
switches 0:5c4d7b2438d3 2129 * @param func Event to call passed as a void pointer
switches 0:5c4d7b2438d3 2130 * @param a0..a4 Arguments to pass to the event
switches 0:5c4d7b2438d3 2131 */
switches 0:5c4d7b2438d3 2132 static void thunk(void *func, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
switches 0:5c4d7b2438d3 2133 return static_cast<Event*>(func)->call(a0, a1, a2, a3, a4);
switches 0:5c4d7b2438d3 2134 }
switches 0:5c4d7b2438d3 2135
switches 0:5c4d7b2438d3 2136 /** Cancels the most recently posted event
switches 0:5c4d7b2438d3 2137 *
switches 0:5c4d7b2438d3 2138 * Attempts to cancel the most recently posted event. It is safe to call
switches 0:5c4d7b2438d3 2139 * cancel after an event has already been dispatched.
switches 0:5c4d7b2438d3 2140 *
switches 0:5c4d7b2438d3 2141 * The cancel function is irq safe.
switches 0:5c4d7b2438d3 2142 *
switches 0:5c4d7b2438d3 2143 * If called while the event queue's dispatch loop is active, the cancel
switches 0:5c4d7b2438d3 2144 * function does not garuntee that the event will not execute after it
switches 0:5c4d7b2438d3 2145 * returns, as the event may have already begun executing.
switches 0:5c4d7b2438d3 2146 */
switches 0:5c4d7b2438d3 2147 void cancel() const {
switches 0:5c4d7b2438d3 2148 if (_event) {
switches 0:5c4d7b2438d3 2149 equeue_cancel(_event->equeue, _event->id);
switches 0:5c4d7b2438d3 2150 }
switches 0:5c4d7b2438d3 2151 }
switches 0:5c4d7b2438d3 2152
switches 0:5c4d7b2438d3 2153 private:
switches 0:5c4d7b2438d3 2154 struct event {
switches 0:5c4d7b2438d3 2155 unsigned ref;
switches 0:5c4d7b2438d3 2156 equeue_t *equeue;
switches 0:5c4d7b2438d3 2157 int id;
switches 0:5c4d7b2438d3 2158
switches 0:5c4d7b2438d3 2159 int delay;
switches 0:5c4d7b2438d3 2160 int period;
switches 0:5c4d7b2438d3 2161
switches 0:5c4d7b2438d3 2162 int (*post)(struct event *, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4);
switches 0:5c4d7b2438d3 2163 void (*dtor)(struct event *);
switches 0:5c4d7b2438d3 2164
switches 0:5c4d7b2438d3 2165 // F follows
switches 0:5c4d7b2438d3 2166 } *_event;
switches 0:5c4d7b2438d3 2167
switches 0:5c4d7b2438d3 2168 // Event attributes
switches 0:5c4d7b2438d3 2169 template <typename F>
switches 0:5c4d7b2438d3 2170 static int event_post(struct event *e, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
switches 0:5c4d7b2438d3 2171 typedef EventQueue::context50<F, A0, A1, A2, A3, A4> C;
switches 0:5c4d7b2438d3 2172 void *p = equeue_alloc(e->equeue, sizeof(C));
switches 0:5c4d7b2438d3 2173 if (!p) {
switches 0:5c4d7b2438d3 2174 return 0;
switches 0:5c4d7b2438d3 2175 }
switches 0:5c4d7b2438d3 2176
switches 0:5c4d7b2438d3 2177 new (p) C(*(F*)(e + 1), a0, a1, a2, a3, a4);
switches 0:5c4d7b2438d3 2178 equeue_event_delay(p, e->delay);
switches 0:5c4d7b2438d3 2179 equeue_event_period(p, e->period);
switches 0:5c4d7b2438d3 2180 equeue_event_dtor(p, &EventQueue::function_dtor<C>);
switches 0:5c4d7b2438d3 2181 return equeue_post(e->equeue, &EventQueue::function_call<C>, p);
switches 0:5c4d7b2438d3 2182 }
switches 0:5c4d7b2438d3 2183
switches 0:5c4d7b2438d3 2184 template <typename F>
switches 0:5c4d7b2438d3 2185 static void event_dtor(struct event *e) {
switches 0:5c4d7b2438d3 2186 ((F*)(e + 1))->~F();
switches 0:5c4d7b2438d3 2187 }
switches 0:5c4d7b2438d3 2188
switches 0:5c4d7b2438d3 2189 public:
switches 0:5c4d7b2438d3 2190 /** Create an event
switches 0:5c4d7b2438d3 2191 * @see Event::Event
switches 0:5c4d7b2438d3 2192 */
switches 0:5c4d7b2438d3 2193 template <typename F, typename C0>
switches 0:5c4d7b2438d3 2194 Event(EventQueue *q, F f, C0 c0) {
switches 0:5c4d7b2438d3 2195 new (this) Event(q, EventQueue::context15<F, C0, A0, A1, A2, A3, A4>(f, c0));
switches 0:5c4d7b2438d3 2196 }
switches 0:5c4d7b2438d3 2197
switches 0:5c4d7b2438d3 2198 /** Create an event
switches 0:5c4d7b2438d3 2199 * @see Event::Event
switches 0:5c4d7b2438d3 2200 */
switches 0:5c4d7b2438d3 2201 template <typename F, typename C0, typename C1>
switches 0:5c4d7b2438d3 2202 Event(EventQueue *q, F f, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2203 new (this) Event(q, EventQueue::context25<F, C0, C1, A0, A1, A2, A3, A4>(f, c0, c1));
switches 0:5c4d7b2438d3 2204 }
switches 0:5c4d7b2438d3 2205
switches 0:5c4d7b2438d3 2206 /** Create an event
switches 0:5c4d7b2438d3 2207 * @see Event::Event
switches 0:5c4d7b2438d3 2208 */
switches 0:5c4d7b2438d3 2209 template <typename F, typename C0, typename C1, typename C2>
switches 0:5c4d7b2438d3 2210 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2211 new (this) Event(q, EventQueue::context35<F, C0, C1, C2, A0, A1, A2, A3, A4>(f, c0, c1, c2));
switches 0:5c4d7b2438d3 2212 }
switches 0:5c4d7b2438d3 2213
switches 0:5c4d7b2438d3 2214 /** Create an event
switches 0:5c4d7b2438d3 2215 * @see Event::Event
switches 0:5c4d7b2438d3 2216 */
switches 0:5c4d7b2438d3 2217 template <typename F, typename C0, typename C1, typename C2, typename C3>
switches 0:5c4d7b2438d3 2218 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2219 new (this) Event(q, EventQueue::context45<F, C0, C1, C2, C3, A0, A1, A2, A3, A4>(f, c0, c1, c2, c3));
switches 0:5c4d7b2438d3 2220 }
switches 0:5c4d7b2438d3 2221
switches 0:5c4d7b2438d3 2222 /** Create an event
switches 0:5c4d7b2438d3 2223 * @see Event::Event
switches 0:5c4d7b2438d3 2224 */
switches 0:5c4d7b2438d3 2225 template <typename F, typename C0, typename C1, typename C2, typename C3, typename C4>
switches 0:5c4d7b2438d3 2226 Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2227 new (this) Event(q, EventQueue::context55<F, C0, C1, C2, C3, C4, A0, A1, A2, A3, A4>(f, c0, c1, c2, c3, c4));
switches 0:5c4d7b2438d3 2228 }
switches 0:5c4d7b2438d3 2229
switches 0:5c4d7b2438d3 2230 /** Create an event
switches 0:5c4d7b2438d3 2231 * @see Event::Event
switches 0:5c4d7b2438d3 2232 */
switches 0:5c4d7b2438d3 2233 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 2234 Event(EventQueue *q, T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4), B0 b0) {
switches 0:5c4d7b2438d3 2235 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 2236 }
switches 0:5c4d7b2438d3 2237
switches 0:5c4d7b2438d3 2238 /** Create an event
switches 0:5c4d7b2438d3 2239 * @see Event::Event
switches 0:5c4d7b2438d3 2240 */
switches 0:5c4d7b2438d3 2241 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 2242 Event(EventQueue *q, const T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4) const, B0 b0) {
switches 0:5c4d7b2438d3 2243 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 2244 }
switches 0:5c4d7b2438d3 2245
switches 0:5c4d7b2438d3 2246 /** Create an event
switches 0:5c4d7b2438d3 2247 * @see Event::Event
switches 0:5c4d7b2438d3 2248 */
switches 0:5c4d7b2438d3 2249 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 2250 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4) volatile, B0 b0) {
switches 0:5c4d7b2438d3 2251 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 2252 }
switches 0:5c4d7b2438d3 2253
switches 0:5c4d7b2438d3 2254 /** Create an event
switches 0:5c4d7b2438d3 2255 * @see Event::Event
switches 0:5c4d7b2438d3 2256 */
switches 0:5c4d7b2438d3 2257 template <typename T, typename R, typename B0>
switches 0:5c4d7b2438d3 2258 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4) const volatile, B0 b0) {
switches 0:5c4d7b2438d3 2259 new (this) Event(q, mbed::callback(obj, method), b0);
switches 0:5c4d7b2438d3 2260 }
switches 0:5c4d7b2438d3 2261
switches 0:5c4d7b2438d3 2262 /** Create an event
switches 0:5c4d7b2438d3 2263 * @see Event::Event
switches 0:5c4d7b2438d3 2264 */
switches 0:5c4d7b2438d3 2265 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 2266 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3, A4), B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 2267 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 2268 }
switches 0:5c4d7b2438d3 2269
switches 0:5c4d7b2438d3 2270 /** Create an event
switches 0:5c4d7b2438d3 2271 * @see Event::Event
switches 0:5c4d7b2438d3 2272 */
switches 0:5c4d7b2438d3 2273 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 2274 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3, A4) const, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 2275 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 2276 }
switches 0:5c4d7b2438d3 2277
switches 0:5c4d7b2438d3 2278 /** Create an event
switches 0:5c4d7b2438d3 2279 * @see Event::Event
switches 0:5c4d7b2438d3 2280 */
switches 0:5c4d7b2438d3 2281 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 2282 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3, A4) volatile, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 2283 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 2284 }
switches 0:5c4d7b2438d3 2285
switches 0:5c4d7b2438d3 2286 /** Create an event
switches 0:5c4d7b2438d3 2287 * @see Event::Event
switches 0:5c4d7b2438d3 2288 */
switches 0:5c4d7b2438d3 2289 template <typename T, typename R, typename B0, typename B1>
switches 0:5c4d7b2438d3 2290 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3, A4) const volatile, B0 b0, B1 b1) {
switches 0:5c4d7b2438d3 2291 new (this) Event(q, mbed::callback(obj, method), b0, b1);
switches 0:5c4d7b2438d3 2292 }
switches 0:5c4d7b2438d3 2293
switches 0:5c4d7b2438d3 2294 /** Create an event
switches 0:5c4d7b2438d3 2295 * @see Event::Event
switches 0:5c4d7b2438d3 2296 */
switches 0:5c4d7b2438d3 2297 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 2298 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3, A4), B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 2299 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 2300 }
switches 0:5c4d7b2438d3 2301
switches 0:5c4d7b2438d3 2302 /** Create an event
switches 0:5c4d7b2438d3 2303 * @see Event::Event
switches 0:5c4d7b2438d3 2304 */
switches 0:5c4d7b2438d3 2305 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 2306 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) const, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 2307 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 2308 }
switches 0:5c4d7b2438d3 2309
switches 0:5c4d7b2438d3 2310 /** Create an event
switches 0:5c4d7b2438d3 2311 * @see Event::Event
switches 0:5c4d7b2438d3 2312 */
switches 0:5c4d7b2438d3 2313 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 2314 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) volatile, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 2315 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 2316 }
switches 0:5c4d7b2438d3 2317
switches 0:5c4d7b2438d3 2318 /** Create an event
switches 0:5c4d7b2438d3 2319 * @see Event::Event
switches 0:5c4d7b2438d3 2320 */
switches 0:5c4d7b2438d3 2321 template <typename T, typename R, typename B0, typename B1, typename B2>
switches 0:5c4d7b2438d3 2322 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) const volatile, B0 b0, B1 b1, B2 b2) {
switches 0:5c4d7b2438d3 2323 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
switches 0:5c4d7b2438d3 2324 }
switches 0:5c4d7b2438d3 2325
switches 0:5c4d7b2438d3 2326 /** Create an event
switches 0:5c4d7b2438d3 2327 * @see Event::Event
switches 0:5c4d7b2438d3 2328 */
switches 0:5c4d7b2438d3 2329 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 2330 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3, A4), B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 2331 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 2332 }
switches 0:5c4d7b2438d3 2333
switches 0:5c4d7b2438d3 2334 /** Create an event
switches 0:5c4d7b2438d3 2335 * @see Event::Event
switches 0:5c4d7b2438d3 2336 */
switches 0:5c4d7b2438d3 2337 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 2338 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3, A4) const, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 2339 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 2340 }
switches 0:5c4d7b2438d3 2341
switches 0:5c4d7b2438d3 2342 /** Create an event
switches 0:5c4d7b2438d3 2343 * @see Event::Event
switches 0:5c4d7b2438d3 2344 */
switches 0:5c4d7b2438d3 2345 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 2346 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3, A4) volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 2347 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 2348 }
switches 0:5c4d7b2438d3 2349
switches 0:5c4d7b2438d3 2350 /** Create an event
switches 0:5c4d7b2438d3 2351 * @see Event::Event
switches 0:5c4d7b2438d3 2352 */
switches 0:5c4d7b2438d3 2353 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
switches 0:5c4d7b2438d3 2354 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3, A4) const volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
switches 0:5c4d7b2438d3 2355 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
switches 0:5c4d7b2438d3 2356 }
switches 0:5c4d7b2438d3 2357
switches 0:5c4d7b2438d3 2358 /** Create an event
switches 0:5c4d7b2438d3 2359 * @see Event::Event
switches 0:5c4d7b2438d3 2360 */
switches 0:5c4d7b2438d3 2361 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 2362 Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3, A4), B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 2363 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 2364 }
switches 0:5c4d7b2438d3 2365
switches 0:5c4d7b2438d3 2366 /** Create an event
switches 0:5c4d7b2438d3 2367 * @see Event::Event
switches 0:5c4d7b2438d3 2368 */
switches 0:5c4d7b2438d3 2369 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 2370 Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3, A4) const, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 2371 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 2372 }
switches 0:5c4d7b2438d3 2373
switches 0:5c4d7b2438d3 2374 /** Create an event
switches 0:5c4d7b2438d3 2375 * @see Event::Event
switches 0:5c4d7b2438d3 2376 */
switches 0:5c4d7b2438d3 2377 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 2378 Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3, A4) volatile, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 2379 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 2380 }
switches 0:5c4d7b2438d3 2381
switches 0:5c4d7b2438d3 2382 /** Create an event
switches 0:5c4d7b2438d3 2383 * @see Event::Event
switches 0:5c4d7b2438d3 2384 */
switches 0:5c4d7b2438d3 2385 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
switches 0:5c4d7b2438d3 2386 Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3, A4) const volatile, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
switches 0:5c4d7b2438d3 2387 new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
switches 0:5c4d7b2438d3 2388 }
switches 0:5c4d7b2438d3 2389 };
switches 0:5c4d7b2438d3 2390
switches 0:5c4d7b2438d3 2391
switches 0:5c4d7b2438d3 2392
switches 0:5c4d7b2438d3 2393 // Convenience functions declared here to avoid cyclic
switches 0:5c4d7b2438d3 2394 // dependency between Event and EventQueue
switches 0:5c4d7b2438d3 2395 template <typename R>
switches 0:5c4d7b2438d3 2396 Event<void()> EventQueue::event(R (*func)()) {
switches 0:5c4d7b2438d3 2397 return Event<void()>(this, func);
switches 0:5c4d7b2438d3 2398 }
switches 0:5c4d7b2438d3 2399
switches 0:5c4d7b2438d3 2400 template <typename T, typename R>
switches 0:5c4d7b2438d3 2401 Event<void()> EventQueue::event(T *obj, R (T::*method)()) {
switches 0:5c4d7b2438d3 2402 return Event<void()>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2403 }
switches 0:5c4d7b2438d3 2404
switches 0:5c4d7b2438d3 2405 template <typename T, typename R>
switches 0:5c4d7b2438d3 2406 Event<void()> EventQueue::event(const T *obj, R (T::*method)() const) {
switches 0:5c4d7b2438d3 2407 return Event<void()>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2408 }
switches 0:5c4d7b2438d3 2409
switches 0:5c4d7b2438d3 2410 template <typename T, typename R>
switches 0:5c4d7b2438d3 2411 Event<void()> EventQueue::event(volatile T *obj, R (T::*method)() volatile) {
switches 0:5c4d7b2438d3 2412 return Event<void()>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2413 }
switches 0:5c4d7b2438d3 2414
switches 0:5c4d7b2438d3 2415 template <typename T, typename R>
switches 0:5c4d7b2438d3 2416 Event<void()> EventQueue::event(const volatile T *obj, R (T::*method)() const volatile) {
switches 0:5c4d7b2438d3 2417 return Event<void()>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2418 }
switches 0:5c4d7b2438d3 2419
switches 0:5c4d7b2438d3 2420 template <typename R, typename B0, typename C0>
switches 0:5c4d7b2438d3 2421 Event<void()> EventQueue::event(R (*func)(B0), C0 c0) {
switches 0:5c4d7b2438d3 2422 return Event<void()>(this, func, c0);
switches 0:5c4d7b2438d3 2423 }
switches 0:5c4d7b2438d3 2424
switches 0:5c4d7b2438d3 2425 template <typename T, typename R, typename B0, typename C0>
switches 0:5c4d7b2438d3 2426 Event<void()> EventQueue::event(T *obj, R (T::*method)(B0), C0 c0) {
switches 0:5c4d7b2438d3 2427 return Event<void()>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2428 }
switches 0:5c4d7b2438d3 2429
switches 0:5c4d7b2438d3 2430 template <typename T, typename R, typename B0, typename C0>
switches 0:5c4d7b2438d3 2431 Event<void()> EventQueue::event(const T *obj, R (T::*method)(B0) const, C0 c0) {
switches 0:5c4d7b2438d3 2432 return Event<void()>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2433 }
switches 0:5c4d7b2438d3 2434
switches 0:5c4d7b2438d3 2435 template <typename T, typename R, typename B0, typename C0>
switches 0:5c4d7b2438d3 2436 Event<void()> EventQueue::event(volatile T *obj, R (T::*method)(B0) volatile, C0 c0) {
switches 0:5c4d7b2438d3 2437 return Event<void()>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2438 }
switches 0:5c4d7b2438d3 2439
switches 0:5c4d7b2438d3 2440 template <typename T, typename R, typename B0, typename C0>
switches 0:5c4d7b2438d3 2441 Event<void()> EventQueue::event(const volatile T *obj, R (T::*method)(B0) const volatile, C0 c0) {
switches 0:5c4d7b2438d3 2442 return Event<void()>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2443 }
switches 0:5c4d7b2438d3 2444
switches 0:5c4d7b2438d3 2445 template <typename R, typename B0, typename B1, typename C0, typename C1>
switches 0:5c4d7b2438d3 2446 Event<void()> EventQueue::event(R (*func)(B0, B1), C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2447 return Event<void()>(this, func, c0, c1);
switches 0:5c4d7b2438d3 2448 }
switches 0:5c4d7b2438d3 2449
switches 0:5c4d7b2438d3 2450 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1>
switches 0:5c4d7b2438d3 2451 Event<void()> EventQueue::event(T *obj, R (T::*method)(B0, B1), C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2452 return Event<void()>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2453 }
switches 0:5c4d7b2438d3 2454
switches 0:5c4d7b2438d3 2455 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1>
switches 0:5c4d7b2438d3 2456 Event<void()> EventQueue::event(const T *obj, R (T::*method)(B0, B1) const, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2457 return Event<void()>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2458 }
switches 0:5c4d7b2438d3 2459
switches 0:5c4d7b2438d3 2460 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1>
switches 0:5c4d7b2438d3 2461 Event<void()> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1) volatile, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2462 return Event<void()>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2463 }
switches 0:5c4d7b2438d3 2464
switches 0:5c4d7b2438d3 2465 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1>
switches 0:5c4d7b2438d3 2466 Event<void()> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1) const volatile, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2467 return Event<void()>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2468 }
switches 0:5c4d7b2438d3 2469
switches 0:5c4d7b2438d3 2470 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2>
switches 0:5c4d7b2438d3 2471 Event<void()> EventQueue::event(R (*func)(B0, B1, B2), C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2472 return Event<void()>(this, func, c0, c1, c2);
switches 0:5c4d7b2438d3 2473 }
switches 0:5c4d7b2438d3 2474
switches 0:5c4d7b2438d3 2475 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2>
switches 0:5c4d7b2438d3 2476 Event<void()> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2), C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2477 return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2478 }
switches 0:5c4d7b2438d3 2479
switches 0:5c4d7b2438d3 2480 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2>
switches 0:5c4d7b2438d3 2481 Event<void()> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2) const, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2482 return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2483 }
switches 0:5c4d7b2438d3 2484
switches 0:5c4d7b2438d3 2485 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2>
switches 0:5c4d7b2438d3 2486 Event<void()> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2) volatile, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2487 return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2488 }
switches 0:5c4d7b2438d3 2489
switches 0:5c4d7b2438d3 2490 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2>
switches 0:5c4d7b2438d3 2491 Event<void()> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2) const volatile, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2492 return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2493 }
switches 0:5c4d7b2438d3 2494
switches 0:5c4d7b2438d3 2495 template <typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3>
switches 0:5c4d7b2438d3 2496 Event<void()> EventQueue::event(R (*func)(B0, B1, B2, B3), C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2497 return Event<void()>(this, func, c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2498 }
switches 0:5c4d7b2438d3 2499
switches 0:5c4d7b2438d3 2500 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3>
switches 0:5c4d7b2438d3 2501 Event<void()> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3), C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2502 return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2503 }
switches 0:5c4d7b2438d3 2504
switches 0:5c4d7b2438d3 2505 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3>
switches 0:5c4d7b2438d3 2506 Event<void()> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, B3) const, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2507 return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2508 }
switches 0:5c4d7b2438d3 2509
switches 0:5c4d7b2438d3 2510 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3>
switches 0:5c4d7b2438d3 2511 Event<void()> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, B3) volatile, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2512 return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2513 }
switches 0:5c4d7b2438d3 2514
switches 0:5c4d7b2438d3 2515 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3>
switches 0:5c4d7b2438d3 2516 Event<void()> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, B3) const volatile, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2517 return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2518 }
switches 0:5c4d7b2438d3 2519
switches 0:5c4d7b2438d3 2520 template <typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4>
switches 0:5c4d7b2438d3 2521 Event<void()> EventQueue::event(R (*func)(B0, B1, B2, B3, B4), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2522 return Event<void()>(this, func, c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2523 }
switches 0:5c4d7b2438d3 2524
switches 0:5c4d7b2438d3 2525 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4>
switches 0:5c4d7b2438d3 2526 Event<void()> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3, B4), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2527 return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2528 }
switches 0:5c4d7b2438d3 2529
switches 0:5c4d7b2438d3 2530 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4>
switches 0:5c4d7b2438d3 2531 Event<void()> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, B3, B4) const, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2532 return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2533 }
switches 0:5c4d7b2438d3 2534
switches 0:5c4d7b2438d3 2535 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4>
switches 0:5c4d7b2438d3 2536 Event<void()> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4) volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2537 return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2538 }
switches 0:5c4d7b2438d3 2539
switches 0:5c4d7b2438d3 2540 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4>
switches 0:5c4d7b2438d3 2541 Event<void()> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4) const volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2542 return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2543 }
switches 0:5c4d7b2438d3 2544
switches 0:5c4d7b2438d3 2545 template <typename R, typename A0>
switches 0:5c4d7b2438d3 2546 Event<void(A0)> EventQueue::event(R (*func)(A0)) {
switches 0:5c4d7b2438d3 2547 return Event<void(A0)>(this, func);
switches 0:5c4d7b2438d3 2548 }
switches 0:5c4d7b2438d3 2549
switches 0:5c4d7b2438d3 2550 template <typename T, typename R, typename A0>
switches 0:5c4d7b2438d3 2551 Event<void(A0)> EventQueue::event(T *obj, R (T::*method)(A0)) {
switches 0:5c4d7b2438d3 2552 return Event<void(A0)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2553 }
switches 0:5c4d7b2438d3 2554
switches 0:5c4d7b2438d3 2555 template <typename T, typename R, typename A0>
switches 0:5c4d7b2438d3 2556 Event<void(A0)> EventQueue::event(const T *obj, R (T::*method)(A0) const) {
switches 0:5c4d7b2438d3 2557 return Event<void(A0)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2558 }
switches 0:5c4d7b2438d3 2559
switches 0:5c4d7b2438d3 2560 template <typename T, typename R, typename A0>
switches 0:5c4d7b2438d3 2561 Event<void(A0)> EventQueue::event(volatile T *obj, R (T::*method)(A0) volatile) {
switches 0:5c4d7b2438d3 2562 return Event<void(A0)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2563 }
switches 0:5c4d7b2438d3 2564
switches 0:5c4d7b2438d3 2565 template <typename T, typename R, typename A0>
switches 0:5c4d7b2438d3 2566 Event<void(A0)> EventQueue::event(const volatile T *obj, R (T::*method)(A0) const volatile) {
switches 0:5c4d7b2438d3 2567 return Event<void(A0)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2568 }
switches 0:5c4d7b2438d3 2569
switches 0:5c4d7b2438d3 2570 template <typename R, typename B0, typename C0, typename A0>
switches 0:5c4d7b2438d3 2571 Event<void(A0)> EventQueue::event(R (*func)(B0, A0), C0 c0) {
switches 0:5c4d7b2438d3 2572 return Event<void(A0)>(this, func, c0);
switches 0:5c4d7b2438d3 2573 }
switches 0:5c4d7b2438d3 2574
switches 0:5c4d7b2438d3 2575 template <typename T, typename R, typename B0, typename C0, typename A0>
switches 0:5c4d7b2438d3 2576 Event<void(A0)> EventQueue::event(T *obj, R (T::*method)(B0, A0), C0 c0) {
switches 0:5c4d7b2438d3 2577 return Event<void(A0)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2578 }
switches 0:5c4d7b2438d3 2579
switches 0:5c4d7b2438d3 2580 template <typename T, typename R, typename B0, typename C0, typename A0>
switches 0:5c4d7b2438d3 2581 Event<void(A0)> EventQueue::event(const T *obj, R (T::*method)(B0, A0) const, C0 c0) {
switches 0:5c4d7b2438d3 2582 return Event<void(A0)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2583 }
switches 0:5c4d7b2438d3 2584
switches 0:5c4d7b2438d3 2585 template <typename T, typename R, typename B0, typename C0, typename A0>
switches 0:5c4d7b2438d3 2586 Event<void(A0)> EventQueue::event(volatile T *obj, R (T::*method)(B0, A0) volatile, C0 c0) {
switches 0:5c4d7b2438d3 2587 return Event<void(A0)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2588 }
switches 0:5c4d7b2438d3 2589
switches 0:5c4d7b2438d3 2590 template <typename T, typename R, typename B0, typename C0, typename A0>
switches 0:5c4d7b2438d3 2591 Event<void(A0)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, A0) const volatile, C0 c0) {
switches 0:5c4d7b2438d3 2592 return Event<void(A0)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2593 }
switches 0:5c4d7b2438d3 2594
switches 0:5c4d7b2438d3 2595 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0>
switches 0:5c4d7b2438d3 2596 Event<void(A0)> EventQueue::event(R (*func)(B0, B1, A0), C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2597 return Event<void(A0)>(this, func, c0, c1);
switches 0:5c4d7b2438d3 2598 }
switches 0:5c4d7b2438d3 2599
switches 0:5c4d7b2438d3 2600 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0>
switches 0:5c4d7b2438d3 2601 Event<void(A0)> EventQueue::event(T *obj, R (T::*method)(B0, B1, A0), C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2602 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2603 }
switches 0:5c4d7b2438d3 2604
switches 0:5c4d7b2438d3 2605 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0>
switches 0:5c4d7b2438d3 2606 Event<void(A0)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, A0) const, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2607 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2608 }
switches 0:5c4d7b2438d3 2609
switches 0:5c4d7b2438d3 2610 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0>
switches 0:5c4d7b2438d3 2611 Event<void(A0)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, A0) volatile, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2612 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2613 }
switches 0:5c4d7b2438d3 2614
switches 0:5c4d7b2438d3 2615 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0>
switches 0:5c4d7b2438d3 2616 Event<void(A0)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, A0) const volatile, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2617 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2618 }
switches 0:5c4d7b2438d3 2619
switches 0:5c4d7b2438d3 2620 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0>
switches 0:5c4d7b2438d3 2621 Event<void(A0)> EventQueue::event(R (*func)(B0, B1, B2, A0), C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2622 return Event<void(A0)>(this, func, c0, c1, c2);
switches 0:5c4d7b2438d3 2623 }
switches 0:5c4d7b2438d3 2624
switches 0:5c4d7b2438d3 2625 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0>
switches 0:5c4d7b2438d3 2626 Event<void(A0)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, A0), C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2627 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2628 }
switches 0:5c4d7b2438d3 2629
switches 0:5c4d7b2438d3 2630 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0>
switches 0:5c4d7b2438d3 2631 Event<void(A0)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, A0) const, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2632 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2633 }
switches 0:5c4d7b2438d3 2634
switches 0:5c4d7b2438d3 2635 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0>
switches 0:5c4d7b2438d3 2636 Event<void(A0)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, A0) volatile, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2637 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2638 }
switches 0:5c4d7b2438d3 2639
switches 0:5c4d7b2438d3 2640 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0>
switches 0:5c4d7b2438d3 2641 Event<void(A0)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, A0) const volatile, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2642 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2643 }
switches 0:5c4d7b2438d3 2644
switches 0:5c4d7b2438d3 2645 template <typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0>
switches 0:5c4d7b2438d3 2646 Event<void(A0)> EventQueue::event(R (*func)(B0, B1, B2, B3, A0), C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2647 return Event<void(A0)>(this, func, c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2648 }
switches 0:5c4d7b2438d3 2649
switches 0:5c4d7b2438d3 2650 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0>
switches 0:5c4d7b2438d3 2651 Event<void(A0)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3, A0), C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2652 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2653 }
switches 0:5c4d7b2438d3 2654
switches 0:5c4d7b2438d3 2655 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0>
switches 0:5c4d7b2438d3 2656 Event<void(A0)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, B3, A0) const, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2657 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2658 }
switches 0:5c4d7b2438d3 2659
switches 0:5c4d7b2438d3 2660 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0>
switches 0:5c4d7b2438d3 2661 Event<void(A0)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0) volatile, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2662 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2663 }
switches 0:5c4d7b2438d3 2664
switches 0:5c4d7b2438d3 2665 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0>
switches 0:5c4d7b2438d3 2666 Event<void(A0)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0) const volatile, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2667 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2668 }
switches 0:5c4d7b2438d3 2669
switches 0:5c4d7b2438d3 2670 template <typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0>
switches 0:5c4d7b2438d3 2671 Event<void(A0)> EventQueue::event(R (*func)(B0, B1, B2, B3, B4, A0), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2672 return Event<void(A0)>(this, func, c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2673 }
switches 0:5c4d7b2438d3 2674
switches 0:5c4d7b2438d3 2675 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0>
switches 0:5c4d7b2438d3 2676 Event<void(A0)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2677 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2678 }
switches 0:5c4d7b2438d3 2679
switches 0:5c4d7b2438d3 2680 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0>
switches 0:5c4d7b2438d3 2681 Event<void(A0)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0) const, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2682 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2683 }
switches 0:5c4d7b2438d3 2684
switches 0:5c4d7b2438d3 2685 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0>
switches 0:5c4d7b2438d3 2686 Event<void(A0)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0) volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2687 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2688 }
switches 0:5c4d7b2438d3 2689
switches 0:5c4d7b2438d3 2690 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0>
switches 0:5c4d7b2438d3 2691 Event<void(A0)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0) const volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2692 return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2693 }
switches 0:5c4d7b2438d3 2694
switches 0:5c4d7b2438d3 2695 template <typename R, typename A0, typename A1>
switches 0:5c4d7b2438d3 2696 Event<void(A0, A1)> EventQueue::event(R (*func)(A0, A1)) {
switches 0:5c4d7b2438d3 2697 return Event<void(A0, A1)>(this, func);
switches 0:5c4d7b2438d3 2698 }
switches 0:5c4d7b2438d3 2699
switches 0:5c4d7b2438d3 2700 template <typename T, typename R, typename A0, typename A1>
switches 0:5c4d7b2438d3 2701 Event<void(A0, A1)> EventQueue::event(T *obj, R (T::*method)(A0, A1)) {
switches 0:5c4d7b2438d3 2702 return Event<void(A0, A1)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2703 }
switches 0:5c4d7b2438d3 2704
switches 0:5c4d7b2438d3 2705 template <typename T, typename R, typename A0, typename A1>
switches 0:5c4d7b2438d3 2706 Event<void(A0, A1)> EventQueue::event(const T *obj, R (T::*method)(A0, A1) const) {
switches 0:5c4d7b2438d3 2707 return Event<void(A0, A1)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2708 }
switches 0:5c4d7b2438d3 2709
switches 0:5c4d7b2438d3 2710 template <typename T, typename R, typename A0, typename A1>
switches 0:5c4d7b2438d3 2711 Event<void(A0, A1)> EventQueue::event(volatile T *obj, R (T::*method)(A0, A1) volatile) {
switches 0:5c4d7b2438d3 2712 return Event<void(A0, A1)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2713 }
switches 0:5c4d7b2438d3 2714
switches 0:5c4d7b2438d3 2715 template <typename T, typename R, typename A0, typename A1>
switches 0:5c4d7b2438d3 2716 Event<void(A0, A1)> EventQueue::event(const volatile T *obj, R (T::*method)(A0, A1) const volatile) {
switches 0:5c4d7b2438d3 2717 return Event<void(A0, A1)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2718 }
switches 0:5c4d7b2438d3 2719
switches 0:5c4d7b2438d3 2720 template <typename R, typename B0, typename C0, typename A0, typename A1>
switches 0:5c4d7b2438d3 2721 Event<void(A0, A1)> EventQueue::event(R (*func)(B0, A0, A1), C0 c0) {
switches 0:5c4d7b2438d3 2722 return Event<void(A0, A1)>(this, func, c0);
switches 0:5c4d7b2438d3 2723 }
switches 0:5c4d7b2438d3 2724
switches 0:5c4d7b2438d3 2725 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1>
switches 0:5c4d7b2438d3 2726 Event<void(A0, A1)> EventQueue::event(T *obj, R (T::*method)(B0, A0, A1), C0 c0) {
switches 0:5c4d7b2438d3 2727 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2728 }
switches 0:5c4d7b2438d3 2729
switches 0:5c4d7b2438d3 2730 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1>
switches 0:5c4d7b2438d3 2731 Event<void(A0, A1)> EventQueue::event(const T *obj, R (T::*method)(B0, A0, A1) const, C0 c0) {
switches 0:5c4d7b2438d3 2732 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2733 }
switches 0:5c4d7b2438d3 2734
switches 0:5c4d7b2438d3 2735 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1>
switches 0:5c4d7b2438d3 2736 Event<void(A0, A1)> EventQueue::event(volatile T *obj, R (T::*method)(B0, A0, A1) volatile, C0 c0) {
switches 0:5c4d7b2438d3 2737 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2738 }
switches 0:5c4d7b2438d3 2739
switches 0:5c4d7b2438d3 2740 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1>
switches 0:5c4d7b2438d3 2741 Event<void(A0, A1)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, A0, A1) const volatile, C0 c0) {
switches 0:5c4d7b2438d3 2742 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2743 }
switches 0:5c4d7b2438d3 2744
switches 0:5c4d7b2438d3 2745 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1>
switches 0:5c4d7b2438d3 2746 Event<void(A0, A1)> EventQueue::event(R (*func)(B0, B1, A0, A1), C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2747 return Event<void(A0, A1)>(this, func, c0, c1);
switches 0:5c4d7b2438d3 2748 }
switches 0:5c4d7b2438d3 2749
switches 0:5c4d7b2438d3 2750 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1>
switches 0:5c4d7b2438d3 2751 Event<void(A0, A1)> EventQueue::event(T *obj, R (T::*method)(B0, B1, A0, A1), C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2752 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2753 }
switches 0:5c4d7b2438d3 2754
switches 0:5c4d7b2438d3 2755 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1>
switches 0:5c4d7b2438d3 2756 Event<void(A0, A1)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, A0, A1) const, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2757 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2758 }
switches 0:5c4d7b2438d3 2759
switches 0:5c4d7b2438d3 2760 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1>
switches 0:5c4d7b2438d3 2761 Event<void(A0, A1)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, A0, A1) volatile, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2762 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2763 }
switches 0:5c4d7b2438d3 2764
switches 0:5c4d7b2438d3 2765 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1>
switches 0:5c4d7b2438d3 2766 Event<void(A0, A1)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, A0, A1) const volatile, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2767 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2768 }
switches 0:5c4d7b2438d3 2769
switches 0:5c4d7b2438d3 2770 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1>
switches 0:5c4d7b2438d3 2771 Event<void(A0, A1)> EventQueue::event(R (*func)(B0, B1, B2, A0, A1), C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2772 return Event<void(A0, A1)>(this, func, c0, c1, c2);
switches 0:5c4d7b2438d3 2773 }
switches 0:5c4d7b2438d3 2774
switches 0:5c4d7b2438d3 2775 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1>
switches 0:5c4d7b2438d3 2776 Event<void(A0, A1)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, A0, A1), C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2777 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2778 }
switches 0:5c4d7b2438d3 2779
switches 0:5c4d7b2438d3 2780 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1>
switches 0:5c4d7b2438d3 2781 Event<void(A0, A1)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, A0, A1) const, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2782 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2783 }
switches 0:5c4d7b2438d3 2784
switches 0:5c4d7b2438d3 2785 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1>
switches 0:5c4d7b2438d3 2786 Event<void(A0, A1)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1) volatile, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2787 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2788 }
switches 0:5c4d7b2438d3 2789
switches 0:5c4d7b2438d3 2790 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1>
switches 0:5c4d7b2438d3 2791 Event<void(A0, A1)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1) const volatile, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2792 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2793 }
switches 0:5c4d7b2438d3 2794
switches 0:5c4d7b2438d3 2795 template <typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1>
switches 0:5c4d7b2438d3 2796 Event<void(A0, A1)> EventQueue::event(R (*func)(B0, B1, B2, B3, A0, A1), C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2797 return Event<void(A0, A1)>(this, func, c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2798 }
switches 0:5c4d7b2438d3 2799
switches 0:5c4d7b2438d3 2800 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1>
switches 0:5c4d7b2438d3 2801 Event<void(A0, A1)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1), C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2802 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2803 }
switches 0:5c4d7b2438d3 2804
switches 0:5c4d7b2438d3 2805 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1>
switches 0:5c4d7b2438d3 2806 Event<void(A0, A1)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1) const, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2807 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2808 }
switches 0:5c4d7b2438d3 2809
switches 0:5c4d7b2438d3 2810 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1>
switches 0:5c4d7b2438d3 2811 Event<void(A0, A1)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1) volatile, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2812 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2813 }
switches 0:5c4d7b2438d3 2814
switches 0:5c4d7b2438d3 2815 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1>
switches 0:5c4d7b2438d3 2816 Event<void(A0, A1)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1) const volatile, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2817 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2818 }
switches 0:5c4d7b2438d3 2819
switches 0:5c4d7b2438d3 2820 template <typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1>
switches 0:5c4d7b2438d3 2821 Event<void(A0, A1)> EventQueue::event(R (*func)(B0, B1, B2, B3, B4, A0, A1), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2822 return Event<void(A0, A1)>(this, func, c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2823 }
switches 0:5c4d7b2438d3 2824
switches 0:5c4d7b2438d3 2825 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1>
switches 0:5c4d7b2438d3 2826 Event<void(A0, A1)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2827 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2828 }
switches 0:5c4d7b2438d3 2829
switches 0:5c4d7b2438d3 2830 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1>
switches 0:5c4d7b2438d3 2831 Event<void(A0, A1)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1) const, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2832 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2833 }
switches 0:5c4d7b2438d3 2834
switches 0:5c4d7b2438d3 2835 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1>
switches 0:5c4d7b2438d3 2836 Event<void(A0, A1)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1) volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2837 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2838 }
switches 0:5c4d7b2438d3 2839
switches 0:5c4d7b2438d3 2840 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1>
switches 0:5c4d7b2438d3 2841 Event<void(A0, A1)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1) const volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2842 return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2843 }
switches 0:5c4d7b2438d3 2844
switches 0:5c4d7b2438d3 2845 template <typename R, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2846 Event<void(A0, A1, A2)> EventQueue::event(R (*func)(A0, A1, A2)) {
switches 0:5c4d7b2438d3 2847 return Event<void(A0, A1, A2)>(this, func);
switches 0:5c4d7b2438d3 2848 }
switches 0:5c4d7b2438d3 2849
switches 0:5c4d7b2438d3 2850 template <typename T, typename R, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2851 Event<void(A0, A1, A2)> EventQueue::event(T *obj, R (T::*method)(A0, A1, A2)) {
switches 0:5c4d7b2438d3 2852 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2853 }
switches 0:5c4d7b2438d3 2854
switches 0:5c4d7b2438d3 2855 template <typename T, typename R, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2856 Event<void(A0, A1, A2)> EventQueue::event(const T *obj, R (T::*method)(A0, A1, A2) const) {
switches 0:5c4d7b2438d3 2857 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2858 }
switches 0:5c4d7b2438d3 2859
switches 0:5c4d7b2438d3 2860 template <typename T, typename R, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2861 Event<void(A0, A1, A2)> EventQueue::event(volatile T *obj, R (T::*method)(A0, A1, A2) volatile) {
switches 0:5c4d7b2438d3 2862 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2863 }
switches 0:5c4d7b2438d3 2864
switches 0:5c4d7b2438d3 2865 template <typename T, typename R, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2866 Event<void(A0, A1, A2)> EventQueue::event(const volatile T *obj, R (T::*method)(A0, A1, A2) const volatile) {
switches 0:5c4d7b2438d3 2867 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 2868 }
switches 0:5c4d7b2438d3 2869
switches 0:5c4d7b2438d3 2870 template <typename R, typename B0, typename C0, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2871 Event<void(A0, A1, A2)> EventQueue::event(R (*func)(B0, A0, A1, A2), C0 c0) {
switches 0:5c4d7b2438d3 2872 return Event<void(A0, A1, A2)>(this, func, c0);
switches 0:5c4d7b2438d3 2873 }
switches 0:5c4d7b2438d3 2874
switches 0:5c4d7b2438d3 2875 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2876 Event<void(A0, A1, A2)> EventQueue::event(T *obj, R (T::*method)(B0, A0, A1, A2), C0 c0) {
switches 0:5c4d7b2438d3 2877 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2878 }
switches 0:5c4d7b2438d3 2879
switches 0:5c4d7b2438d3 2880 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2881 Event<void(A0, A1, A2)> EventQueue::event(const T *obj, R (T::*method)(B0, A0, A1, A2) const, C0 c0) {
switches 0:5c4d7b2438d3 2882 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2883 }
switches 0:5c4d7b2438d3 2884
switches 0:5c4d7b2438d3 2885 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2886 Event<void(A0, A1, A2)> EventQueue::event(volatile T *obj, R (T::*method)(B0, A0, A1, A2) volatile, C0 c0) {
switches 0:5c4d7b2438d3 2887 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2888 }
switches 0:5c4d7b2438d3 2889
switches 0:5c4d7b2438d3 2890 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2891 Event<void(A0, A1, A2)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, A0, A1, A2) const volatile, C0 c0) {
switches 0:5c4d7b2438d3 2892 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 2893 }
switches 0:5c4d7b2438d3 2894
switches 0:5c4d7b2438d3 2895 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2896 Event<void(A0, A1, A2)> EventQueue::event(R (*func)(B0, B1, A0, A1, A2), C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2897 return Event<void(A0, A1, A2)>(this, func, c0, c1);
switches 0:5c4d7b2438d3 2898 }
switches 0:5c4d7b2438d3 2899
switches 0:5c4d7b2438d3 2900 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2901 Event<void(A0, A1, A2)> EventQueue::event(T *obj, R (T::*method)(B0, B1, A0, A1, A2), C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2902 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2903 }
switches 0:5c4d7b2438d3 2904
switches 0:5c4d7b2438d3 2905 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2906 Event<void(A0, A1, A2)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, A0, A1, A2) const, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2907 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2908 }
switches 0:5c4d7b2438d3 2909
switches 0:5c4d7b2438d3 2910 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2911 Event<void(A0, A1, A2)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2) volatile, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2912 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2913 }
switches 0:5c4d7b2438d3 2914
switches 0:5c4d7b2438d3 2915 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2916 Event<void(A0, A1, A2)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2) const volatile, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 2917 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 2918 }
switches 0:5c4d7b2438d3 2919
switches 0:5c4d7b2438d3 2920 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2921 Event<void(A0, A1, A2)> EventQueue::event(R (*func)(B0, B1, B2, A0, A1, A2), C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2922 return Event<void(A0, A1, A2)>(this, func, c0, c1, c2);
switches 0:5c4d7b2438d3 2923 }
switches 0:5c4d7b2438d3 2924
switches 0:5c4d7b2438d3 2925 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2926 Event<void(A0, A1, A2)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2), C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2927 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2928 }
switches 0:5c4d7b2438d3 2929
switches 0:5c4d7b2438d3 2930 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2931 Event<void(A0, A1, A2)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2) const, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2932 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2933 }
switches 0:5c4d7b2438d3 2934
switches 0:5c4d7b2438d3 2935 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2936 Event<void(A0, A1, A2)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2) volatile, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2937 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2938 }
switches 0:5c4d7b2438d3 2939
switches 0:5c4d7b2438d3 2940 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2941 Event<void(A0, A1, A2)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2) const volatile, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 2942 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 2943 }
switches 0:5c4d7b2438d3 2944
switches 0:5c4d7b2438d3 2945 template <typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2946 Event<void(A0, A1, A2)> EventQueue::event(R (*func)(B0, B1, B2, B3, A0, A1, A2), C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2947 return Event<void(A0, A1, A2)>(this, func, c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2948 }
switches 0:5c4d7b2438d3 2949
switches 0:5c4d7b2438d3 2950 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2951 Event<void(A0, A1, A2)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2), C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2952 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2953 }
switches 0:5c4d7b2438d3 2954
switches 0:5c4d7b2438d3 2955 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2956 Event<void(A0, A1, A2)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2) const, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2957 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2958 }
switches 0:5c4d7b2438d3 2959
switches 0:5c4d7b2438d3 2960 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2961 Event<void(A0, A1, A2)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2) volatile, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2962 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2963 }
switches 0:5c4d7b2438d3 2964
switches 0:5c4d7b2438d3 2965 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2966 Event<void(A0, A1, A2)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2) const volatile, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 2967 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 2968 }
switches 0:5c4d7b2438d3 2969
switches 0:5c4d7b2438d3 2970 template <typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2971 Event<void(A0, A1, A2)> EventQueue::event(R (*func)(B0, B1, B2, B3, B4, A0, A1, A2), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2972 return Event<void(A0, A1, A2)>(this, func, c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2973 }
switches 0:5c4d7b2438d3 2974
switches 0:5c4d7b2438d3 2975 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2976 Event<void(A0, A1, A2)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2977 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2978 }
switches 0:5c4d7b2438d3 2979
switches 0:5c4d7b2438d3 2980 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2981 Event<void(A0, A1, A2)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2) const, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2982 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2983 }
switches 0:5c4d7b2438d3 2984
switches 0:5c4d7b2438d3 2985 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2986 Event<void(A0, A1, A2)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2) volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2987 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2988 }
switches 0:5c4d7b2438d3 2989
switches 0:5c4d7b2438d3 2990 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2>
switches 0:5c4d7b2438d3 2991 Event<void(A0, A1, A2)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2) const volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 2992 return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 2993 }
switches 0:5c4d7b2438d3 2994
switches 0:5c4d7b2438d3 2995 template <typename R, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 2996 Event<void(A0, A1, A2, A3)> EventQueue::event(R (*func)(A0, A1, A2, A3)) {
switches 0:5c4d7b2438d3 2997 return Event<void(A0, A1, A2, A3)>(this, func);
switches 0:5c4d7b2438d3 2998 }
switches 0:5c4d7b2438d3 2999
switches 0:5c4d7b2438d3 3000 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3001 Event<void(A0, A1, A2, A3)> EventQueue::event(T *obj, R (T::*method)(A0, A1, A2, A3)) {
switches 0:5c4d7b2438d3 3002 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 3003 }
switches 0:5c4d7b2438d3 3004
switches 0:5c4d7b2438d3 3005 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3006 Event<void(A0, A1, A2, A3)> EventQueue::event(const T *obj, R (T::*method)(A0, A1, A2, A3) const) {
switches 0:5c4d7b2438d3 3007 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 3008 }
switches 0:5c4d7b2438d3 3009
switches 0:5c4d7b2438d3 3010 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3011 Event<void(A0, A1, A2, A3)> EventQueue::event(volatile T *obj, R (T::*method)(A0, A1, A2, A3) volatile) {
switches 0:5c4d7b2438d3 3012 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 3013 }
switches 0:5c4d7b2438d3 3014
switches 0:5c4d7b2438d3 3015 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3016 Event<void(A0, A1, A2, A3)> EventQueue::event(const volatile T *obj, R (T::*method)(A0, A1, A2, A3) const volatile) {
switches 0:5c4d7b2438d3 3017 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 3018 }
switches 0:5c4d7b2438d3 3019
switches 0:5c4d7b2438d3 3020 template <typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3021 Event<void(A0, A1, A2, A3)> EventQueue::event(R (*func)(B0, A0, A1, A2, A3), C0 c0) {
switches 0:5c4d7b2438d3 3022 return Event<void(A0, A1, A2, A3)>(this, func, c0);
switches 0:5c4d7b2438d3 3023 }
switches 0:5c4d7b2438d3 3024
switches 0:5c4d7b2438d3 3025 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3026 Event<void(A0, A1, A2, A3)> EventQueue::event(T *obj, R (T::*method)(B0, A0, A1, A2, A3), C0 c0) {
switches 0:5c4d7b2438d3 3027 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 3028 }
switches 0:5c4d7b2438d3 3029
switches 0:5c4d7b2438d3 3030 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3031 Event<void(A0, A1, A2, A3)> EventQueue::event(const T *obj, R (T::*method)(B0, A0, A1, A2, A3) const, C0 c0) {
switches 0:5c4d7b2438d3 3032 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 3033 }
switches 0:5c4d7b2438d3 3034
switches 0:5c4d7b2438d3 3035 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3036 Event<void(A0, A1, A2, A3)> EventQueue::event(volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3) volatile, C0 c0) {
switches 0:5c4d7b2438d3 3037 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 3038 }
switches 0:5c4d7b2438d3 3039
switches 0:5c4d7b2438d3 3040 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3041 Event<void(A0, A1, A2, A3)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3) const volatile, C0 c0) {
switches 0:5c4d7b2438d3 3042 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 3043 }
switches 0:5c4d7b2438d3 3044
switches 0:5c4d7b2438d3 3045 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3046 Event<void(A0, A1, A2, A3)> EventQueue::event(R (*func)(B0, B1, A0, A1, A2, A3), C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 3047 return Event<void(A0, A1, A2, A3)>(this, func, c0, c1);
switches 0:5c4d7b2438d3 3048 }
switches 0:5c4d7b2438d3 3049
switches 0:5c4d7b2438d3 3050 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3051 Event<void(A0, A1, A2, A3)> EventQueue::event(T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3), C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 3052 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 3053 }
switches 0:5c4d7b2438d3 3054
switches 0:5c4d7b2438d3 3055 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3056 Event<void(A0, A1, A2, A3)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3) const, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 3057 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 3058 }
switches 0:5c4d7b2438d3 3059
switches 0:5c4d7b2438d3 3060 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3061 Event<void(A0, A1, A2, A3)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3) volatile, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 3062 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 3063 }
switches 0:5c4d7b2438d3 3064
switches 0:5c4d7b2438d3 3065 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3066 Event<void(A0, A1, A2, A3)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3) const volatile, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 3067 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 3068 }
switches 0:5c4d7b2438d3 3069
switches 0:5c4d7b2438d3 3070 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3071 Event<void(A0, A1, A2, A3)> EventQueue::event(R (*func)(B0, B1, B2, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 3072 return Event<void(A0, A1, A2, A3)>(this, func, c0, c1, c2);
switches 0:5c4d7b2438d3 3073 }
switches 0:5c4d7b2438d3 3074
switches 0:5c4d7b2438d3 3075 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3076 Event<void(A0, A1, A2, A3)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 3077 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 3078 }
switches 0:5c4d7b2438d3 3079
switches 0:5c4d7b2438d3 3080 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3081 Event<void(A0, A1, A2, A3)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3) const, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 3082 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 3083 }
switches 0:5c4d7b2438d3 3084
switches 0:5c4d7b2438d3 3085 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3086 Event<void(A0, A1, A2, A3)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3) volatile, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 3087 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 3088 }
switches 0:5c4d7b2438d3 3089
switches 0:5c4d7b2438d3 3090 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3091 Event<void(A0, A1, A2, A3)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3) const volatile, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 3092 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 3093 }
switches 0:5c4d7b2438d3 3094
switches 0:5c4d7b2438d3 3095 template <typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3096 Event<void(A0, A1, A2, A3)> EventQueue::event(R (*func)(B0, B1, B2, B3, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 3097 return Event<void(A0, A1, A2, A3)>(this, func, c0, c1, c2, c3);
switches 0:5c4d7b2438d3 3098 }
switches 0:5c4d7b2438d3 3099
switches 0:5c4d7b2438d3 3100 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3101 Event<void(A0, A1, A2, A3)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 3102 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 3103 }
switches 0:5c4d7b2438d3 3104
switches 0:5c4d7b2438d3 3105 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3106 Event<void(A0, A1, A2, A3)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3) const, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 3107 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 3108 }
switches 0:5c4d7b2438d3 3109
switches 0:5c4d7b2438d3 3110 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3111 Event<void(A0, A1, A2, A3)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3) volatile, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 3112 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 3113 }
switches 0:5c4d7b2438d3 3114
switches 0:5c4d7b2438d3 3115 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3116 Event<void(A0, A1, A2, A3)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3) const volatile, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 3117 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 3118 }
switches 0:5c4d7b2438d3 3119
switches 0:5c4d7b2438d3 3120 template <typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3121 Event<void(A0, A1, A2, A3)> EventQueue::event(R (*func)(B0, B1, B2, B3, B4, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 3122 return Event<void(A0, A1, A2, A3)>(this, func, c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 3123 }
switches 0:5c4d7b2438d3 3124
switches 0:5c4d7b2438d3 3125 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3126 Event<void(A0, A1, A2, A3)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 3127 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 3128 }
switches 0:5c4d7b2438d3 3129
switches 0:5c4d7b2438d3 3130 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3131 Event<void(A0, A1, A2, A3)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3) const, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 3132 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 3133 }
switches 0:5c4d7b2438d3 3134
switches 0:5c4d7b2438d3 3135 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3136 Event<void(A0, A1, A2, A3)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3) volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 3137 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 3138 }
switches 0:5c4d7b2438d3 3139
switches 0:5c4d7b2438d3 3140 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2, typename A3>
switches 0:5c4d7b2438d3 3141 Event<void(A0, A1, A2, A3)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3) const volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 3142 return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 3143 }
switches 0:5c4d7b2438d3 3144
switches 0:5c4d7b2438d3 3145 template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3146 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(R (*func)(A0, A1, A2, A3, A4)) {
switches 0:5c4d7b2438d3 3147 return Event<void(A0, A1, A2, A3, A4)>(this, func);
switches 0:5c4d7b2438d3 3148 }
switches 0:5c4d7b2438d3 3149
switches 0:5c4d7b2438d3 3150 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3151 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(T *obj, R (T::*method)(A0, A1, A2, A3, A4)) {
switches 0:5c4d7b2438d3 3152 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 3153 }
switches 0:5c4d7b2438d3 3154
switches 0:5c4d7b2438d3 3155 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3156 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const T *obj, R (T::*method)(A0, A1, A2, A3, A4) const) {
switches 0:5c4d7b2438d3 3157 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 3158 }
switches 0:5c4d7b2438d3 3159
switches 0:5c4d7b2438d3 3160 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3161 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(volatile T *obj, R (T::*method)(A0, A1, A2, A3, A4) volatile) {
switches 0:5c4d7b2438d3 3162 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 3163 }
switches 0:5c4d7b2438d3 3164
switches 0:5c4d7b2438d3 3165 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3166 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const volatile T *obj, R (T::*method)(A0, A1, A2, A3, A4) const volatile) {
switches 0:5c4d7b2438d3 3167 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method));
switches 0:5c4d7b2438d3 3168 }
switches 0:5c4d7b2438d3 3169
switches 0:5c4d7b2438d3 3170 template <typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3171 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(R (*func)(B0, A0, A1, A2, A3, A4), C0 c0) {
switches 0:5c4d7b2438d3 3172 return Event<void(A0, A1, A2, A3, A4)>(this, func, c0);
switches 0:5c4d7b2438d3 3173 }
switches 0:5c4d7b2438d3 3174
switches 0:5c4d7b2438d3 3175 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3176 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4), C0 c0) {
switches 0:5c4d7b2438d3 3177 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 3178 }
switches 0:5c4d7b2438d3 3179
switches 0:5c4d7b2438d3 3180 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3181 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4) const, C0 c0) {
switches 0:5c4d7b2438d3 3182 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 3183 }
switches 0:5c4d7b2438d3 3184
switches 0:5c4d7b2438d3 3185 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3186 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4) volatile, C0 c0) {
switches 0:5c4d7b2438d3 3187 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 3188 }
switches 0:5c4d7b2438d3 3189
switches 0:5c4d7b2438d3 3190 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3191 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4) const volatile, C0 c0) {
switches 0:5c4d7b2438d3 3192 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0);
switches 0:5c4d7b2438d3 3193 }
switches 0:5c4d7b2438d3 3194
switches 0:5c4d7b2438d3 3195 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3196 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(R (*func)(B0, B1, A0, A1, A2, A3, A4), C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 3197 return Event<void(A0, A1, A2, A3, A4)>(this, func, c0, c1);
switches 0:5c4d7b2438d3 3198 }
switches 0:5c4d7b2438d3 3199
switches 0:5c4d7b2438d3 3200 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3201 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3, A4), C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 3202 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 3203 }
switches 0:5c4d7b2438d3 3204
switches 0:5c4d7b2438d3 3205 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3206 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3, A4) const, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 3207 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 3208 }
switches 0:5c4d7b2438d3 3209
switches 0:5c4d7b2438d3 3210 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3211 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3, A4) volatile, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 3212 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 3213 }
switches 0:5c4d7b2438d3 3214
switches 0:5c4d7b2438d3 3215 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3216 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3, A4) const volatile, C0 c0, C1 c1) {
switches 0:5c4d7b2438d3 3217 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1);
switches 0:5c4d7b2438d3 3218 }
switches 0:5c4d7b2438d3 3219
switches 0:5c4d7b2438d3 3220 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3221 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(R (*func)(B0, B1, B2, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 3222 return Event<void(A0, A1, A2, A3, A4)>(this, func, c0, c1, c2);
switches 0:5c4d7b2438d3 3223 }
switches 0:5c4d7b2438d3 3224
switches 0:5c4d7b2438d3 3225 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3226 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 3227 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 3228 }
switches 0:5c4d7b2438d3 3229
switches 0:5c4d7b2438d3 3230 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3231 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) const, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 3232 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 3233 }
switches 0:5c4d7b2438d3 3234
switches 0:5c4d7b2438d3 3235 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3236 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) volatile, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 3237 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 3238 }
switches 0:5c4d7b2438d3 3239
switches 0:5c4d7b2438d3 3240 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3241 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) const volatile, C0 c0, C1 c1, C2 c2) {
switches 0:5c4d7b2438d3 3242 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2);
switches 0:5c4d7b2438d3 3243 }
switches 0:5c4d7b2438d3 3244
switches 0:5c4d7b2438d3 3245 template <typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3246 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(R (*func)(B0, B1, B2, B3, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 3247 return Event<void(A0, A1, A2, A3, A4)>(this, func, c0, c1, c2, c3);
switches 0:5c4d7b2438d3 3248 }
switches 0:5c4d7b2438d3 3249
switches 0:5c4d7b2438d3 3250 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3251 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 3252 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 3253 }
switches 0:5c4d7b2438d3 3254
switches 0:5c4d7b2438d3 3255 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3256 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3, A4) const, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 3257 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 3258 }
switches 0:5c4d7b2438d3 3259
switches 0:5c4d7b2438d3 3260 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3261 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3, A4) volatile, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 3262 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 3263 }
switches 0:5c4d7b2438d3 3264
switches 0:5c4d7b2438d3 3265 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3266 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3, A4) const volatile, C0 c0, C1 c1, C2 c2, C3 c3) {
switches 0:5c4d7b2438d3 3267 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
switches 0:5c4d7b2438d3 3268 }
switches 0:5c4d7b2438d3 3269
switches 0:5c4d7b2438d3 3270 template <typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3271 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(R (*func)(B0, B1, B2, B3, B4, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 3272 return Event<void(A0, A1, A2, A3, A4)>(this, func, c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 3273 }
switches 0:5c4d7b2438d3 3274
switches 0:5c4d7b2438d3 3275 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3276 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 3277 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 3278 }
switches 0:5c4d7b2438d3 3279
switches 0:5c4d7b2438d3 3280 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3281 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3, A4) const, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 3282 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 3283 }
switches 0:5c4d7b2438d3 3284
switches 0:5c4d7b2438d3 3285 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3286 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3, A4) volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 3287 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 3288 }
switches 0:5c4d7b2438d3 3289
switches 0:5c4d7b2438d3 3290 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename A0, typename A1, typename A2, typename A3, typename A4>
switches 0:5c4d7b2438d3 3291 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0, A1, A2, A3, A4) const volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
switches 0:5c4d7b2438d3 3292 return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
switches 0:5c4d7b2438d3 3293 }
switches 0:5c4d7b2438d3 3294
switches 0:5c4d7b2438d3 3295 }
switches 0:5c4d7b2438d3 3296
switches 0:5c4d7b2438d3 3297 #endif
switches 0:5c4d7b2438d3 3298
switches 0:5c4d7b2438d3 3299 /** @}*/