Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
Event.h
00001 /* 00002 * Copyright (c) 2016-2019 ARM Limited 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 #ifndef EVENT_H 00018 #define EVENT_H 00019 00020 #include "events/EventQueue.h" 00021 #include "platform/mbed_assert.h" 00022 00023 namespace events { 00024 /** \defgroup events-public-api Events 00025 * \ingroup mbed-os-public 00026 * @{ 00027 */ 00028 00029 /** Event 00030 * 00031 * Representation of an event for fine-grain dispatch control 00032 */ 00033 template <typename F> 00034 class Event; 00035 00036 /** 00037 * \defgroup events_Event Event<void()> class 00038 * @{ 00039 */ 00040 00041 /** Event 00042 * 00043 * Representation of an event for fine-grain dispatch control 00044 */ 00045 template <typename... ArgTs> 00046 class Event<void(ArgTs...)> { 00047 public: 00048 /** Create an event 00049 * 00050 * Constructs an event bound to the specified event queue. The specified 00051 * callback acts as the target for the event and is executed in the 00052 * context of the event queue's dispatch loop once posted. 00053 * 00054 * @param q Event queue to dispatch on 00055 * @param f Function to execute when the event is dispatched 00056 */ 00057 template <typename F> 00058 Event(EventQueue *q, F f) 00059 { 00060 _event = static_cast<struct event *>( 00061 equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F))); 00062 00063 if (_event) { 00064 _event->equeue = &q->_equeue; 00065 _event->id = 0; 00066 _event->delay = 0; 00067 _event->period = -1; 00068 00069 _event->post = &Event::event_post<F>; 00070 _event->dtor = &Event::event_dtor<F>; 00071 00072 new (_event + 1) F(f); 00073 00074 _event->ref = 1; 00075 } 00076 } 00077 00078 /** Copy constructor for events 00079 */ 00080 Event(const Event &e) 00081 { 00082 _event = 0; 00083 if (e._event) { 00084 _event = e._event; 00085 _event->ref += 1; 00086 } 00087 } 00088 00089 /** Assignment operator for events 00090 */ 00091 Event &operator=(const Event &that) 00092 { 00093 if (this != &that) { 00094 this->~Event(); 00095 new (this) Event(that); 00096 } 00097 00098 return *this; 00099 } 00100 00101 /** Destructor for events 00102 */ 00103 ~Event() 00104 { 00105 if (_event) { 00106 _event->ref -= 1; 00107 if (_event->ref == 0) { 00108 _event->dtor(_event); 00109 equeue_dealloc(_event->equeue, _event); 00110 } 00111 } 00112 } 00113 00114 /** Configure the delay of an event 00115 * 00116 * @param delay Millisecond delay before dispatching the event 00117 */ 00118 void delay(int delay) 00119 { 00120 if (_event) { 00121 _event->delay = delay; 00122 } 00123 } 00124 00125 /** Configure the period of an event 00126 * 00127 * @param period Millisecond period for repeatedly dispatching an event 00128 */ 00129 void period(int period) 00130 { 00131 if (_event) { 00132 _event->period = period; 00133 } 00134 } 00135 00136 /** Posts an event onto the underlying event queue 00137 * 00138 * The event is posted to the underlying queue and is executed in the 00139 * context of the event queue's dispatch loop. 00140 * 00141 * The post function is IRQ safe and can act as a mechanism for moving 00142 * events out of IRQ contexts. 00143 * 00144 * @param args Arguments to pass to the event 00145 * @return A unique id that represents the posted event and can 00146 * be passed to EventQueue::cancel, or an id of 0 if 00147 * there is not enough memory to allocate the event. 00148 */ 00149 int post(ArgTs... args) const 00150 { 00151 if (!_event) { 00152 return 0; 00153 } 00154 00155 _event->id = _event->post(_event, args...); 00156 return _event->id; 00157 } 00158 00159 /** Posts an event onto the underlying event queue, returning void 00160 * 00161 * @param args Arguments to pass to the event 00162 */ 00163 void call(ArgTs... args) const 00164 { 00165 MBED_UNUSED int id = post(args...); 00166 MBED_ASSERT(id); 00167 } 00168 00169 /** Posts an event onto the underlying event queue, returning void 00170 * 00171 * @param args Arguments to pass to the event 00172 */ 00173 void operator()(ArgTs... args) const 00174 { 00175 return call(args...); 00176 } 00177 00178 /** Static thunk for passing as C-style function 00179 * 00180 * @param func Event to call passed as a void pointer 00181 * @param args Arguments to pass to the event 00182 */ 00183 static void thunk(void *func, ArgTs... args) 00184 { 00185 return static_cast<Event *>(func)->call(args...); 00186 } 00187 00188 /** Cancels the most recently posted event 00189 * 00190 * Attempts to cancel the most recently posted event. It is safe to call 00191 * cancel after an event has already been dispatched. 00192 * 00193 * The cancel function is IRQ safe. 00194 * 00195 * If called while the event queue's dispatch loop is active, the cancel 00196 * function does not guarantee that the event will not execute after it 00197 * returns, as the event may have already begun executing. 00198 */ 00199 void cancel() const 00200 { 00201 if (_event) { 00202 equeue_cancel(_event->equeue, _event->id); 00203 } 00204 } 00205 00206 private: 00207 struct event { 00208 unsigned ref; 00209 equeue_t *equeue; 00210 int id; 00211 00212 int delay; 00213 int period; 00214 00215 int (*post)(struct event *, ArgTs... args); 00216 void (*dtor)(struct event *); 00217 00218 // F follows 00219 } *_event; 00220 00221 // Event attributes 00222 template <typename F> 00223 static int event_post(struct event *e, ArgTs... args) 00224 { 00225 typedef EventQueue::context<F, ArgTs...> C; 00226 void *p = equeue_alloc(e->equeue, sizeof(C)); 00227 if (!p) { 00228 return 0; 00229 } 00230 00231 new (p) C(*(F *)(e + 1), args...); 00232 equeue_event_delay(p, e->delay); 00233 equeue_event_period(p, e->period); 00234 equeue_event_dtor(p, &EventQueue::function_dtor<C>); 00235 return equeue_post(e->equeue, &EventQueue::function_call<C>, p); 00236 } 00237 00238 template <typename F> 00239 static void event_dtor(struct event *e) 00240 { 00241 ((F *)(e + 1))->~F(); 00242 } 00243 00244 public: 00245 /** Create an event 00246 * @param q Event queue to dispatch on 00247 * @param f Function to execute when the event is dispatched 00248 * @param context_args Arguments to bind to the callback, these arguments are 00249 * allocated on an IRQ-safe allocator from the event queue's 00250 * memory pool. Must be type-compatible with bound_args, the 00251 * arguments to the underlying callback. 00252 */ 00253 template <typename F, typename... ContextArgTs> 00254 Event(EventQueue *q, F f, ContextArgTs... context_args) : 00255 Event(q, EventQueue::context<F, ContextArgTs...>(f, context_args...)) { } 00256 00257 /** Create an event 00258 * @see Event::Event 00259 */ 00260 template <typename T, typename R, typename B0> 00261 Event(EventQueue *q, T *obj, R(T::*method)(B0, ArgTs...), B0 b0) : 00262 Event(q, mbed::callback(obj, method), b0) { } 00263 00264 /** Create an event 00265 * @see Event::Event 00266 */ 00267 template <typename T, typename R, typename B0> 00268 Event(EventQueue *q, const T *obj, R(T::*method)(B0, ArgTs...) const, B0 b0) : 00269 Event(q, mbed::callback(obj, method), b0) { } 00270 00271 /** Create an event 00272 * @see Event::Event 00273 */ 00274 template <typename T, typename R, typename B0> 00275 Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, ArgTs...) volatile, B0 b0) : 00276 Event(q, mbed::callback(obj, method), b0) { } 00277 00278 /** Create an event 00279 * @see Event::Event 00280 */ 00281 template <typename T, typename R, typename B0> 00282 Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, ArgTs...) const volatile, B0 b0) : 00283 Event(q, mbed::callback(obj, method), b0) { } 00284 00285 /** Create an event 00286 * @see Event::Event 00287 */ 00288 template <typename T, typename R, typename B0, typename B1> 00289 Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, ArgTs...), B0 b0, B1 b1) : 00290 Event(q, mbed::callback(obj, method), b0, b1) { } 00291 00292 /** Create an event 00293 * @see Event::Event 00294 */ 00295 template <typename T, typename R, typename B0, typename B1> 00296 Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, ArgTs...) const, B0 b0, B1 b1) : 00297 Event(q, mbed::callback(obj, method), b0, b1) { } 00298 00299 /** Create an event 00300 * @see Event::Event 00301 */ 00302 template <typename T, typename R, typename B0, typename B1> 00303 Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, ArgTs...) volatile, B0 b0, B1 b1) : 00304 Event(q, mbed::callback(obj, method), b0, b1) { } 00305 00306 /** Create an event 00307 * @see Event::Event 00308 */ 00309 template <typename T, typename R, typename B0, typename B1> 00310 Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1, ArgTs...) const volatile, B0 b0, B1 b1) : 00311 Event(q, mbed::callback(obj, method), b0, b1) { } 00312 00313 /** Create an event 00314 * @see Event::Event 00315 */ 00316 template <typename T, typename R, typename B0, typename B1, typename B2> 00317 Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, ArgTs...), B0 b0, B1 b1, B2 b2) : 00318 Event(q, mbed::callback(obj, method), b0, b1, b2) { } 00319 00320 /** Create an event 00321 * @see Event::Event 00322 */ 00323 template <typename T, typename R, typename B0, typename B1, typename B2> 00324 Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, B2, ArgTs...) const, B0 b0, B1 b1, B2 b2) : 00325 Event(q, mbed::callback(obj, method), b0, b1, b2) { } 00326 00327 /** Create an event 00328 * @see Event::Event 00329 */ 00330 template <typename T, typename R, typename B0, typename B1, typename B2> 00331 Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, B2, ArgTs...) volatile, B0 b0, B1 b1, B2 b2) : 00332 Event(q, mbed::callback(obj, method), b0, b1, b2) { } 00333 00334 /** Create an event 00335 * @see Event::Event 00336 */ 00337 template <typename T, typename R, typename B0, typename B1, typename B2> 00338 Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1, B2, ArgTs...) const volatile, B0 b0, B1 b1, B2 b2) : 00339 Event(q, mbed::callback(obj, method), b0, b1, b2) { } 00340 00341 /** Create an event 00342 * @see Event::Event 00343 */ 00344 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3> 00345 Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, B3, ArgTs...), B0 b0, B1 b1, B2 b2, B3 b3) : 00346 Event(q, mbed::callback(obj, method), b0, b1, b2, b3) { } 00347 00348 /** Create an event 00349 * @see Event::Event 00350 */ 00351 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3> 00352 Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, B2, B3, ArgTs...) const, B0 b0, B1 b1, B2 b2, B3 b3) : 00353 Event(q, mbed::callback(obj, method), b0, b1, b2, b3) { } 00354 00355 /** Create an event 00356 * @see Event::Event 00357 */ 00358 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3> 00359 Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, B2, B3, ArgTs...) volatile, B0 b0, B1 b1, B2 b2, B3 b3) : 00360 Event(q, mbed::callback(obj, method), b0, b1, b2, b3) { } 00361 00362 /** Create an event 00363 * @see Event::Event 00364 */ 00365 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3> 00366 Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1, B2, B3, ArgTs...) const volatile, B0 b0, B1 b1, B2 b2, B3 b3) : 00367 Event(q, mbed::callback(obj, method), b0, b1, b2, b3) { } 00368 00369 /** Create an event 00370 * @see Event::Event 00371 */ 00372 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4> 00373 Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, B3, B4, ArgTs...), B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) : 00374 Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4) { } 00375 00376 /** Create an event 00377 * @see Event::Event 00378 */ 00379 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4> 00380 Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, B2, B3, B4, ArgTs...) const, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) : 00381 Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4) { } 00382 00383 /** Create an event 00384 * @see Event::Event 00385 */ 00386 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4> 00387 Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, B2, B3, B4, ArgTs...) volatile, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) : 00388 Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4) { } 00389 00390 /** Create an event 00391 * @see Event::Event 00392 */ 00393 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4> 00394 Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1, B2, B3, B4, ArgTs...) const volatile, B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) : 00395 Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4) { } 00396 }; 00397 00398 /** @}*/ 00399 00400 00401 // Convenience functions declared here to avoid cyclic 00402 // dependency between Event and EventQueue 00403 template <typename R, typename... ArgTs> 00404 Event<void(ArgTs...)> EventQueue::event(R(*func)(ArgTs...)) 00405 { 00406 return Event<void(ArgTs...)>(this, func); 00407 } 00408 00409 template <typename T, typename R, typename... ArgTs> 00410 Event<void(ArgTs...)> EventQueue::event(T *obj, R(T::*method)(ArgTs...)) 00411 { 00412 return Event<void(ArgTs...)>(this, mbed::callback(obj, method)); 00413 } 00414 00415 template <typename T, typename R, typename... ArgTs> 00416 Event<void(ArgTs...)> EventQueue::event(const T *obj, R(T::*method)(ArgTs...) const) 00417 { 00418 return Event<void(ArgTs...)>(this, mbed::callback(obj, method)); 00419 } 00420 00421 template <typename T, typename R, typename... ArgTs> 00422 Event<void(ArgTs...)> EventQueue::event(volatile T *obj, R(T::*method)(ArgTs...) volatile) 00423 { 00424 return Event<void(ArgTs...)>(this, mbed::callback(obj, method)); 00425 } 00426 00427 template <typename T, typename R, typename... ArgTs> 00428 Event<void(ArgTs...)> EventQueue::event(const volatile T *obj, R(T::*method)(ArgTs...) const volatile) 00429 { 00430 return Event<void(ArgTs...)>(this, mbed::callback(obj, method)); 00431 } 00432 00433 template <typename R, typename... ArgTs> 00434 Event<void(ArgTs...)> EventQueue::event(mbed::Callback<R(ArgTs...)> cb) 00435 { 00436 return Event<void(ArgTs...)>(this, cb); 00437 } 00438 00439 template <typename R, typename B0, typename C0, typename... ArgTs> 00440 Event<void(ArgTs...)> EventQueue::event(R(*func)(B0, ArgTs...), C0 c0) 00441 { 00442 return Event<void(ArgTs...)>(this, func, c0); 00443 } 00444 00445 template <typename T, typename R, typename B0, typename C0, typename... ArgTs> 00446 Event<void(ArgTs...)> EventQueue::event(T *obj, R(T::*method)(B0, ArgTs...), C0 c0) 00447 { 00448 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0); 00449 } 00450 00451 template <typename T, typename R, typename B0, typename C0, typename... ArgTs> 00452 Event<void(ArgTs...)> EventQueue::event(const T *obj, R(T::*method)(B0, ArgTs...) const, C0 c0) 00453 { 00454 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0); 00455 } 00456 00457 template <typename T, typename R, typename B0, typename C0, typename... ArgTs> 00458 Event<void(ArgTs...)> EventQueue::event(volatile T *obj, R(T::*method)(B0, ArgTs...) volatile, C0 c0) 00459 { 00460 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0); 00461 } 00462 00463 template <typename T, typename R, typename B0, typename C0, typename... ArgTs> 00464 Event<void(ArgTs...)> EventQueue::event(const volatile T *obj, R(T::*method)(B0, ArgTs...) const volatile, C0 c0) 00465 { 00466 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0); 00467 } 00468 00469 template <typename R, typename B0, typename C0, typename... ArgTs> 00470 Event<void(ArgTs...)> EventQueue::event(mbed::Callback<R(B0, ArgTs...)> cb, C0 c0) 00471 { 00472 return Event<void(ArgTs...)>(this, cb, c0); 00473 } 00474 00475 template <typename R, typename B0, typename B1, typename C0, typename C1, typename... ArgTs> 00476 Event<void(ArgTs...)> EventQueue::event(R(*func)(B0, B1, ArgTs...), C0 c0, C1 c1) 00477 { 00478 return Event<void(ArgTs...)>(this, func, c0, c1); 00479 } 00480 00481 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename... ArgTs> 00482 Event<void(ArgTs...)> EventQueue::event(T *obj, R(T::*method)(B0, B1, ArgTs...), C0 c0, C1 c1) 00483 { 00484 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1); 00485 } 00486 00487 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename... ArgTs> 00488 Event<void(ArgTs...)> EventQueue::event(const T *obj, R(T::*method)(B0, B1, ArgTs...) const, C0 c0, C1 c1) 00489 { 00490 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1); 00491 } 00492 00493 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename... ArgTs> 00494 Event<void(ArgTs...)> EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, ArgTs...) volatile, C0 c0, C1 c1) 00495 { 00496 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1); 00497 } 00498 00499 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename... ArgTs> 00500 Event<void(ArgTs...)> EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, ArgTs...) const volatile, C0 c0, C1 c1) 00501 { 00502 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1); 00503 } 00504 00505 template <typename R, typename B0, typename B1, typename C0, typename C1, typename... ArgTs> 00506 Event<void(ArgTs...)> EventQueue::event(mbed::Callback<R(B0, B1, ArgTs...)> cb, C0 c0, C1 c1) 00507 { 00508 return Event<void(ArgTs...)>(this, cb, c0, c1); 00509 } 00510 00511 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename... ArgTs> 00512 Event<void(ArgTs...)> EventQueue::event(R(*func)(B0, B1, B2, ArgTs...), C0 c0, C1 c1, C2 c2) 00513 { 00514 return Event<void(ArgTs...)>(this, func, c0, c1, c2); 00515 } 00516 00517 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename... ArgTs> 00518 Event<void(ArgTs...)> EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, ArgTs...), C0 c0, C1 c1, C2 c2) 00519 { 00520 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1, c2); 00521 } 00522 00523 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename... ArgTs> 00524 Event<void(ArgTs...)> EventQueue::event(const T *obj, R(T::*method)(B0, B1, B2, ArgTs...) const, C0 c0, C1 c1, C2 c2) 00525 { 00526 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1, c2); 00527 } 00528 00529 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename... ArgTs> 00530 Event<void(ArgTs...)> EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, B2, ArgTs...) volatile, C0 c0, C1 c1, C2 c2) 00531 { 00532 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1, c2); 00533 } 00534 00535 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename... ArgTs> 00536 Event<void(ArgTs...)> EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, B2, ArgTs...) const volatile, C0 c0, C1 c1, C2 c2) 00537 { 00538 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1, c2); 00539 } 00540 00541 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename... ArgTs> 00542 Event<void(ArgTs...)> EventQueue::event(mbed::Callback<R(B0, B1, B2, ArgTs...)> cb, C0 c0, C1 c1, C2 c2) 00543 { 00544 return Event<void(ArgTs...)>(this, cb, c0, c1, c2); 00545 } 00546 00547 template <typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename... ArgTs> 00548 Event<void(ArgTs...)> EventQueue::event(R(*func)(B0, B1, B2, B3, ArgTs...), C0 c0, C1 c1, C2 c2, C3 c3) 00549 { 00550 return Event<void(ArgTs...)>(this, func, c0, c1, c2, c3); 00551 } 00552 00553 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename... ArgTs> 00554 Event<void(ArgTs...)> EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, B3, ArgTs...), C0 c0, C1 c1, C2 c2, C3 c3) 00555 { 00556 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1, c2, c3); 00557 } 00558 00559 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename... ArgTs> 00560 Event<void(ArgTs...)> EventQueue::event(const T *obj, R(T::*method)(B0, B1, B2, B3, ArgTs...) const, C0 c0, C1 c1, C2 c2, C3 c3) 00561 { 00562 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1, c2, c3); 00563 } 00564 00565 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename... ArgTs> 00566 Event<void(ArgTs...)> EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, B2, B3, ArgTs...) volatile, C0 c0, C1 c1, C2 c2, C3 c3) 00567 { 00568 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1, c2, c3); 00569 } 00570 00571 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename... ArgTs> 00572 Event<void(ArgTs...)> EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, B2, B3, ArgTs...) const volatile, C0 c0, C1 c1, C2 c2, C3 c3) 00573 { 00574 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1, c2, c3); 00575 } 00576 00577 template <typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename... ArgTs> 00578 Event<void(ArgTs...)> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3, ArgTs...)> cb, C0 c0, C1 c1, C2 c2, C3 c3) 00579 { 00580 return Event<void(ArgTs...)>(this, cb, c0, c1, c2, c3); 00581 } 00582 00583 template <typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename... ArgTs> 00584 Event<void(ArgTs...)> EventQueue::event(R(*func)(B0, B1, B2, B3, B4, ArgTs...), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) 00585 { 00586 return Event<void(ArgTs...)>(this, func, c0, c1, c2, c3, c4); 00587 } 00588 00589 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... ArgTs> 00590 Event<void(ArgTs...)> EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, B3, B4, ArgTs...), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) 00591 { 00592 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); 00593 } 00594 00595 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... ArgTs> 00596 Event<void(ArgTs...)> EventQueue::event(const T *obj, R(T::*method)(B0, B1, B2, B3, B4, ArgTs...) const, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) 00597 { 00598 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); 00599 } 00600 00601 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... ArgTs> 00602 Event<void(ArgTs...)> EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, B2, B3, B4, ArgTs...) volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) 00603 { 00604 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); 00605 } 00606 00607 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... ArgTs> 00608 Event<void(ArgTs...)> EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, B2, B3, B4, ArgTs...) const volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) 00609 { 00610 return Event<void(ArgTs...)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); 00611 } 00612 00613 template <typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4, typename... ArgTs> 00614 Event<void(ArgTs...)> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3, B4, ArgTs...)> cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) 00615 { 00616 return Event<void(ArgTs...)>(this, cb, c0, c1, c2, c3, c4); 00617 } 00618 00619 /** @}*/ 00620 } 00621 #endif
Generated on Tue Jul 12 2022 13:54:19 by
