Daiki Kato / mbed-os-lychee

Dependents:   mbed-os-example-blinky-gr-lychee GR-Boads_Camera_sample GR-Boards_Audio_Recoder GR-Boads_Camera_DisplayApp ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Event.h Source File

Event.h

00001 /* events
00002  * Copyright (c) 2016 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef EVENT_H
00017 #define EVENT_H
00018 
00019 #include "events/EventQueue.h"
00020 #include "platform/mbed_assert.h"
00021 
00022 namespace events {
00023 /** \addtogroup events */
00024 /** @{*/
00025 
00026 /** Event
00027  *
00028  *  Representation of an event for fine-grain dispatch control
00029  */
00030 template <typename F>
00031 class Event;
00032 
00033 /** Event
00034  *
00035  *  Representation of an event for fine-grain dispatch control
00036  */
00037 template <>
00038 class Event<void()> {
00039 public:
00040     /** Create an event
00041      *
00042      *  Constructs an event bound to the specified event queue. The specified
00043      *  callback acts as the target for the event and is executed in the
00044      *  context of the event queue's dispatch loop once posted.
00045      *
00046      *  @param q        Event queue to dispatch on
00047      *  @param f        Function to execute when the event is dispatched
00048      *  @param c0..c4   Arguments to bind to the callback, these arguments are
00049      *                  allocated on an irq-safe allocator from the event queue's
00050      *                  memory pool. Must be type-compatible with b0..b4, the
00051      *                  arguments to the underlying callback.
00052      */
00053     template <typename F>
00054     Event(EventQueue *q, F f) {
00055         _event = static_cast<struct event *>(
00056                 equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F)));
00057 
00058         if (_event) {
00059             _event->equeue = &q->_equeue;
00060             _event->id = 0;
00061             _event->delay = 0;
00062             _event->period = -1;
00063 
00064             _event->post = &Event::event_post<F>;
00065             _event->dtor = &Event::event_dtor<F>;
00066 
00067             new (_event+1) F(f);
00068 
00069             _event->ref = 1;
00070         }
00071     }
00072 
00073     /** Copy constructor for events
00074      */
00075     Event(const Event &e) {
00076         _event = 0;
00077         if (e._event) {
00078             _event = e._event;
00079             _event->ref += 1;
00080         }
00081     }
00082 
00083     /** Assignment operator for events
00084      */
00085     Event &operator=(const Event &that) {
00086         if (this != &that) {
00087             this->~Event();
00088             new (this) Event(that);
00089         }
00090 
00091         return *this;
00092     }
00093 
00094     /** Destructor for events
00095      */
00096     ~Event() {
00097         if (_event) {
00098             _event->ref -= 1;
00099             if (_event->ref == 0) {
00100                 _event->dtor(_event);
00101                 equeue_dealloc(_event->equeue, _event);
00102             }
00103         }
00104     }
00105 
00106     /** Configure the delay of an event
00107      *
00108      *  @param delay    Millisecond delay before dispatching the event
00109      */
00110     void delay(int delay) {
00111         if (_event) {
00112             _event->delay = delay;
00113         }
00114     }
00115 
00116     /** Configure the period of an event
00117      *
00118      *  @param period   Millisecond period for repeatedly dispatching an event
00119      */
00120     void period(int period) {
00121         if (_event) {
00122             _event->period = period;
00123         }
00124     }
00125 
00126     /** Posts an event onto the underlying event queue
00127      *
00128      *  The event is posted to the underlying queue and is executed in the
00129      *  context of the event queue's dispatch loop.
00130      *
00131      *  The post function is irq safe and can act as a mechanism for moving
00132      *  events out of irq contexts.
00133      *
00134      *  @param a0..a4   Arguments to pass to the event
00135      *  @return         A unique id that represents the posted event and can
00136      *                  be passed to EventQueue::cancel, or an id of 0 if
00137      *                  there is not enough memory to allocate the event.
00138      */
00139     int post() const {
00140         if (!_event) {
00141             return 0;
00142         }
00143 
00144         _event->id = _event->post(_event);
00145         return _event->id;
00146     }
00147 
00148     /** Posts an event onto the underlying event queue, returning void
00149      *
00150      *  @param a0..a4   Arguments to pass to the event
00151      */
00152     void call() const {
00153         MBED_UNUSED int id = post();
00154         MBED_ASSERT(id);
00155     }
00156 
00157     /** Posts an event onto the underlying event queue, returning void
00158      *
00159      *  @param a0..a4   Arguments to pass to the event
00160      */
00161     void operator()() const {
00162         return call();
00163     }
00164 
00165     /** Static thunk for passing as C-style function
00166      *
00167      *  @param func     Event to call passed as a void pointer
00168      *  @param a0..a4   Arguments to pass to the event
00169      */
00170     static void thunk(void *func) {
00171         return static_cast<Event*>(func)->call();
00172     }
00173 
00174     /** Cancels the most recently posted event
00175      *
00176      *  Attempts to cancel the most recently posted event. It is safe to call
00177      *  cancel after an event has already been dispatched.
00178      *
00179      *  The cancel function is irq safe.
00180      *
00181      *  If called while the event queue's dispatch loop is active, the cancel
00182      *  function does not garuntee that the event will not execute after it
00183      *  returns, as the event may have already begun executing.
00184      */
00185     void cancel() const {
00186         if (_event) {
00187             equeue_cancel(_event->equeue, _event->id);
00188         }
00189     }
00190 
00191 private:
00192     struct event {
00193         unsigned ref;
00194         equeue_t *equeue;
00195         int id;
00196 
00197         int delay;
00198         int period;
00199 
00200         int (*post)(struct event *);
00201         void (*dtor)(struct event *);
00202 
00203         // F follows
00204     } *_event;
00205 
00206     // Event attributes
00207     template <typename F>
00208     static int event_post(struct event *e) {
00209         typedef EventQueue::context00<F> C;
00210         void *p = equeue_alloc(e->equeue, sizeof(C));
00211         if (!p) {
00212             return 0;
00213         }
00214 
00215         new (p) C(*(F*)(e + 1));
00216         equeue_event_delay(p, e->delay);
00217         equeue_event_period(p, e->period);
00218         equeue_event_dtor(p, &EventQueue::function_dtor<C>);
00219         return equeue_post(e->equeue, &EventQueue::function_call<C>, p);
00220     }
00221 
00222     template <typename F>
00223     static void event_dtor(struct event *e) {
00224         ((F*)(e + 1))->~F();
00225     }
00226 
00227 public:
00228     /** Create an event
00229      *  @see Event::Event
00230      */
00231     template <typename F, typename C0>
00232     Event(EventQueue *q, F f, C0 c0) {
00233         new (this) Event(q, EventQueue::context10<F, C0>(f, c0));
00234     }
00235 
00236     /** Create an event
00237      *  @see Event::Event
00238      */
00239     template <typename F, typename C0, typename C1>
00240     Event(EventQueue *q, F f, C0 c0, C1 c1) {
00241         new (this) Event(q, EventQueue::context20<F, C0, C1>(f, c0, c1));
00242     }
00243 
00244     /** Create an event
00245      *  @see Event::Event
00246      */
00247     template <typename F, typename C0, typename C1, typename C2>
00248     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) {
00249         new (this) Event(q, EventQueue::context30<F, C0, C1, C2>(f, c0, c1, c2));
00250     }
00251 
00252     /** Create an event
00253      *  @see Event::Event
00254      */
00255     template <typename F, typename C0, typename C1, typename C2, typename C3>
00256     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) {
00257         new (this) Event(q, EventQueue::context40<F, C0, C1, C2, C3>(f, c0, c1, c2, c3));
00258     }
00259 
00260     /** Create an event
00261      *  @see Event::Event
00262      */
00263     template <typename F, typename C0, typename C1, typename C2, typename C3, typename C4>
00264     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
00265         new (this) Event(q, EventQueue::context50<F, C0, C1, C2, C3, C4>(f, c0, c1, c2, c3, c4));
00266     }
00267 
00268     /** Create an event
00269      *  @see Event::Event
00270      */
00271     template <typename T, typename R, typename B0>
00272     Event(EventQueue *q, T *obj, R (T::*method)(B0), B0 b0) {
00273         new (this) Event(q, mbed::callback(obj, method), b0);
00274     }
00275 
00276     /** Create an event
00277      *  @see Event::Event
00278      */
00279     template <typename T, typename R, typename B0>
00280     Event(EventQueue *q, const T *obj, R (T::*method)(B0) const, B0 b0) {
00281         new (this) Event(q, mbed::callback(obj, method), b0);
00282     }
00283 
00284     /** Create an event
00285      *  @see Event::Event
00286      */
00287     template <typename T, typename R, typename B0>
00288     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0) volatile, B0 b0) {
00289         new (this) Event(q, mbed::callback(obj, method), b0);
00290     }
00291 
00292     /** Create an event
00293      *  @see Event::Event
00294      */
00295     template <typename T, typename R, typename B0>
00296     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0) const volatile, B0 b0) {
00297         new (this) Event(q, mbed::callback(obj, method), b0);
00298     }
00299 
00300     /** Create an event
00301      *  @see Event::Event
00302      */
00303     template <typename T, typename R, typename B0, typename B1>
00304     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1), B0 b0, B1 b1) {
00305         new (this) Event(q, mbed::callback(obj, method), b0, b1);
00306     }
00307 
00308     /** Create an event
00309      *  @see Event::Event
00310      */
00311     template <typename T, typename R, typename B0, typename B1>
00312     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1) const, B0 b0, B1 b1) {
00313         new (this) Event(q, mbed::callback(obj, method), b0, b1);
00314     }
00315 
00316     /** Create an event
00317      *  @see Event::Event
00318      */
00319     template <typename T, typename R, typename B0, typename B1>
00320     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1) volatile, B0 b0, B1 b1) {
00321         new (this) Event(q, mbed::callback(obj, method), b0, b1);
00322     }
00323 
00324     /** Create an event
00325      *  @see Event::Event
00326      */
00327     template <typename T, typename R, typename B0, typename B1>
00328     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1) const volatile, B0 b0, B1 b1) {
00329         new (this) Event(q, mbed::callback(obj, method), b0, b1);
00330     }
00331 
00332     /** Create an event
00333      *  @see Event::Event
00334      */
00335     template <typename T, typename R, typename B0, typename B1, typename B2>
00336     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2), B0 b0, B1 b1, B2 b2) {
00337         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
00338     }
00339 
00340     /** Create an event
00341      *  @see Event::Event
00342      */
00343     template <typename T, typename R, typename B0, typename B1, typename B2>
00344     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2) const, B0 b0, B1 b1, B2 b2) {
00345         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
00346     }
00347 
00348     /** Create an event
00349      *  @see Event::Event
00350      */
00351     template <typename T, typename R, typename B0, typename B1, typename B2>
00352     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2) volatile, B0 b0, B1 b1, B2 b2) {
00353         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
00354     }
00355 
00356     /** Create an event
00357      *  @see Event::Event
00358      */
00359     template <typename T, typename R, typename B0, typename B1, typename B2>
00360     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2) const volatile, B0 b0, B1 b1, B2 b2) {
00361         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
00362     }
00363 
00364     /** Create an event
00365      *  @see Event::Event
00366      */
00367     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
00368     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3), B0 b0, B1 b1, B2 b2, B3 b3) {
00369         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
00370     }
00371 
00372     /** Create an event
00373      *  @see Event::Event
00374      */
00375     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
00376     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3) const, B0 b0, B1 b1, B2 b2, B3 b3) {
00377         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
00378     }
00379 
00380     /** Create an event
00381      *  @see Event::Event
00382      */
00383     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
00384     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3) volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
00385         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
00386     }
00387 
00388     /** Create an event
00389      *  @see Event::Event
00390      */
00391     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
00392     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, B3) const volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
00393         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
00394     }
00395 
00396     /** Create an event
00397      *  @see Event::Event
00398      */
00399     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
00400     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, B4), B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
00401         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
00402     }
00403 
00404     /** Create an event
00405      *  @see Event::Event
00406      */
00407     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
00408     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) {
00409         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
00410     }
00411 
00412     /** Create an event
00413      *  @see Event::Event
00414      */
00415     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
00416     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) {
00417         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
00418     }
00419 
00420     /** Create an event
00421      *  @see Event::Event
00422      */
00423     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
00424     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) {
00425         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
00426     }
00427 };
00428 
00429 /** Event
00430  *
00431  *  Representation of an event for fine-grain dispatch control
00432  */
00433 template <typename A0>
00434 class Event<void(A0)> {
00435 public:
00436     /** Create an event
00437      *
00438      *  Constructs an event bound to the specified event queue. The specified
00439      *  callback acts as the target for the event and is executed in the
00440      *  context of the event queue's dispatch loop once posted.
00441      *
00442      *  @param q        Event queue to dispatch on
00443      *  @param f        Function to execute when the event is dispatched
00444      *  @param c0..c4   Arguments to bind to the callback, these arguments are
00445      *                  allocated on an irq-safe allocator from the event queue's
00446      *                  memory pool. Must be type-compatible with b0..b4, the
00447      *                  arguments to the underlying callback.
00448      */
00449     template <typename F>
00450     Event(EventQueue *q, F f) {
00451         _event = static_cast<struct event *>(
00452                 equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F)));
00453 
00454         if (_event) {
00455             _event->equeue = &q->_equeue;
00456             _event->id = 0;
00457             _event->delay = 0;
00458             _event->period = -1;
00459 
00460             _event->post = &Event::event_post<F>;
00461             _event->dtor = &Event::event_dtor<F>;
00462 
00463             new (_event+1) F(f);
00464 
00465             _event->ref = 1;
00466         }
00467     }
00468 
00469     /** Copy constructor for events
00470      */
00471     Event(const Event &e) {
00472         _event = 0;
00473         if (e._event) {
00474             _event = e._event;
00475             _event->ref += 1;
00476         }
00477     }
00478 
00479     /** Assignment operator for events
00480      */
00481     Event &operator=(const Event &that) {
00482         if (this != &that) {
00483             this->~Event();
00484             new (this) Event(that);
00485         }
00486 
00487         return *this;
00488     }
00489 
00490     /** Destructor for events
00491      */
00492     ~Event() {
00493         if (_event) {
00494             _event->ref -= 1;
00495             if (_event->ref == 0) {
00496                 _event->dtor(_event);
00497                 equeue_dealloc(_event->equeue, _event);
00498             }
00499         }
00500     }
00501 
00502     /** Configure the delay of an event
00503      *
00504      *  @param delay    Millisecond delay before dispatching the event
00505      */
00506     void delay(int delay) {
00507         if (_event) {
00508             _event->delay = delay;
00509         }
00510     }
00511 
00512     /** Configure the period of an event
00513      *
00514      *  @param period   Millisecond period for repeatedly dispatching an event
00515      */
00516     void period(int period) {
00517         if (_event) {
00518             _event->period = period;
00519         }
00520     }
00521 
00522     /** Posts an event onto the underlying event queue
00523      *
00524      *  The event is posted to the underlying queue and is executed in the
00525      *  context of the event queue's dispatch loop.
00526      *
00527      *  The post function is irq safe and can act as a mechanism for moving
00528      *  events out of irq contexts.
00529      *
00530      *  @param a0..a4   Arguments to pass to the event
00531      *  @return         A unique id that represents the posted event and can
00532      *                  be passed to EventQueue::cancel, or an id of 0 if
00533      *                  there is not enough memory to allocate the event.
00534      */
00535     int post(A0 a0) const {
00536         if (!_event) {
00537             return 0;
00538         }
00539 
00540         _event->id = _event->post(_event, a0);
00541         return _event->id;
00542     }
00543 
00544     /** Posts an event onto the underlying event queue, returning void
00545      *
00546      *  @param a0..a4   Arguments to pass to the event
00547      */
00548     void call(A0 a0) const {
00549         MBED_UNUSED int id = post(a0);
00550         MBED_ASSERT(id);
00551     }
00552 
00553     /** Posts an event onto the underlying event queue, returning void
00554      *
00555      *  @param a0..a4   Arguments to pass to the event
00556      */
00557     void operator()(A0 a0) const {
00558         return call(a0);
00559     }
00560 
00561     /** Static thunk for passing as C-style function
00562      *
00563      *  @param func     Event to call passed as a void pointer
00564      *  @param a0..a4   Arguments to pass to the event
00565      */
00566     static void thunk(void *func, A0 a0) {
00567         return static_cast<Event*>(func)->call(a0);
00568     }
00569 
00570     /** Cancels the most recently posted event
00571      *
00572      *  Attempts to cancel the most recently posted event. It is safe to call
00573      *  cancel after an event has already been dispatched.
00574      *
00575      *  The cancel function is irq safe.
00576      *
00577      *  If called while the event queue's dispatch loop is active, the cancel
00578      *  function does not garuntee that the event will not execute after it
00579      *  returns, as the event may have already begun executing.
00580      */
00581     void cancel() const {
00582         if (_event) {
00583             equeue_cancel(_event->equeue, _event->id);
00584         }
00585     }
00586 
00587 private:
00588     struct event {
00589         unsigned ref;
00590         equeue_t *equeue;
00591         int id;
00592 
00593         int delay;
00594         int period;
00595 
00596         int (*post)(struct event *, A0 a0);
00597         void (*dtor)(struct event *);
00598 
00599         // F follows
00600     } *_event;
00601 
00602     // Event attributes
00603     template <typename F>
00604     static int event_post(struct event *e, A0 a0) {
00605         typedef EventQueue::context10<F, A0> C;
00606         void *p = equeue_alloc(e->equeue, sizeof(C));
00607         if (!p) {
00608             return 0;
00609         }
00610 
00611         new (p) C(*(F*)(e + 1), a0);
00612         equeue_event_delay(p, e->delay);
00613         equeue_event_period(p, e->period);
00614         equeue_event_dtor(p, &EventQueue::function_dtor<C>);
00615         return equeue_post(e->equeue, &EventQueue::function_call<C>, p);
00616     }
00617 
00618     template <typename F>
00619     static void event_dtor(struct event *e) {
00620         ((F*)(e + 1))->~F();
00621     }
00622 
00623 public:
00624     /** Create an event
00625      *  @see Event::Event
00626      */
00627     template <typename F, typename C0>
00628     Event(EventQueue *q, F f, C0 c0) {
00629         new (this) Event(q, EventQueue::context11<F, C0, A0>(f, c0));
00630     }
00631 
00632     /** Create an event
00633      *  @see Event::Event
00634      */
00635     template <typename F, typename C0, typename C1>
00636     Event(EventQueue *q, F f, C0 c0, C1 c1) {
00637         new (this) Event(q, EventQueue::context21<F, C0, C1, A0>(f, c0, c1));
00638     }
00639 
00640     /** Create an event
00641      *  @see Event::Event
00642      */
00643     template <typename F, typename C0, typename C1, typename C2>
00644     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) {
00645         new (this) Event(q, EventQueue::context31<F, C0, C1, C2, A0>(f, c0, c1, c2));
00646     }
00647 
00648     /** Create an event
00649      *  @see Event::Event
00650      */
00651     template <typename F, typename C0, typename C1, typename C2, typename C3>
00652     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) {
00653         new (this) Event(q, EventQueue::context41<F, C0, C1, C2, C3, A0>(f, c0, c1, c2, c3));
00654     }
00655 
00656     /** Create an event
00657      *  @see Event::Event
00658      */
00659     template <typename F, typename C0, typename C1, typename C2, typename C3, typename C4>
00660     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
00661         new (this) Event(q, EventQueue::context51<F, C0, C1, C2, C3, C4, A0>(f, c0, c1, c2, c3, c4));
00662     }
00663 
00664     /** Create an event
00665      *  @see Event::Event
00666      */
00667     template <typename T, typename R, typename B0>
00668     Event(EventQueue *q, T *obj, R (T::*method)(B0, A0), B0 b0) {
00669         new (this) Event(q, mbed::callback(obj, method), b0);
00670     }
00671 
00672     /** Create an event
00673      *  @see Event::Event
00674      */
00675     template <typename T, typename R, typename B0>
00676     Event(EventQueue *q, const T *obj, R (T::*method)(B0, A0) const, B0 b0) {
00677         new (this) Event(q, mbed::callback(obj, method), b0);
00678     }
00679 
00680     /** Create an event
00681      *  @see Event::Event
00682      */
00683     template <typename T, typename R, typename B0>
00684     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, A0) volatile, B0 b0) {
00685         new (this) Event(q, mbed::callback(obj, method), b0);
00686     }
00687 
00688     /** Create an event
00689      *  @see Event::Event
00690      */
00691     template <typename T, typename R, typename B0>
00692     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, A0) const volatile, B0 b0) {
00693         new (this) Event(q, mbed::callback(obj, method), b0);
00694     }
00695 
00696     /** Create an event
00697      *  @see Event::Event
00698      */
00699     template <typename T, typename R, typename B0, typename B1>
00700     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, A0), B0 b0, B1 b1) {
00701         new (this) Event(q, mbed::callback(obj, method), b0, b1);
00702     }
00703 
00704     /** Create an event
00705      *  @see Event::Event
00706      */
00707     template <typename T, typename R, typename B0, typename B1>
00708     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, A0) const, B0 b0, B1 b1) {
00709         new (this) Event(q, mbed::callback(obj, method), b0, b1);
00710     }
00711 
00712     /** Create an event
00713      *  @see Event::Event
00714      */
00715     template <typename T, typename R, typename B0, typename B1>
00716     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, A0) volatile, B0 b0, B1 b1) {
00717         new (this) Event(q, mbed::callback(obj, method), b0, b1);
00718     }
00719 
00720     /** Create an event
00721      *  @see Event::Event
00722      */
00723     template <typename T, typename R, typename B0, typename B1>
00724     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, A0) const volatile, B0 b0, B1 b1) {
00725         new (this) Event(q, mbed::callback(obj, method), b0, b1);
00726     }
00727 
00728     /** Create an event
00729      *  @see Event::Event
00730      */
00731     template <typename T, typename R, typename B0, typename B1, typename B2>
00732     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, A0), B0 b0, B1 b1, B2 b2) {
00733         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
00734     }
00735 
00736     /** Create an event
00737      *  @see Event::Event
00738      */
00739     template <typename T, typename R, typename B0, typename B1, typename B2>
00740     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, A0) const, B0 b0, B1 b1, B2 b2) {
00741         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
00742     }
00743 
00744     /** Create an event
00745      *  @see Event::Event
00746      */
00747     template <typename T, typename R, typename B0, typename B1, typename B2>
00748     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, A0) volatile, B0 b0, B1 b1, B2 b2) {
00749         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
00750     }
00751 
00752     /** Create an event
00753      *  @see Event::Event
00754      */
00755     template <typename T, typename R, typename B0, typename B1, typename B2>
00756     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, A0) const volatile, B0 b0, B1 b1, B2 b2) {
00757         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
00758     }
00759 
00760     /** Create an event
00761      *  @see Event::Event
00762      */
00763     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
00764     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, A0), B0 b0, B1 b1, B2 b2, B3 b3) {
00765         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
00766     }
00767 
00768     /** Create an event
00769      *  @see Event::Event
00770      */
00771     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
00772     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3, A0) const, B0 b0, B1 b1, B2 b2, B3 b3) {
00773         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
00774     }
00775 
00776     /** Create an event
00777      *  @see Event::Event
00778      */
00779     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
00780     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0) volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
00781         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
00782     }
00783 
00784     /** Create an event
00785      *  @see Event::Event
00786      */
00787     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
00788     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) {
00789         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
00790     }
00791 
00792     /** Create an event
00793      *  @see Event::Event
00794      */
00795     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
00796     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, B4, A0), B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) {
00797         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
00798     }
00799 
00800     /** Create an event
00801      *  @see Event::Event
00802      */
00803     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
00804     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) {
00805         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
00806     }
00807 
00808     /** Create an event
00809      *  @see Event::Event
00810      */
00811     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
00812     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) {
00813         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
00814     }
00815 
00816     /** Create an event
00817      *  @see Event::Event
00818      */
00819     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
00820     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) {
00821         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
00822     }
00823 };
00824 
00825 /** Event
00826  *
00827  *  Representation of an event for fine-grain dispatch control
00828  */
00829 template <typename A0, typename A1>
00830 class Event<void(A0, A1)> {
00831 public:
00832     /** Create an event
00833      *
00834      *  Constructs an event bound to the specified event queue. The specified
00835      *  callback acts as the target for the event and is executed in the
00836      *  context of the event queue's dispatch loop once posted.
00837      *
00838      *  @param q        Event queue to dispatch on
00839      *  @param f        Function to execute when the event is dispatched
00840      *  @param c0..c4   Arguments to bind to the callback, these arguments are
00841      *                  allocated on an irq-safe allocator from the event queue's
00842      *                  memory pool. Must be type-compatible with b0..b4, the
00843      *                  arguments to the underlying callback.
00844      */
00845     template <typename F>
00846     Event(EventQueue *q, F f) {
00847         _event = static_cast<struct event *>(
00848                 equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F)));
00849 
00850         if (_event) {
00851             _event->equeue = &q->_equeue;
00852             _event->id = 0;
00853             _event->delay = 0;
00854             _event->period = -1;
00855 
00856             _event->post = &Event::event_post<F>;
00857             _event->dtor = &Event::event_dtor<F>;
00858 
00859             new (_event+1) F(f);
00860 
00861             _event->ref = 1;
00862         }
00863     }
00864 
00865     /** Copy constructor for events
00866      */
00867     Event(const Event &e) {
00868         _event = 0;
00869         if (e._event) {
00870             _event = e._event;
00871             _event->ref += 1;
00872         }
00873     }
00874 
00875     /** Assignment operator for events
00876      */
00877     Event &operator=(const Event &that) {
00878         if (this != &that) {
00879             this->~Event();
00880             new (this) Event(that);
00881         }
00882 
00883         return *this;
00884     }
00885 
00886     /** Destructor for events
00887      */
00888     ~Event() {
00889         if (_event) {
00890             _event->ref -= 1;
00891             if (_event->ref == 0) {
00892                 _event->dtor(_event);
00893                 equeue_dealloc(_event->equeue, _event);
00894             }
00895         }
00896     }
00897 
00898     /** Configure the delay of an event
00899      *
00900      *  @param delay    Millisecond delay before dispatching the event
00901      */
00902     void delay(int delay) {
00903         if (_event) {
00904             _event->delay = delay;
00905         }
00906     }
00907 
00908     /** Configure the period of an event
00909      *
00910      *  @param period   Millisecond period for repeatedly dispatching an event
00911      */
00912     void period(int period) {
00913         if (_event) {
00914             _event->period = period;
00915         }
00916     }
00917 
00918     /** Posts an event onto the underlying event queue
00919      *
00920      *  The event is posted to the underlying queue and is executed in the
00921      *  context of the event queue's dispatch loop.
00922      *
00923      *  The post function is irq safe and can act as a mechanism for moving
00924      *  events out of irq contexts.
00925      *
00926      *  @param a0..a4   Arguments to pass to the event
00927      *  @return         A unique id that represents the posted event and can
00928      *                  be passed to EventQueue::cancel, or an id of 0 if
00929      *                  there is not enough memory to allocate the event.
00930      */
00931     int post(A0 a0, A1 a1) const {
00932         if (!_event) {
00933             return 0;
00934         }
00935 
00936         _event->id = _event->post(_event, a0, a1);
00937         return _event->id;
00938     }
00939 
00940     /** Posts an event onto the underlying event queue, returning void
00941      *
00942      *  @param a0..a4   Arguments to pass to the event
00943      */
00944     void call(A0 a0, A1 a1) const {
00945         MBED_UNUSED int id = post(a0, a1);
00946         MBED_ASSERT(id);
00947     }
00948 
00949     /** Posts an event onto the underlying event queue, returning void
00950      *
00951      *  @param a0..a4   Arguments to pass to the event
00952      */
00953     void operator()(A0 a0, A1 a1) const {
00954         return call(a0, a1);
00955     }
00956 
00957     /** Static thunk for passing as C-style function
00958      *
00959      *  @param func     Event to call passed as a void pointer
00960      *  @param a0..a4   Arguments to pass to the event
00961      */
00962     static void thunk(void *func, A0 a0, A1 a1) {
00963         return static_cast<Event*>(func)->call(a0, a1);
00964     }
00965 
00966     /** Cancels the most recently posted event
00967      *
00968      *  Attempts to cancel the most recently posted event. It is safe to call
00969      *  cancel after an event has already been dispatched.
00970      *
00971      *  The cancel function is irq safe.
00972      *
00973      *  If called while the event queue's dispatch loop is active, the cancel
00974      *  function does not garuntee that the event will not execute after it
00975      *  returns, as the event may have already begun executing.
00976      */
00977     void cancel() const {
00978         if (_event) {
00979             equeue_cancel(_event->equeue, _event->id);
00980         }
00981     }
00982 
00983 private:
00984     struct event {
00985         unsigned ref;
00986         equeue_t *equeue;
00987         int id;
00988 
00989         int delay;
00990         int period;
00991 
00992         int (*post)(struct event *, A0 a0, A1 a1);
00993         void (*dtor)(struct event *);
00994 
00995         // F follows
00996     } *_event;
00997 
00998     // Event attributes
00999     template <typename F>
01000     static int event_post(struct event *e, A0 a0, A1 a1) {
01001         typedef EventQueue::context20<F, A0, A1> C;
01002         void *p = equeue_alloc(e->equeue, sizeof(C));
01003         if (!p) {
01004             return 0;
01005         }
01006 
01007         new (p) C(*(F*)(e + 1), a0, a1);
01008         equeue_event_delay(p, e->delay);
01009         equeue_event_period(p, e->period);
01010         equeue_event_dtor(p, &EventQueue::function_dtor<C>);
01011         return equeue_post(e->equeue, &EventQueue::function_call<C>, p);
01012     }
01013 
01014     template <typename F>
01015     static void event_dtor(struct event *e) {
01016         ((F*)(e + 1))->~F();
01017     }
01018 
01019 public:
01020     /** Create an event
01021      *  @see Event::Event
01022      */
01023     template <typename F, typename C0>
01024     Event(EventQueue *q, F f, C0 c0) {
01025         new (this) Event(q, EventQueue::context12<F, C0, A0, A1>(f, c0));
01026     }
01027 
01028     /** Create an event
01029      *  @see Event::Event
01030      */
01031     template <typename F, typename C0, typename C1>
01032     Event(EventQueue *q, F f, C0 c0, C1 c1) {
01033         new (this) Event(q, EventQueue::context22<F, C0, C1, A0, A1>(f, c0, c1));
01034     }
01035 
01036     /** Create an event
01037      *  @see Event::Event
01038      */
01039     template <typename F, typename C0, typename C1, typename C2>
01040     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) {
01041         new (this) Event(q, EventQueue::context32<F, C0, C1, C2, A0, A1>(f, c0, c1, c2));
01042     }
01043 
01044     /** Create an event
01045      *  @see Event::Event
01046      */
01047     template <typename F, typename C0, typename C1, typename C2, typename C3>
01048     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) {
01049         new (this) Event(q, EventQueue::context42<F, C0, C1, C2, C3, A0, A1>(f, c0, c1, c2, c3));
01050     }
01051 
01052     /** Create an event
01053      *  @see Event::Event
01054      */
01055     template <typename F, typename C0, typename C1, typename C2, typename C3, typename C4>
01056     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
01057         new (this) Event(q, EventQueue::context52<F, C0, C1, C2, C3, C4, A0, A1>(f, c0, c1, c2, c3, c4));
01058     }
01059 
01060     /** Create an event
01061      *  @see Event::Event
01062      */
01063     template <typename T, typename R, typename B0>
01064     Event(EventQueue *q, T *obj, R (T::*method)(B0, A0, A1), B0 b0) {
01065         new (this) Event(q, mbed::callback(obj, method), b0);
01066     }
01067 
01068     /** Create an event
01069      *  @see Event::Event
01070      */
01071     template <typename T, typename R, typename B0>
01072     Event(EventQueue *q, const T *obj, R (T::*method)(B0, A0, A1) const, B0 b0) {
01073         new (this) Event(q, mbed::callback(obj, method), b0);
01074     }
01075 
01076     /** Create an event
01077      *  @see Event::Event
01078      */
01079     template <typename T, typename R, typename B0>
01080     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, A0, A1) volatile, B0 b0) {
01081         new (this) Event(q, mbed::callback(obj, method), b0);
01082     }
01083 
01084     /** Create an event
01085      *  @see Event::Event
01086      */
01087     template <typename T, typename R, typename B0>
01088     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, A0, A1) const volatile, B0 b0) {
01089         new (this) Event(q, mbed::callback(obj, method), b0);
01090     }
01091 
01092     /** Create an event
01093      *  @see Event::Event
01094      */
01095     template <typename T, typename R, typename B0, typename B1>
01096     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, A0, A1), B0 b0, B1 b1) {
01097         new (this) Event(q, mbed::callback(obj, method), b0, b1);
01098     }
01099 
01100     /** Create an event
01101      *  @see Event::Event
01102      */
01103     template <typename T, typename R, typename B0, typename B1>
01104     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, A0, A1) const, B0 b0, B1 b1) {
01105         new (this) Event(q, mbed::callback(obj, method), b0, b1);
01106     }
01107 
01108     /** Create an event
01109      *  @see Event::Event
01110      */
01111     template <typename T, typename R, typename B0, typename B1>
01112     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, A0, A1) volatile, B0 b0, B1 b1) {
01113         new (this) Event(q, mbed::callback(obj, method), b0, b1);
01114     }
01115 
01116     /** Create an event
01117      *  @see Event::Event
01118      */
01119     template <typename T, typename R, typename B0, typename B1>
01120     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, A0, A1) const volatile, B0 b0, B1 b1) {
01121         new (this) Event(q, mbed::callback(obj, method), b0, b1);
01122     }
01123 
01124     /** Create an event
01125      *  @see Event::Event
01126      */
01127     template <typename T, typename R, typename B0, typename B1, typename B2>
01128     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, A0, A1), B0 b0, B1 b1, B2 b2) {
01129         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
01130     }
01131 
01132     /** Create an event
01133      *  @see Event::Event
01134      */
01135     template <typename T, typename R, typename B0, typename B1, typename B2>
01136     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, A0, A1) const, B0 b0, B1 b1, B2 b2) {
01137         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
01138     }
01139 
01140     /** Create an event
01141      *  @see Event::Event
01142      */
01143     template <typename T, typename R, typename B0, typename B1, typename B2>
01144     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1) volatile, B0 b0, B1 b1, B2 b2) {
01145         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
01146     }
01147 
01148     /** Create an event
01149      *  @see Event::Event
01150      */
01151     template <typename T, typename R, typename B0, typename B1, typename B2>
01152     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1) const volatile, B0 b0, B1 b1, B2 b2) {
01153         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
01154     }
01155 
01156     /** Create an event
01157      *  @see Event::Event
01158      */
01159     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
01160     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1), B0 b0, B1 b1, B2 b2, B3 b3) {
01161         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
01162     }
01163 
01164     /** Create an event
01165      *  @see Event::Event
01166      */
01167     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
01168     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1) const, B0 b0, B1 b1, B2 b2, B3 b3) {
01169         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
01170     }
01171 
01172     /** Create an event
01173      *  @see Event::Event
01174      */
01175     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
01176     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1) volatile, B0 b0, B1 b1, B2 b2, B3 b3) {
01177         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
01178     }
01179 
01180     /** Create an event
01181      *  @see Event::Event
01182      */
01183     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
01184     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) {
01185         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
01186     }
01187 
01188     /** Create an event
01189      *  @see Event::Event
01190      */
01191     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
01192     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) {
01193         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
01194     }
01195 
01196     /** Create an event
01197      *  @see Event::Event
01198      */
01199     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
01200     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) {
01201         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
01202     }
01203 
01204     /** Create an event
01205      *  @see Event::Event
01206      */
01207     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
01208     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) {
01209         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
01210     }
01211 
01212     /** Create an event
01213      *  @see Event::Event
01214      */
01215     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
01216     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) {
01217         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
01218     }
01219 };
01220 
01221 /** Event
01222  *
01223  *  Representation of an event for fine-grain dispatch control
01224  */
01225 template <typename A0, typename A1, typename A2>
01226 class Event<void(A0, A1, A2)> {
01227 public:
01228     /** Create an event
01229      *
01230      *  Constructs an event bound to the specified event queue. The specified
01231      *  callback acts as the target for the event and is executed in the
01232      *  context of the event queue's dispatch loop once posted.
01233      *
01234      *  @param q        Event queue to dispatch on
01235      *  @param f        Function to execute when the event is dispatched
01236      *  @param c0..c4   Arguments to bind to the callback, these arguments are
01237      *                  allocated on an irq-safe allocator from the event queue's
01238      *                  memory pool. Must be type-compatible with b0..b4, the
01239      *                  arguments to the underlying callback.
01240      */
01241     template <typename F>
01242     Event(EventQueue *q, F f) {
01243         _event = static_cast<struct event *>(
01244                 equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F)));
01245 
01246         if (_event) {
01247             _event->equeue = &q->_equeue;
01248             _event->id = 0;
01249             _event->delay = 0;
01250             _event->period = -1;
01251 
01252             _event->post = &Event::event_post<F>;
01253             _event->dtor = &Event::event_dtor<F>;
01254 
01255             new (_event+1) F(f);
01256 
01257             _event->ref = 1;
01258         }
01259     }
01260 
01261     /** Copy constructor for events
01262      */
01263     Event(const Event &e) {
01264         _event = 0;
01265         if (e._event) {
01266             _event = e._event;
01267             _event->ref += 1;
01268         }
01269     }
01270 
01271     /** Assignment operator for events
01272      */
01273     Event &operator=(const Event &that) {
01274         if (this != &that) {
01275             this->~Event();
01276             new (this) Event(that);
01277         }
01278 
01279         return *this;
01280     }
01281 
01282     /** Destructor for events
01283      */
01284     ~Event() {
01285         if (_event) {
01286             _event->ref -= 1;
01287             if (_event->ref == 0) {
01288                 _event->dtor(_event);
01289                 equeue_dealloc(_event->equeue, _event);
01290             }
01291         }
01292     }
01293 
01294     /** Configure the delay of an event
01295      *
01296      *  @param delay    Millisecond delay before dispatching the event
01297      */
01298     void delay(int delay) {
01299         if (_event) {
01300             _event->delay = delay;
01301         }
01302     }
01303 
01304     /** Configure the period of an event
01305      *
01306      *  @param period   Millisecond period for repeatedly dispatching an event
01307      */
01308     void period(int period) {
01309         if (_event) {
01310             _event->period = period;
01311         }
01312     }
01313 
01314     /** Posts an event onto the underlying event queue
01315      *
01316      *  The event is posted to the underlying queue and is executed in the
01317      *  context of the event queue's dispatch loop.
01318      *
01319      *  The post function is irq safe and can act as a mechanism for moving
01320      *  events out of irq contexts.
01321      *
01322      *  @param a0..a4   Arguments to pass to the event
01323      *  @return         A unique id that represents the posted event and can
01324      *                  be passed to EventQueue::cancel, or an id of 0 if
01325      *                  there is not enough memory to allocate the event.
01326      */
01327     int post(A0 a0, A1 a1, A2 a2) const {
01328         if (!_event) {
01329             return 0;
01330         }
01331 
01332         _event->id = _event->post(_event, a0, a1, a2);
01333         return _event->id;
01334     }
01335 
01336     /** Posts an event onto the underlying event queue, returning void
01337      *
01338      *  @param a0..a4   Arguments to pass to the event
01339      */
01340     void call(A0 a0, A1 a1, A2 a2) const {
01341         MBED_UNUSED int id = post(a0, a1, a2);
01342         MBED_ASSERT(id);
01343     }
01344 
01345     /** Posts an event onto the underlying event queue, returning void
01346      *
01347      *  @param a0..a4   Arguments to pass to the event
01348      */
01349     void operator()(A0 a0, A1 a1, A2 a2) const {
01350         return call(a0, a1, a2);
01351     }
01352 
01353     /** Static thunk for passing as C-style function
01354      *
01355      *  @param func     Event to call passed as a void pointer
01356      *  @param a0..a4   Arguments to pass to the event
01357      */
01358     static void thunk(void *func, A0 a0, A1 a1, A2 a2) {
01359         return static_cast<Event*>(func)->call(a0, a1, a2);
01360     }
01361 
01362     /** Cancels the most recently posted event
01363      *
01364      *  Attempts to cancel the most recently posted event. It is safe to call
01365      *  cancel after an event has already been dispatched.
01366      *
01367      *  The cancel function is irq safe.
01368      *
01369      *  If called while the event queue's dispatch loop is active, the cancel
01370      *  function does not garuntee that the event will not execute after it
01371      *  returns, as the event may have already begun executing.
01372      */
01373     void cancel() const {
01374         if (_event) {
01375             equeue_cancel(_event->equeue, _event->id);
01376         }
01377     }
01378 
01379 private:
01380     struct event {
01381         unsigned ref;
01382         equeue_t *equeue;
01383         int id;
01384 
01385         int delay;
01386         int period;
01387 
01388         int (*post)(struct event *, A0 a0, A1 a1, A2 a2);
01389         void (*dtor)(struct event *);
01390 
01391         // F follows
01392     } *_event;
01393 
01394     // Event attributes
01395     template <typename F>
01396     static int event_post(struct event *e, A0 a0, A1 a1, A2 a2) {
01397         typedef EventQueue::context30<F, A0, A1, A2> C;
01398         void *p = equeue_alloc(e->equeue, sizeof(C));
01399         if (!p) {
01400             return 0;
01401         }
01402 
01403         new (p) C(*(F*)(e + 1), a0, a1, a2);
01404         equeue_event_delay(p, e->delay);
01405         equeue_event_period(p, e->period);
01406         equeue_event_dtor(p, &EventQueue::function_dtor<C>);
01407         return equeue_post(e->equeue, &EventQueue::function_call<C>, p);
01408     }
01409 
01410     template <typename F>
01411     static void event_dtor(struct event *e) {
01412         ((F*)(e + 1))->~F();
01413     }
01414 
01415 public:
01416     /** Create an event
01417      *  @see Event::Event
01418      */
01419     template <typename F, typename C0>
01420     Event(EventQueue *q, F f, C0 c0) {
01421         new (this) Event(q, EventQueue::context13<F, C0, A0, A1, A2>(f, c0));
01422     }
01423 
01424     /** Create an event
01425      *  @see Event::Event
01426      */
01427     template <typename F, typename C0, typename C1>
01428     Event(EventQueue *q, F f, C0 c0, C1 c1) {
01429         new (this) Event(q, EventQueue::context23<F, C0, C1, A0, A1, A2>(f, c0, c1));
01430     }
01431 
01432     /** Create an event
01433      *  @see Event::Event
01434      */
01435     template <typename F, typename C0, typename C1, typename C2>
01436     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) {
01437         new (this) Event(q, EventQueue::context33<F, C0, C1, C2, A0, A1, A2>(f, c0, c1, c2));
01438     }
01439 
01440     /** Create an event
01441      *  @see Event::Event
01442      */
01443     template <typename F, typename C0, typename C1, typename C2, typename C3>
01444     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) {
01445         new (this) Event(q, EventQueue::context43<F, C0, C1, C2, C3, A0, A1, A2>(f, c0, c1, c2, c3));
01446     }
01447 
01448     /** Create an event
01449      *  @see Event::Event
01450      */
01451     template <typename F, typename C0, typename C1, typename C2, typename C3, typename C4>
01452     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
01453         new (this) Event(q, EventQueue::context53<F, C0, C1, C2, C3, C4, A0, A1, A2>(f, c0, c1, c2, c3, c4));
01454     }
01455 
01456     /** Create an event
01457      *  @see Event::Event
01458      */
01459     template <typename T, typename R, typename B0>
01460     Event(EventQueue *q, T *obj, R (T::*method)(B0, A0, A1, A2), B0 b0) {
01461         new (this) Event(q, mbed::callback(obj, method), b0);
01462     }
01463 
01464     /** Create an event
01465      *  @see Event::Event
01466      */
01467     template <typename T, typename R, typename B0>
01468     Event(EventQueue *q, const T *obj, R (T::*method)(B0, A0, A1, A2) const, B0 b0) {
01469         new (this) Event(q, mbed::callback(obj, method), b0);
01470     }
01471 
01472     /** Create an event
01473      *  @see Event::Event
01474      */
01475     template <typename T, typename R, typename B0>
01476     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, A0, A1, A2) volatile, B0 b0) {
01477         new (this) Event(q, mbed::callback(obj, method), b0);
01478     }
01479 
01480     /** Create an event
01481      *  @see Event::Event
01482      */
01483     template <typename T, typename R, typename B0>
01484     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, A0, A1, A2) const volatile, B0 b0) {
01485         new (this) Event(q, mbed::callback(obj, method), b0);
01486     }
01487 
01488     /** Create an event
01489      *  @see Event::Event
01490      */
01491     template <typename T, typename R, typename B0, typename B1>
01492     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, A0, A1, A2), B0 b0, B1 b1) {
01493         new (this) Event(q, mbed::callback(obj, method), b0, b1);
01494     }
01495 
01496     /** Create an event
01497      *  @see Event::Event
01498      */
01499     template <typename T, typename R, typename B0, typename B1>
01500     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, A0, A1, A2) const, B0 b0, B1 b1) {
01501         new (this) Event(q, mbed::callback(obj, method), b0, b1);
01502     }
01503 
01504     /** Create an event
01505      *  @see Event::Event
01506      */
01507     template <typename T, typename R, typename B0, typename B1>
01508     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2) volatile, B0 b0, B1 b1) {
01509         new (this) Event(q, mbed::callback(obj, method), b0, b1);
01510     }
01511 
01512     /** Create an event
01513      *  @see Event::Event
01514      */
01515     template <typename T, typename R, typename B0, typename B1>
01516     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2) const volatile, B0 b0, B1 b1) {
01517         new (this) Event(q, mbed::callback(obj, method), b0, b1);
01518     }
01519 
01520     /** Create an event
01521      *  @see Event::Event
01522      */
01523     template <typename T, typename R, typename B0, typename B1, typename B2>
01524     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2), B0 b0, B1 b1, B2 b2) {
01525         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
01526     }
01527 
01528     /** Create an event
01529      *  @see Event::Event
01530      */
01531     template <typename T, typename R, typename B0, typename B1, typename B2>
01532     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2) const, B0 b0, B1 b1, B2 b2) {
01533         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
01534     }
01535 
01536     /** Create an event
01537      *  @see Event::Event
01538      */
01539     template <typename T, typename R, typename B0, typename B1, typename B2>
01540     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2) volatile, B0 b0, B1 b1, B2 b2) {
01541         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
01542     }
01543 
01544     /** Create an event
01545      *  @see Event::Event
01546      */
01547     template <typename T, typename R, typename B0, typename B1, typename B2>
01548     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2) const volatile, B0 b0, B1 b1, B2 b2) {
01549         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
01550     }
01551 
01552     /** Create an event
01553      *  @see Event::Event
01554      */
01555     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
01556     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2), B0 b0, B1 b1, B2 b2, B3 b3) {
01557         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
01558     }
01559 
01560     /** Create an event
01561      *  @see Event::Event
01562      */
01563     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
01564     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) {
01565         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
01566     }
01567 
01568     /** Create an event
01569      *  @see Event::Event
01570      */
01571     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
01572     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) {
01573         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
01574     }
01575 
01576     /** Create an event
01577      *  @see Event::Event
01578      */
01579     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
01580     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) {
01581         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
01582     }
01583 
01584     /** Create an event
01585      *  @see Event::Event
01586      */
01587     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
01588     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) {
01589         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
01590     }
01591 
01592     /** Create an event
01593      *  @see Event::Event
01594      */
01595     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
01596     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) {
01597         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
01598     }
01599 
01600     /** Create an event
01601      *  @see Event::Event
01602      */
01603     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
01604     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) {
01605         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
01606     }
01607 
01608     /** Create an event
01609      *  @see Event::Event
01610      */
01611     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
01612     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) {
01613         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
01614     }
01615 };
01616 
01617 /** Event
01618  *
01619  *  Representation of an event for fine-grain dispatch control
01620  */
01621 template <typename A0, typename A1, typename A2, typename A3>
01622 class Event<void(A0, A1, A2, A3)> {
01623 public:
01624     /** Create an event
01625      *
01626      *  Constructs an event bound to the specified event queue. The specified
01627      *  callback acts as the target for the event and is executed in the
01628      *  context of the event queue's dispatch loop once posted.
01629      *
01630      *  @param q        Event queue to dispatch on
01631      *  @param f        Function to execute when the event is dispatched
01632      *  @param c0..c4   Arguments to bind to the callback, these arguments are
01633      *                  allocated on an irq-safe allocator from the event queue's
01634      *                  memory pool. Must be type-compatible with b0..b4, the
01635      *                  arguments to the underlying callback.
01636      */
01637     template <typename F>
01638     Event(EventQueue *q, F f) {
01639         _event = static_cast<struct event *>(
01640                 equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F)));
01641 
01642         if (_event) {
01643             _event->equeue = &q->_equeue;
01644             _event->id = 0;
01645             _event->delay = 0;
01646             _event->period = -1;
01647 
01648             _event->post = &Event::event_post<F>;
01649             _event->dtor = &Event::event_dtor<F>;
01650 
01651             new (_event+1) F(f);
01652 
01653             _event->ref = 1;
01654         }
01655     }
01656 
01657     /** Copy constructor for events
01658      */
01659     Event(const Event &e) {
01660         _event = 0;
01661         if (e._event) {
01662             _event = e._event;
01663             _event->ref += 1;
01664         }
01665     }
01666 
01667     /** Assignment operator for events
01668      */
01669     Event &operator=(const Event &that) {
01670         if (this != &that) {
01671             this->~Event();
01672             new (this) Event(that);
01673         }
01674 
01675         return *this;
01676     }
01677 
01678     /** Destructor for events
01679      */
01680     ~Event() {
01681         if (_event) {
01682             _event->ref -= 1;
01683             if (_event->ref == 0) {
01684                 _event->dtor(_event);
01685                 equeue_dealloc(_event->equeue, _event);
01686             }
01687         }
01688     }
01689 
01690     /** Configure the delay of an event
01691      *
01692      *  @param delay    Millisecond delay before dispatching the event
01693      */
01694     void delay(int delay) {
01695         if (_event) {
01696             _event->delay = delay;
01697         }
01698     }
01699 
01700     /** Configure the period of an event
01701      *
01702      *  @param period   Millisecond period for repeatedly dispatching an event
01703      */
01704     void period(int period) {
01705         if (_event) {
01706             _event->period = period;
01707         }
01708     }
01709 
01710     /** Posts an event onto the underlying event queue
01711      *
01712      *  The event is posted to the underlying queue and is executed in the
01713      *  context of the event queue's dispatch loop.
01714      *
01715      *  The post function is irq safe and can act as a mechanism for moving
01716      *  events out of irq contexts.
01717      *
01718      *  @param a0..a4   Arguments to pass to the event
01719      *  @return         A unique id that represents the posted event and can
01720      *                  be passed to EventQueue::cancel, or an id of 0 if
01721      *                  there is not enough memory to allocate the event.
01722      */
01723     int post(A0 a0, A1 a1, A2 a2, A3 a3) const {
01724         if (!_event) {
01725             return 0;
01726         }
01727 
01728         _event->id = _event->post(_event, a0, a1, a2, a3);
01729         return _event->id;
01730     }
01731 
01732     /** Posts an event onto the underlying event queue, returning void
01733      *
01734      *  @param a0..a4   Arguments to pass to the event
01735      */
01736     void call(A0 a0, A1 a1, A2 a2, A3 a3) const {
01737         MBED_UNUSED int id = post(a0, a1, a2, a3);
01738         MBED_ASSERT(id);
01739     }
01740 
01741     /** Posts an event onto the underlying event queue, returning void
01742      *
01743      *  @param a0..a4   Arguments to pass to the event
01744      */
01745     void operator()(A0 a0, A1 a1, A2 a2, A3 a3) const {
01746         return call(a0, a1, a2, a3);
01747     }
01748 
01749     /** Static thunk for passing as C-style function
01750      *
01751      *  @param func     Event to call passed as a void pointer
01752      *  @param a0..a4   Arguments to pass to the event
01753      */
01754     static void thunk(void *func, A0 a0, A1 a1, A2 a2, A3 a3) {
01755         return static_cast<Event*>(func)->call(a0, a1, a2, a3);
01756     }
01757 
01758     /** Cancels the most recently posted event
01759      *
01760      *  Attempts to cancel the most recently posted event. It is safe to call
01761      *  cancel after an event has already been dispatched.
01762      *
01763      *  The cancel function is irq safe.
01764      *
01765      *  If called while the event queue's dispatch loop is active, the cancel
01766      *  function does not garuntee that the event will not execute after it
01767      *  returns, as the event may have already begun executing.
01768      */
01769     void cancel() const {
01770         if (_event) {
01771             equeue_cancel(_event->equeue, _event->id);
01772         }
01773     }
01774 
01775 private:
01776     struct event {
01777         unsigned ref;
01778         equeue_t *equeue;
01779         int id;
01780 
01781         int delay;
01782         int period;
01783 
01784         int (*post)(struct event *, A0 a0, A1 a1, A2 a2, A3 a3);
01785         void (*dtor)(struct event *);
01786 
01787         // F follows
01788     } *_event;
01789 
01790     // Event attributes
01791     template <typename F>
01792     static int event_post(struct event *e, A0 a0, A1 a1, A2 a2, A3 a3) {
01793         typedef EventQueue::context40<F, A0, A1, A2, A3> C;
01794         void *p = equeue_alloc(e->equeue, sizeof(C));
01795         if (!p) {
01796             return 0;
01797         }
01798 
01799         new (p) C(*(F*)(e + 1), a0, a1, a2, a3);
01800         equeue_event_delay(p, e->delay);
01801         equeue_event_period(p, e->period);
01802         equeue_event_dtor(p, &EventQueue::function_dtor<C>);
01803         return equeue_post(e->equeue, &EventQueue::function_call<C>, p);
01804     }
01805 
01806     template <typename F>
01807     static void event_dtor(struct event *e) {
01808         ((F*)(e + 1))->~F();
01809     }
01810 
01811 public:
01812     /** Create an event
01813      *  @see Event::Event
01814      */
01815     template <typename F, typename C0>
01816     Event(EventQueue *q, F f, C0 c0) {
01817         new (this) Event(q, EventQueue::context14<F, C0, A0, A1, A2, A3>(f, c0));
01818     }
01819 
01820     /** Create an event
01821      *  @see Event::Event
01822      */
01823     template <typename F, typename C0, typename C1>
01824     Event(EventQueue *q, F f, C0 c0, C1 c1) {
01825         new (this) Event(q, EventQueue::context24<F, C0, C1, A0, A1, A2, A3>(f, c0, c1));
01826     }
01827 
01828     /** Create an event
01829      *  @see Event::Event
01830      */
01831     template <typename F, typename C0, typename C1, typename C2>
01832     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) {
01833         new (this) Event(q, EventQueue::context34<F, C0, C1, C2, A0, A1, A2, A3>(f, c0, c1, c2));
01834     }
01835 
01836     /** Create an event
01837      *  @see Event::Event
01838      */
01839     template <typename F, typename C0, typename C1, typename C2, typename C3>
01840     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) {
01841         new (this) Event(q, EventQueue::context44<F, C0, C1, C2, C3, A0, A1, A2, A3>(f, c0, c1, c2, c3));
01842     }
01843 
01844     /** Create an event
01845      *  @see Event::Event
01846      */
01847     template <typename F, typename C0, typename C1, typename C2, typename C3, typename C4>
01848     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
01849         new (this) Event(q, EventQueue::context54<F, C0, C1, C2, C3, C4, A0, A1, A2, A3>(f, c0, c1, c2, c3, c4));
01850     }
01851 
01852     /** Create an event
01853      *  @see Event::Event
01854      */
01855     template <typename T, typename R, typename B0>
01856     Event(EventQueue *q, T *obj, R (T::*method)(B0, A0, A1, A2, A3), B0 b0) {
01857         new (this) Event(q, mbed::callback(obj, method), b0);
01858     }
01859 
01860     /** Create an event
01861      *  @see Event::Event
01862      */
01863     template <typename T, typename R, typename B0>
01864     Event(EventQueue *q, const T *obj, R (T::*method)(B0, A0, A1, A2, A3) const, B0 b0) {
01865         new (this) Event(q, mbed::callback(obj, method), b0);
01866     }
01867 
01868     /** Create an event
01869      *  @see Event::Event
01870      */
01871     template <typename T, typename R, typename B0>
01872     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3) volatile, B0 b0) {
01873         new (this) Event(q, mbed::callback(obj, method), b0);
01874     }
01875 
01876     /** Create an event
01877      *  @see Event::Event
01878      */
01879     template <typename T, typename R, typename B0>
01880     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3) const volatile, B0 b0) {
01881         new (this) Event(q, mbed::callback(obj, method), b0);
01882     }
01883 
01884     /** Create an event
01885      *  @see Event::Event
01886      */
01887     template <typename T, typename R, typename B0, typename B1>
01888     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3), B0 b0, B1 b1) {
01889         new (this) Event(q, mbed::callback(obj, method), b0, b1);
01890     }
01891 
01892     /** Create an event
01893      *  @see Event::Event
01894      */
01895     template <typename T, typename R, typename B0, typename B1>
01896     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3) const, B0 b0, B1 b1) {
01897         new (this) Event(q, mbed::callback(obj, method), b0, b1);
01898     }
01899 
01900     /** Create an event
01901      *  @see Event::Event
01902      */
01903     template <typename T, typename R, typename B0, typename B1>
01904     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3) volatile, B0 b0, B1 b1) {
01905         new (this) Event(q, mbed::callback(obj, method), b0, b1);
01906     }
01907 
01908     /** Create an event
01909      *  @see Event::Event
01910      */
01911     template <typename T, typename R, typename B0, typename B1>
01912     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3) const volatile, B0 b0, B1 b1) {
01913         new (this) Event(q, mbed::callback(obj, method), b0, b1);
01914     }
01915 
01916     /** Create an event
01917      *  @see Event::Event
01918      */
01919     template <typename T, typename R, typename B0, typename B1, typename B2>
01920     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3), B0 b0, B1 b1, B2 b2) {
01921         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
01922     }
01923 
01924     /** Create an event
01925      *  @see Event::Event
01926      */
01927     template <typename T, typename R, typename B0, typename B1, typename B2>
01928     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3) const, B0 b0, B1 b1, B2 b2) {
01929         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
01930     }
01931 
01932     /** Create an event
01933      *  @see Event::Event
01934      */
01935     template <typename T, typename R, typename B0, typename B1, typename B2>
01936     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3) volatile, B0 b0, B1 b1, B2 b2) {
01937         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
01938     }
01939 
01940     /** Create an event
01941      *  @see Event::Event
01942      */
01943     template <typename T, typename R, typename B0, typename B1, typename B2>
01944     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) {
01945         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
01946     }
01947 
01948     /** Create an event
01949      *  @see Event::Event
01950      */
01951     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
01952     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, B3, A0, A1, A2, A3), B0 b0, B1 b1, B2 b2, B3 b3) {
01953         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
01954     }
01955 
01956     /** Create an event
01957      *  @see Event::Event
01958      */
01959     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
01960     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) {
01961         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
01962     }
01963 
01964     /** Create an event
01965      *  @see Event::Event
01966      */
01967     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
01968     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) {
01969         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
01970     }
01971 
01972     /** Create an event
01973      *  @see Event::Event
01974      */
01975     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
01976     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) {
01977         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
01978     }
01979 
01980     /** Create an event
01981      *  @see Event::Event
01982      */
01983     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
01984     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) {
01985         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
01986     }
01987 
01988     /** Create an event
01989      *  @see Event::Event
01990      */
01991     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
01992     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) {
01993         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
01994     }
01995 
01996     /** Create an event
01997      *  @see Event::Event
01998      */
01999     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
02000     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) {
02001         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
02002     }
02003 
02004     /** Create an event
02005      *  @see Event::Event
02006      */
02007     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
02008     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) {
02009         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
02010     }
02011 };
02012 
02013 /** Event
02014  *
02015  *  Representation of an event for fine-grain dispatch control
02016  */
02017 template <typename A0, typename A1, typename A2, typename A3, typename A4>
02018 class Event<void(A0, A1, A2, A3, A4)> {
02019 public:
02020     /** Create an event
02021      *
02022      *  Constructs an event bound to the specified event queue. The specified
02023      *  callback acts as the target for the event and is executed in the
02024      *  context of the event queue's dispatch loop once posted.
02025      *
02026      *  @param q        Event queue to dispatch on
02027      *  @param f        Function to execute when the event is dispatched
02028      *  @param c0..c4   Arguments to bind to the callback, these arguments are
02029      *                  allocated on an irq-safe allocator from the event queue's
02030      *                  memory pool. Must be type-compatible with b0..b4, the
02031      *                  arguments to the underlying callback.
02032      */
02033     template <typename F>
02034     Event(EventQueue *q, F f) {
02035         _event = static_cast<struct event *>(
02036                 equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F)));
02037 
02038         if (_event) {
02039             _event->equeue = &q->_equeue;
02040             _event->id = 0;
02041             _event->delay = 0;
02042             _event->period = -1;
02043 
02044             _event->post = &Event::event_post<F>;
02045             _event->dtor = &Event::event_dtor<F>;
02046 
02047             new (_event+1) F(f);
02048 
02049             _event->ref = 1;
02050         }
02051     }
02052 
02053     /** Copy constructor for events
02054      */
02055     Event(const Event &e) {
02056         _event = 0;
02057         if (e._event) {
02058             _event = e._event;
02059             _event->ref += 1;
02060         }
02061     }
02062 
02063     /** Assignment operator for events
02064      */
02065     Event &operator=(const Event &that) {
02066         if (this != &that) {
02067             this->~Event();
02068             new (this) Event(that);
02069         }
02070 
02071         return *this;
02072     }
02073 
02074     /** Destructor for events
02075      */
02076     ~Event() {
02077         if (_event) {
02078             _event->ref -= 1;
02079             if (_event->ref == 0) {
02080                 _event->dtor(_event);
02081                 equeue_dealloc(_event->equeue, _event);
02082             }
02083         }
02084     }
02085 
02086     /** Configure the delay of an event
02087      *
02088      *  @param delay    Millisecond delay before dispatching the event
02089      */
02090     void delay(int delay) {
02091         if (_event) {
02092             _event->delay = delay;
02093         }
02094     }
02095 
02096     /** Configure the period of an event
02097      *
02098      *  @param period   Millisecond period for repeatedly dispatching an event
02099      */
02100     void period(int period) {
02101         if (_event) {
02102             _event->period = period;
02103         }
02104     }
02105 
02106     /** Posts an event onto the underlying event queue
02107      *
02108      *  The event is posted to the underlying queue and is executed in the
02109      *  context of the event queue's dispatch loop.
02110      *
02111      *  The post function is irq safe and can act as a mechanism for moving
02112      *  events out of irq contexts.
02113      *
02114      *  @param a0..a4   Arguments to pass to the event
02115      *  @return         A unique id that represents the posted event and can
02116      *                  be passed to EventQueue::cancel, or an id of 0 if
02117      *                  there is not enough memory to allocate the event.
02118      */
02119     int post(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) const {
02120         if (!_event) {
02121             return 0;
02122         }
02123 
02124         _event->id = _event->post(_event, a0, a1, a2, a3, a4);
02125         return _event->id;
02126     }
02127 
02128     /** Posts an event onto the underlying event queue, returning void
02129      *
02130      *  @param a0..a4   Arguments to pass to the event
02131      */
02132     void call(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) const {
02133         MBED_UNUSED int id = post(a0, a1, a2, a3, a4);
02134         MBED_ASSERT(id);
02135     }
02136 
02137     /** Posts an event onto the underlying event queue, returning void
02138      *
02139      *  @param a0..a4   Arguments to pass to the event
02140      */
02141     void operator()(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) const {
02142         return call(a0, a1, a2, a3, a4);
02143     }
02144 
02145     /** Static thunk for passing as C-style function
02146      *
02147      *  @param func     Event to call passed as a void pointer
02148      *  @param a0..a4   Arguments to pass to the event
02149      */
02150     static void thunk(void *func, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
02151         return static_cast<Event*>(func)->call(a0, a1, a2, a3, a4);
02152     }
02153 
02154     /** Cancels the most recently posted event
02155      *
02156      *  Attempts to cancel the most recently posted event. It is safe to call
02157      *  cancel after an event has already been dispatched.
02158      *
02159      *  The cancel function is irq safe.
02160      *
02161      *  If called while the event queue's dispatch loop is active, the cancel
02162      *  function does not garuntee that the event will not execute after it
02163      *  returns, as the event may have already begun executing.
02164      */
02165     void cancel() const {
02166         if (_event) {
02167             equeue_cancel(_event->equeue, _event->id);
02168         }
02169     }
02170 
02171 private:
02172     struct event {
02173         unsigned ref;
02174         equeue_t *equeue;
02175         int id;
02176 
02177         int delay;
02178         int period;
02179 
02180         int (*post)(struct event *, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4);
02181         void (*dtor)(struct event *);
02182 
02183         // F follows
02184     } *_event;
02185 
02186     // Event attributes
02187     template <typename F>
02188     static int event_post(struct event *e, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
02189         typedef EventQueue::context50<F, A0, A1, A2, A3, A4> C;
02190         void *p = equeue_alloc(e->equeue, sizeof(C));
02191         if (!p) {
02192             return 0;
02193         }
02194 
02195         new (p) C(*(F*)(e + 1), a0, a1, a2, a3, a4);
02196         equeue_event_delay(p, e->delay);
02197         equeue_event_period(p, e->period);
02198         equeue_event_dtor(p, &EventQueue::function_dtor<C>);
02199         return equeue_post(e->equeue, &EventQueue::function_call<C>, p);
02200     }
02201 
02202     template <typename F>
02203     static void event_dtor(struct event *e) {
02204         ((F*)(e + 1))->~F();
02205     }
02206 
02207 public:
02208     /** Create an event
02209      *  @see Event::Event
02210      */
02211     template <typename F, typename C0>
02212     Event(EventQueue *q, F f, C0 c0) {
02213         new (this) Event(q, EventQueue::context15<F, C0, A0, A1, A2, A3, A4>(f, c0));
02214     }
02215 
02216     /** Create an event
02217      *  @see Event::Event
02218      */
02219     template <typename F, typename C0, typename C1>
02220     Event(EventQueue *q, F f, C0 c0, C1 c1) {
02221         new (this) Event(q, EventQueue::context25<F, C0, C1, A0, A1, A2, A3, A4>(f, c0, c1));
02222     }
02223 
02224     /** Create an event
02225      *  @see Event::Event
02226      */
02227     template <typename F, typename C0, typename C1, typename C2>
02228     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) {
02229         new (this) Event(q, EventQueue::context35<F, C0, C1, C2, A0, A1, A2, A3, A4>(f, c0, c1, c2));
02230     }
02231 
02232     /** Create an event
02233      *  @see Event::Event
02234      */
02235     template <typename F, typename C0, typename C1, typename C2, typename C3>
02236     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) {
02237         new (this) Event(q, EventQueue::context45<F, C0, C1, C2, C3, A0, A1, A2, A3, A4>(f, c0, c1, c2, c3));
02238     }
02239 
02240     /** Create an event
02241      *  @see Event::Event
02242      */
02243     template <typename F, typename C0, typename C1, typename C2, typename C3, typename C4>
02244     Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
02245         new (this) Event(q, EventQueue::context55<F, C0, C1, C2, C3, C4, A0, A1, A2, A3, A4>(f, c0, c1, c2, c3, c4));
02246     }
02247 
02248     /** Create an event
02249      *  @see Event::Event
02250      */
02251     template <typename T, typename R, typename B0>
02252     Event(EventQueue *q, T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4), B0 b0) {
02253         new (this) Event(q, mbed::callback(obj, method), b0);
02254     }
02255 
02256     /** Create an event
02257      *  @see Event::Event
02258      */
02259     template <typename T, typename R, typename B0>
02260     Event(EventQueue *q, const T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4) const, B0 b0) {
02261         new (this) Event(q, mbed::callback(obj, method), b0);
02262     }
02263 
02264     /** Create an event
02265      *  @see Event::Event
02266      */
02267     template <typename T, typename R, typename B0>
02268     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4) volatile, B0 b0) {
02269         new (this) Event(q, mbed::callback(obj, method), b0);
02270     }
02271 
02272     /** Create an event
02273      *  @see Event::Event
02274      */
02275     template <typename T, typename R, typename B0>
02276     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4) const volatile, B0 b0) {
02277         new (this) Event(q, mbed::callback(obj, method), b0);
02278     }
02279 
02280     /** Create an event
02281      *  @see Event::Event
02282      */
02283     template <typename T, typename R, typename B0, typename B1>
02284     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3, A4), B0 b0, B1 b1) {
02285         new (this) Event(q, mbed::callback(obj, method), b0, b1);
02286     }
02287 
02288     /** Create an event
02289      *  @see Event::Event
02290      */
02291     template <typename T, typename R, typename B0, typename B1>
02292     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3, A4) const, B0 b0, B1 b1) {
02293         new (this) Event(q, mbed::callback(obj, method), b0, b1);
02294     }
02295 
02296     /** Create an event
02297      *  @see Event::Event
02298      */
02299     template <typename T, typename R, typename B0, typename B1>
02300     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3, A4) volatile, B0 b0, B1 b1) {
02301         new (this) Event(q, mbed::callback(obj, method), b0, b1);
02302     }
02303 
02304     /** Create an event
02305      *  @see Event::Event
02306      */
02307     template <typename T, typename R, typename B0, typename B1>
02308     Event(EventQueue *q, const volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3, A4) const volatile, B0 b0, B1 b1) {
02309         new (this) Event(q, mbed::callback(obj, method), b0, b1);
02310     }
02311 
02312     /** Create an event
02313      *  @see Event::Event
02314      */
02315     template <typename T, typename R, typename B0, typename B1, typename B2>
02316     Event(EventQueue *q, T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3, A4), B0 b0, B1 b1, B2 b2) {
02317         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
02318     }
02319 
02320     /** Create an event
02321      *  @see Event::Event
02322      */
02323     template <typename T, typename R, typename B0, typename B1, typename B2>
02324     Event(EventQueue *q, const T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) const, B0 b0, B1 b1, B2 b2) {
02325         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
02326     }
02327 
02328     /** Create an event
02329      *  @see Event::Event
02330      */
02331     template <typename T, typename R, typename B0, typename B1, typename B2>
02332     Event(EventQueue *q, volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) volatile, B0 b0, B1 b1, B2 b2) {
02333         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
02334     }
02335 
02336     /** Create an event
02337      *  @see Event::Event
02338      */
02339     template <typename T, typename R, typename B0, typename B1, typename B2>
02340     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) {
02341         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2);
02342     }
02343 
02344     /** Create an event
02345      *  @see Event::Event
02346      */
02347     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
02348     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) {
02349         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
02350     }
02351 
02352     /** Create an event
02353      *  @see Event::Event
02354      */
02355     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
02356     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) {
02357         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
02358     }
02359 
02360     /** Create an event
02361      *  @see Event::Event
02362      */
02363     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
02364     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) {
02365         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
02366     }
02367 
02368     /** Create an event
02369      *  @see Event::Event
02370      */
02371     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3>
02372     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) {
02373         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3);
02374     }
02375 
02376     /** Create an event
02377      *  @see Event::Event
02378      */
02379     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
02380     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) {
02381         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
02382     }
02383 
02384     /** Create an event
02385      *  @see Event::Event
02386      */
02387     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
02388     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) {
02389         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
02390     }
02391 
02392     /** Create an event
02393      *  @see Event::Event
02394      */
02395     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
02396     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) {
02397         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
02398     }
02399 
02400     /** Create an event
02401      *  @see Event::Event
02402      */
02403     template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename B4>
02404     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) {
02405         new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4);
02406     }
02407 };
02408 
02409 
02410 
02411 // Convenience functions declared here to avoid cyclic
02412 // dependency between Event and EventQueue
02413 template <typename R>
02414 Event<void()> EventQueue::event(R (*func)()) {
02415     return Event<void()>(this, func);
02416 }
02417 
02418 template <typename T, typename R>
02419 Event<void()> EventQueue::event(T *obj, R (T::*method)()) {
02420     return Event<void()>(this, mbed::callback(obj, method));
02421 }
02422 
02423 template <typename T, typename R>
02424 Event<void()> EventQueue::event(const T *obj, R (T::*method)() const) {
02425     return Event<void()>(this, mbed::callback(obj, method));
02426 }
02427 
02428 template <typename T, typename R>
02429 Event<void()> EventQueue::event(volatile T *obj, R (T::*method)() volatile) {
02430     return Event<void()>(this, mbed::callback(obj, method));
02431 }
02432 
02433 template <typename T, typename R>
02434 Event<void()> EventQueue::event(const volatile T *obj, R (T::*method)() const volatile) {
02435     return Event<void()>(this, mbed::callback(obj, method));
02436 }
02437 
02438 template <typename R>
02439 Event<void()> EventQueue::event(mbed::Callback<R()> cb) {
02440     return Event<void()>(this, cb);
02441 }
02442 
02443 template <typename R, typename B0, typename C0>
02444 Event<void()> EventQueue::event(R (*func)(B0), C0 c0) {
02445     return Event<void()>(this, func, c0);
02446 }
02447 
02448 template <typename T, typename R, typename B0, typename C0>
02449 Event<void()> EventQueue::event(T *obj, R (T::*method)(B0), C0 c0) {
02450     return Event<void()>(this, mbed::callback(obj, method), c0);
02451 }
02452 
02453 template <typename T, typename R, typename B0, typename C0>
02454 Event<void()> EventQueue::event(const T *obj, R (T::*method)(B0) const, C0 c0) {
02455     return Event<void()>(this, mbed::callback(obj, method), c0);
02456 }
02457 
02458 template <typename T, typename R, typename B0, typename C0>
02459 Event<void()> EventQueue::event(volatile T *obj, R (T::*method)(B0) volatile, C0 c0) {
02460     return Event<void()>(this, mbed::callback(obj, method), c0);
02461 }
02462 
02463 template <typename T, typename R, typename B0, typename C0>
02464 Event<void()> EventQueue::event(const volatile T *obj, R (T::*method)(B0) const volatile, C0 c0) {
02465     return Event<void()>(this, mbed::callback(obj, method), c0);
02466 }
02467 
02468 template <typename R, typename B0, typename C0>
02469 Event<void()> EventQueue::event(mbed::Callback<R(B0)> cb, C0 c0) {
02470     return Event<void()>(this, cb, c0);
02471 }
02472 
02473 template <typename R, typename B0, typename B1, typename C0, typename C1>
02474 Event<void()> EventQueue::event(R (*func)(B0, B1), C0 c0, C1 c1) {
02475     return Event<void()>(this, func, c0, c1);
02476 }
02477 
02478 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1>
02479 Event<void()> EventQueue::event(T *obj, R (T::*method)(B0, B1), C0 c0, C1 c1) {
02480     return Event<void()>(this, mbed::callback(obj, method), c0, c1);
02481 }
02482 
02483 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1>
02484 Event<void()> EventQueue::event(const T *obj, R (T::*method)(B0, B1) const, C0 c0, C1 c1) {
02485     return Event<void()>(this, mbed::callback(obj, method), c0, c1);
02486 }
02487 
02488 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1>
02489 Event<void()> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1) volatile, C0 c0, C1 c1) {
02490     return Event<void()>(this, mbed::callback(obj, method), c0, c1);
02491 }
02492 
02493 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1>
02494 Event<void()> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1) const volatile, C0 c0, C1 c1) {
02495     return Event<void()>(this, mbed::callback(obj, method), c0, c1);
02496 }
02497 
02498 template <typename R, typename B0, typename B1, typename C0, typename C1>
02499 Event<void()> EventQueue::event(mbed::Callback<R(B0, B1)> cb, C0 c0, C1 c1) {
02500     return Event<void()>(this, cb, c0, c1);
02501 }
02502 
02503 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2>
02504 Event<void()> EventQueue::event(R (*func)(B0, B1, B2), C0 c0, C1 c1, C2 c2) {
02505     return Event<void()>(this, func, c0, c1, c2);
02506 }
02507 
02508 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2>
02509 Event<void()> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2), C0 c0, C1 c1, C2 c2) {
02510     return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2);
02511 }
02512 
02513 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2>
02514 Event<void()> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2) const, C0 c0, C1 c1, C2 c2) {
02515     return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2);
02516 }
02517 
02518 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2>
02519 Event<void()> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2) volatile, C0 c0, C1 c1, C2 c2) {
02520     return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2);
02521 }
02522 
02523 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2>
02524 Event<void()> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2) const volatile, C0 c0, C1 c1, C2 c2) {
02525     return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2);
02526 }
02527 
02528 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2>
02529 Event<void()> EventQueue::event(mbed::Callback<R(B0, B1, B2)> cb, C0 c0, C1 c1, C2 c2) {
02530     return Event<void()>(this, cb, c0, c1, c2);
02531 }
02532 
02533 template <typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3>
02534 Event<void()> EventQueue::event(R (*func)(B0, B1, B2, B3), C0 c0, C1 c1, C2 c2, C3 c3) {
02535     return Event<void()>(this, func, c0, c1, c2, c3);
02536 }
02537 
02538 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3>
02539 Event<void()> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3), C0 c0, C1 c1, C2 c2, C3 c3) {
02540     return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3);
02541 }
02542 
02543 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3>
02544 Event<void()> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, B3) const, C0 c0, C1 c1, C2 c2, C3 c3) {
02545     return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3);
02546 }
02547 
02548 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3>
02549 Event<void()> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, B3) volatile, C0 c0, C1 c1, C2 c2, C3 c3) {
02550     return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3);
02551 }
02552 
02553 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3>
02554 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) {
02555     return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3);
02556 }
02557 
02558 template <typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3>
02559 Event<void()> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3)> cb, C0 c0, C1 c1, C2 c2, C3 c3) {
02560     return Event<void()>(this, cb, c0, c1, c2, c3);
02561 }
02562 
02563 template <typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4>
02564 Event<void()> EventQueue::event(R (*func)(B0, B1, B2, B3, B4), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
02565     return Event<void()>(this, func, c0, c1, c2, c3, c4);
02566 }
02567 
02568 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>
02569 Event<void()> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3, B4), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
02570     return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
02571 }
02572 
02573 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>
02574 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) {
02575     return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
02576 }
02577 
02578 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>
02579 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) {
02580     return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
02581 }
02582 
02583 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>
02584 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) {
02585     return Event<void()>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
02586 }
02587 
02588 template <typename R, typename B0, typename B1, typename B2, typename B3, typename B4, typename C0, typename C1, typename C2, typename C3, typename C4>
02589 Event<void()> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3, B4)> cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
02590     return Event<void()>(this, cb, c0, c1, c2, c3, c4);
02591 }
02592 
02593 template <typename R, typename A0>
02594 Event<void(A0)> EventQueue::event(R (*func)(A0)) {
02595     return Event<void(A0)>(this, func);
02596 }
02597 
02598 template <typename T, typename R, typename A0>
02599 Event<void(A0)> EventQueue::event(T *obj, R (T::*method)(A0)) {
02600     return Event<void(A0)>(this, mbed::callback(obj, method));
02601 }
02602 
02603 template <typename T, typename R, typename A0>
02604 Event<void(A0)> EventQueue::event(const T *obj, R (T::*method)(A0) const) {
02605     return Event<void(A0)>(this, mbed::callback(obj, method));
02606 }
02607 
02608 template <typename T, typename R, typename A0>
02609 Event<void(A0)> EventQueue::event(volatile T *obj, R (T::*method)(A0) volatile) {
02610     return Event<void(A0)>(this, mbed::callback(obj, method));
02611 }
02612 
02613 template <typename T, typename R, typename A0>
02614 Event<void(A0)> EventQueue::event(const volatile T *obj, R (T::*method)(A0) const volatile) {
02615     return Event<void(A0)>(this, mbed::callback(obj, method));
02616 }
02617 
02618 template <typename R, typename A0>
02619 Event<void(A0)> EventQueue::event(mbed::Callback<R(A0)> cb) {
02620     return Event<void(A0)>(this, cb);
02621 }
02622 
02623 template <typename R, typename B0, typename C0, typename A0>
02624 Event<void(A0)> EventQueue::event(R (*func)(B0, A0), C0 c0) {
02625     return Event<void(A0)>(this, func, c0);
02626 }
02627 
02628 template <typename T, typename R, typename B0, typename C0, typename A0>
02629 Event<void(A0)> EventQueue::event(T *obj, R (T::*method)(B0, A0), C0 c0) {
02630     return Event<void(A0)>(this, mbed::callback(obj, method), c0);
02631 }
02632 
02633 template <typename T, typename R, typename B0, typename C0, typename A0>
02634 Event<void(A0)> EventQueue::event(const T *obj, R (T::*method)(B0, A0) const, C0 c0) {
02635     return Event<void(A0)>(this, mbed::callback(obj, method), c0);
02636 }
02637 
02638 template <typename T, typename R, typename B0, typename C0, typename A0>
02639 Event<void(A0)> EventQueue::event(volatile T *obj, R (T::*method)(B0, A0) volatile, C0 c0) {
02640     return Event<void(A0)>(this, mbed::callback(obj, method), c0);
02641 }
02642 
02643 template <typename T, typename R, typename B0, typename C0, typename A0>
02644 Event<void(A0)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, A0) const volatile, C0 c0) {
02645     return Event<void(A0)>(this, mbed::callback(obj, method), c0);
02646 }
02647 
02648 template <typename R, typename B0, typename C0, typename A0>
02649 Event<void(A0)> EventQueue::event(mbed::Callback<R(B0, A0)> cb, C0 c0) {
02650     return Event<void(A0)>(this, cb, c0);
02651 }
02652 
02653 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0>
02654 Event<void(A0)> EventQueue::event(R (*func)(B0, B1, A0), C0 c0, C1 c1) {
02655     return Event<void(A0)>(this, func, c0, c1);
02656 }
02657 
02658 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0>
02659 Event<void(A0)> EventQueue::event(T *obj, R (T::*method)(B0, B1, A0), C0 c0, C1 c1) {
02660     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1);
02661 }
02662 
02663 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0>
02664 Event<void(A0)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, A0) const, C0 c0, C1 c1) {
02665     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1);
02666 }
02667 
02668 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0>
02669 Event<void(A0)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, A0) volatile, C0 c0, C1 c1) {
02670     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1);
02671 }
02672 
02673 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0>
02674 Event<void(A0)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, A0) const volatile, C0 c0, C1 c1) {
02675     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1);
02676 }
02677 
02678 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0>
02679 Event<void(A0)> EventQueue::event(mbed::Callback<R(B0, B1, A0)> cb, C0 c0, C1 c1) {
02680     return Event<void(A0)>(this, cb, c0, c1);
02681 }
02682 
02683 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0>
02684 Event<void(A0)> EventQueue::event(R (*func)(B0, B1, B2, A0), C0 c0, C1 c1, C2 c2) {
02685     return Event<void(A0)>(this, func, c0, c1, c2);
02686 }
02687 
02688 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0>
02689 Event<void(A0)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, A0), C0 c0, C1 c1, C2 c2) {
02690     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2);
02691 }
02692 
02693 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0>
02694 Event<void(A0)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, A0) const, C0 c0, C1 c1, C2 c2) {
02695     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2);
02696 }
02697 
02698 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0>
02699 Event<void(A0)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, A0) volatile, C0 c0, C1 c1, C2 c2) {
02700     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2);
02701 }
02702 
02703 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0>
02704 Event<void(A0)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, B2, A0) const volatile, C0 c0, C1 c1, C2 c2) {
02705     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2);
02706 }
02707 
02708 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0>
02709 Event<void(A0)> EventQueue::event(mbed::Callback<R(B0, B1, B2, A0)> cb, C0 c0, C1 c1, C2 c2) {
02710     return Event<void(A0)>(this, cb, c0, c1, c2);
02711 }
02712 
02713 template <typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0>
02714 Event<void(A0)> EventQueue::event(R (*func)(B0, B1, B2, B3, A0), C0 c0, C1 c1, C2 c2, C3 c3) {
02715     return Event<void(A0)>(this, func, c0, c1, c2, c3);
02716 }
02717 
02718 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0>
02719 Event<void(A0)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, B3, A0), C0 c0, C1 c1, C2 c2, C3 c3) {
02720     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
02721 }
02722 
02723 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0>
02724 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) {
02725     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
02726 }
02727 
02728 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0>
02729 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) {
02730     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
02731 }
02732 
02733 template <typename T, typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0>
02734 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) {
02735     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
02736 }
02737 
02738 template <typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0>
02739 Event<void(A0)> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3, A0)> cb, C0 c0, C1 c1, C2 c2, C3 c3) {
02740     return Event<void(A0)>(this, cb, c0, c1, c2, c3);
02741 }
02742 
02743 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>
02744 Event<void(A0)> EventQueue::event(R (*func)(B0, B1, B2, B3, B4, A0), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
02745     return Event<void(A0)>(this, func, c0, c1, c2, c3, c4);
02746 }
02747 
02748 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>
02749 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) {
02750     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
02751 }
02752 
02753 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>
02754 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) {
02755     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
02756 }
02757 
02758 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>
02759 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) {
02760     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
02761 }
02762 
02763 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>
02764 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) {
02765     return Event<void(A0)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
02766 }
02767 
02768 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>
02769 Event<void(A0)> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3, B4, A0)> cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
02770     return Event<void(A0)>(this, cb, c0, c1, c2, c3, c4);
02771 }
02772 
02773 template <typename R, typename A0, typename A1>
02774 Event<void(A0, A1)> EventQueue::event(R (*func)(A0, A1)) {
02775     return Event<void(A0, A1)>(this, func);
02776 }
02777 
02778 template <typename T, typename R, typename A0, typename A1>
02779 Event<void(A0, A1)> EventQueue::event(T *obj, R (T::*method)(A0, A1)) {
02780     return Event<void(A0, A1)>(this, mbed::callback(obj, method));
02781 }
02782 
02783 template <typename T, typename R, typename A0, typename A1>
02784 Event<void(A0, A1)> EventQueue::event(const T *obj, R (T::*method)(A0, A1) const) {
02785     return Event<void(A0, A1)>(this, mbed::callback(obj, method));
02786 }
02787 
02788 template <typename T, typename R, typename A0, typename A1>
02789 Event<void(A0, A1)> EventQueue::event(volatile T *obj, R (T::*method)(A0, A1) volatile) {
02790     return Event<void(A0, A1)>(this, mbed::callback(obj, method));
02791 }
02792 
02793 template <typename T, typename R, typename A0, typename A1>
02794 Event<void(A0, A1)> EventQueue::event(const volatile T *obj, R (T::*method)(A0, A1) const volatile) {
02795     return Event<void(A0, A1)>(this, mbed::callback(obj, method));
02796 }
02797 
02798 template <typename R, typename A0, typename A1>
02799 Event<void(A0, A1)> EventQueue::event(mbed::Callback<R(A0, A1)> cb) {
02800     return Event<void(A0, A1)>(this, cb);
02801 }
02802 
02803 template <typename R, typename B0, typename C0, typename A0, typename A1>
02804 Event<void(A0, A1)> EventQueue::event(R (*func)(B0, A0, A1), C0 c0) {
02805     return Event<void(A0, A1)>(this, func, c0);
02806 }
02807 
02808 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1>
02809 Event<void(A0, A1)> EventQueue::event(T *obj, R (T::*method)(B0, A0, A1), C0 c0) {
02810     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0);
02811 }
02812 
02813 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1>
02814 Event<void(A0, A1)> EventQueue::event(const T *obj, R (T::*method)(B0, A0, A1) const, C0 c0) {
02815     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0);
02816 }
02817 
02818 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1>
02819 Event<void(A0, A1)> EventQueue::event(volatile T *obj, R (T::*method)(B0, A0, A1) volatile, C0 c0) {
02820     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0);
02821 }
02822 
02823 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1>
02824 Event<void(A0, A1)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, A0, A1) const volatile, C0 c0) {
02825     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0);
02826 }
02827 
02828 template <typename R, typename B0, typename C0, typename A0, typename A1>
02829 Event<void(A0, A1)> EventQueue::event(mbed::Callback<R(B0, A0, A1)> cb, C0 c0) {
02830     return Event<void(A0, A1)>(this, cb, c0);
02831 }
02832 
02833 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1>
02834 Event<void(A0, A1)> EventQueue::event(R (*func)(B0, B1, A0, A1), C0 c0, C1 c1) {
02835     return Event<void(A0, A1)>(this, func, c0, c1);
02836 }
02837 
02838 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1>
02839 Event<void(A0, A1)> EventQueue::event(T *obj, R (T::*method)(B0, B1, A0, A1), C0 c0, C1 c1) {
02840     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1);
02841 }
02842 
02843 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1>
02844 Event<void(A0, A1)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, A0, A1) const, C0 c0, C1 c1) {
02845     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1);
02846 }
02847 
02848 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1>
02849 Event<void(A0, A1)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, A0, A1) volatile, C0 c0, C1 c1) {
02850     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1);
02851 }
02852 
02853 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1>
02854 Event<void(A0, A1)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, B1, A0, A1) const volatile, C0 c0, C1 c1) {
02855     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1);
02856 }
02857 
02858 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1>
02859 Event<void(A0, A1)> EventQueue::event(mbed::Callback<R(B0, B1, A0, A1)> cb, C0 c0, C1 c1) {
02860     return Event<void(A0, A1)>(this, cb, c0, c1);
02861 }
02862 
02863 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1>
02864 Event<void(A0, A1)> EventQueue::event(R (*func)(B0, B1, B2, A0, A1), C0 c0, C1 c1, C2 c2) {
02865     return Event<void(A0, A1)>(this, func, c0, c1, c2);
02866 }
02867 
02868 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1>
02869 Event<void(A0, A1)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, A0, A1), C0 c0, C1 c1, C2 c2) {
02870     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2);
02871 }
02872 
02873 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1>
02874 Event<void(A0, A1)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, B2, A0, A1) const, C0 c0, C1 c1, C2 c2) {
02875     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2);
02876 }
02877 
02878 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1>
02879 Event<void(A0, A1)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, B2, A0, A1) volatile, C0 c0, C1 c1, C2 c2) {
02880     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2);
02881 }
02882 
02883 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1>
02884 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) {
02885     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2);
02886 }
02887 
02888 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1>
02889 Event<void(A0, A1)> EventQueue::event(mbed::Callback<R(B0, B1, B2, A0, A1)> cb, C0 c0, C1 c1, C2 c2) {
02890     return Event<void(A0, A1)>(this, cb, c0, c1, c2);
02891 }
02892 
02893 template <typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1>
02894 Event<void(A0, A1)> EventQueue::event(R (*func)(B0, B1, B2, B3, A0, A1), C0 c0, C1 c1, C2 c2, C3 c3) {
02895     return Event<void(A0, A1)>(this, func, c0, c1, c2, c3);
02896 }
02897 
02898 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>
02899 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) {
02900     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
02901 }
02902 
02903 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>
02904 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) {
02905     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
02906 }
02907 
02908 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>
02909 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) {
02910     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
02911 }
02912 
02913 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>
02914 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) {
02915     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
02916 }
02917 
02918 template <typename R, typename B0, typename B1, typename B2, typename B3, typename C0, typename C1, typename C2, typename C3, typename A0, typename A1>
02919 Event<void(A0, A1)> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3, A0, A1)> cb, C0 c0, C1 c1, C2 c2, C3 c3) {
02920     return Event<void(A0, A1)>(this, cb, c0, c1, c2, c3);
02921 }
02922 
02923 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>
02924 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) {
02925     return Event<void(A0, A1)>(this, func, c0, c1, c2, c3, c4);
02926 }
02927 
02928 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>
02929 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) {
02930     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
02931 }
02932 
02933 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>
02934 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) {
02935     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
02936 }
02937 
02938 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>
02939 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) {
02940     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
02941 }
02942 
02943 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>
02944 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) {
02945     return Event<void(A0, A1)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
02946 }
02947 
02948 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>
02949 Event<void(A0, A1)> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3, B4, A0, A1)> cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
02950     return Event<void(A0, A1)>(this, cb, c0, c1, c2, c3, c4);
02951 }
02952 
02953 template <typename R, typename A0, typename A1, typename A2>
02954 Event<void(A0, A1, A2)> EventQueue::event(R (*func)(A0, A1, A2)) {
02955     return Event<void(A0, A1, A2)>(this, func);
02956 }
02957 
02958 template <typename T, typename R, typename A0, typename A1, typename A2>
02959 Event<void(A0, A1, A2)> EventQueue::event(T *obj, R (T::*method)(A0, A1, A2)) {
02960     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method));
02961 }
02962 
02963 template <typename T, typename R, typename A0, typename A1, typename A2>
02964 Event<void(A0, A1, A2)> EventQueue::event(const T *obj, R (T::*method)(A0, A1, A2) const) {
02965     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method));
02966 }
02967 
02968 template <typename T, typename R, typename A0, typename A1, typename A2>
02969 Event<void(A0, A1, A2)> EventQueue::event(volatile T *obj, R (T::*method)(A0, A1, A2) volatile) {
02970     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method));
02971 }
02972 
02973 template <typename T, typename R, typename A0, typename A1, typename A2>
02974 Event<void(A0, A1, A2)> EventQueue::event(const volatile T *obj, R (T::*method)(A0, A1, A2) const volatile) {
02975     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method));
02976 }
02977 
02978 template <typename R, typename A0, typename A1, typename A2>
02979 Event<void(A0, A1, A2)> EventQueue::event(mbed::Callback<R(A0, A1, A2)> cb) {
02980     return Event<void(A0, A1, A2)>(this, cb);
02981 }
02982 
02983 template <typename R, typename B0, typename C0, typename A0, typename A1, typename A2>
02984 Event<void(A0, A1, A2)> EventQueue::event(R (*func)(B0, A0, A1, A2), C0 c0) {
02985     return Event<void(A0, A1, A2)>(this, func, c0);
02986 }
02987 
02988 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2>
02989 Event<void(A0, A1, A2)> EventQueue::event(T *obj, R (T::*method)(B0, A0, A1, A2), C0 c0) {
02990     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0);
02991 }
02992 
02993 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2>
02994 Event<void(A0, A1, A2)> EventQueue::event(const T *obj, R (T::*method)(B0, A0, A1, A2) const, C0 c0) {
02995     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0);
02996 }
02997 
02998 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2>
02999 Event<void(A0, A1, A2)> EventQueue::event(volatile T *obj, R (T::*method)(B0, A0, A1, A2) volatile, C0 c0) {
03000     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0);
03001 }
03002 
03003 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2>
03004 Event<void(A0, A1, A2)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, A0, A1, A2) const volatile, C0 c0) {
03005     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0);
03006 }
03007 
03008 template <typename R, typename B0, typename C0, typename A0, typename A1, typename A2>
03009 Event<void(A0, A1, A2)> EventQueue::event(mbed::Callback<R(B0, A0, A1, A2)> cb, C0 c0) {
03010     return Event<void(A0, A1, A2)>(this, cb, c0);
03011 }
03012 
03013 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2>
03014 Event<void(A0, A1, A2)> EventQueue::event(R (*func)(B0, B1, A0, A1, A2), C0 c0, C1 c1) {
03015     return Event<void(A0, A1, A2)>(this, func, c0, c1);
03016 }
03017 
03018 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2>
03019 Event<void(A0, A1, A2)> EventQueue::event(T *obj, R (T::*method)(B0, B1, A0, A1, A2), C0 c0, C1 c1) {
03020     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1);
03021 }
03022 
03023 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2>
03024 Event<void(A0, A1, A2)> EventQueue::event(const T *obj, R (T::*method)(B0, B1, A0, A1, A2) const, C0 c0, C1 c1) {
03025     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1);
03026 }
03027 
03028 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2>
03029 Event<void(A0, A1, A2)> EventQueue::event(volatile T *obj, R (T::*method)(B0, B1, A0, A1, A2) volatile, C0 c0, C1 c1) {
03030     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1);
03031 }
03032 
03033 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2>
03034 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) {
03035     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1);
03036 }
03037 
03038 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2>
03039 Event<void(A0, A1, A2)> EventQueue::event(mbed::Callback<R(B0, B1, A0, A1, A2)> cb, C0 c0, C1 c1) {
03040     return Event<void(A0, A1, A2)>(this, cb, c0, c1);
03041 }
03042 
03043 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2>
03044 Event<void(A0, A1, A2)> EventQueue::event(R (*func)(B0, B1, B2, A0, A1, A2), C0 c0, C1 c1, C2 c2) {
03045     return Event<void(A0, A1, A2)>(this, func, c0, c1, c2);
03046 }
03047 
03048 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2>
03049 Event<void(A0, A1, A2)> EventQueue::event(T *obj, R (T::*method)(B0, B1, B2, A0, A1, A2), C0 c0, C1 c1, C2 c2) {
03050     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2);
03051 }
03052 
03053 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2>
03054 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) {
03055     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2);
03056 }
03057 
03058 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2>
03059 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) {
03060     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2);
03061 }
03062 
03063 template <typename T, typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2>
03064 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) {
03065     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2);
03066 }
03067 
03068 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2>
03069 Event<void(A0, A1, A2)> EventQueue::event(mbed::Callback<R(B0, B1, B2, A0, A1, A2)> cb, C0 c0, C1 c1, C2 c2) {
03070     return Event<void(A0, A1, A2)>(this, cb, c0, c1, c2);
03071 }
03072 
03073 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>
03074 Event<void(A0, A1, A2)> EventQueue::event(R (*func)(B0, B1, B2, B3, A0, A1, A2), C0 c0, C1 c1, C2 c2, C3 c3) {
03075     return Event<void(A0, A1, A2)>(this, func, c0, c1, c2, c3);
03076 }
03077 
03078 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>
03079 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) {
03080     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
03081 }
03082 
03083 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>
03084 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) {
03085     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
03086 }
03087 
03088 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>
03089 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) {
03090     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
03091 }
03092 
03093 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>
03094 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) {
03095     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
03096 }
03097 
03098 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>
03099 Event<void(A0, A1, A2)> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3, A0, A1, A2)> cb, C0 c0, C1 c1, C2 c2, C3 c3) {
03100     return Event<void(A0, A1, A2)>(this, cb, c0, c1, c2, c3);
03101 }
03102 
03103 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>
03104 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) {
03105     return Event<void(A0, A1, A2)>(this, func, c0, c1, c2, c3, c4);
03106 }
03107 
03108 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>
03109 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) {
03110     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
03111 }
03112 
03113 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>
03114 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) {
03115     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
03116 }
03117 
03118 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>
03119 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) {
03120     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
03121 }
03122 
03123 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>
03124 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) {
03125     return Event<void(A0, A1, A2)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
03126 }
03127 
03128 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>
03129 Event<void(A0, A1, A2)> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3, B4, A0, A1, A2)> cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
03130     return Event<void(A0, A1, A2)>(this, cb, c0, c1, c2, c3, c4);
03131 }
03132 
03133 template <typename R, typename A0, typename A1, typename A2, typename A3>
03134 Event<void(A0, A1, A2, A3)> EventQueue::event(R (*func)(A0, A1, A2, A3)) {
03135     return Event<void(A0, A1, A2, A3)>(this, func);
03136 }
03137 
03138 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
03139 Event<void(A0, A1, A2, A3)> EventQueue::event(T *obj, R (T::*method)(A0, A1, A2, A3)) {
03140     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method));
03141 }
03142 
03143 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
03144 Event<void(A0, A1, A2, A3)> EventQueue::event(const T *obj, R (T::*method)(A0, A1, A2, A3) const) {
03145     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method));
03146 }
03147 
03148 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
03149 Event<void(A0, A1, A2, A3)> EventQueue::event(volatile T *obj, R (T::*method)(A0, A1, A2, A3) volatile) {
03150     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method));
03151 }
03152 
03153 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3>
03154 Event<void(A0, A1, A2, A3)> EventQueue::event(const volatile T *obj, R (T::*method)(A0, A1, A2, A3) const volatile) {
03155     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method));
03156 }
03157 
03158 template <typename R, typename A0, typename A1, typename A2, typename A3>
03159 Event<void(A0, A1, A2, A3)> EventQueue::event(mbed::Callback<R(A0, A1, A2, A3)> cb) {
03160     return Event<void(A0, A1, A2, A3)>(this, cb);
03161 }
03162 
03163 template <typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3>
03164 Event<void(A0, A1, A2, A3)> EventQueue::event(R (*func)(B0, A0, A1, A2, A3), C0 c0) {
03165     return Event<void(A0, A1, A2, A3)>(this, func, c0);
03166 }
03167 
03168 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3>
03169 Event<void(A0, A1, A2, A3)> EventQueue::event(T *obj, R (T::*method)(B0, A0, A1, A2, A3), C0 c0) {
03170     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0);
03171 }
03172 
03173 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3>
03174 Event<void(A0, A1, A2, A3)> EventQueue::event(const T *obj, R (T::*method)(B0, A0, A1, A2, A3) const, C0 c0) {
03175     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0);
03176 }
03177 
03178 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3>
03179 Event<void(A0, A1, A2, A3)> EventQueue::event(volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3) volatile, C0 c0) {
03180     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0);
03181 }
03182 
03183 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3>
03184 Event<void(A0, A1, A2, A3)> EventQueue::event(const volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3) const volatile, C0 c0) {
03185     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0);
03186 }
03187 
03188 template <typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3>
03189 Event<void(A0, A1, A2, A3)> EventQueue::event(mbed::Callback<R(B0, A0, A1, A2, A3)> cb, C0 c0) {
03190     return Event<void(A0, A1, A2, A3)>(this, cb, c0);
03191 }
03192 
03193 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3>
03194 Event<void(A0, A1, A2, A3)> EventQueue::event(R (*func)(B0, B1, A0, A1, A2, A3), C0 c0, C1 c1) {
03195     return Event<void(A0, A1, A2, A3)>(this, func, c0, c1);
03196 }
03197 
03198 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3>
03199 Event<void(A0, A1, A2, A3)> EventQueue::event(T *obj, R (T::*method)(B0, B1, A0, A1, A2, A3), C0 c0, C1 c1) {
03200     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1);
03201 }
03202 
03203 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3>
03204 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) {
03205     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1);
03206 }
03207 
03208 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3>
03209 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) {
03210     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1);
03211 }
03212 
03213 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3>
03214 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) {
03215     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1);
03216 }
03217 
03218 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3>
03219 Event<void(A0, A1, A2, A3)> EventQueue::event(mbed::Callback<R(B0, B1, A0, A1, A2, A3)> cb, C0 c0, C1 c1) {
03220     return Event<void(A0, A1, A2, A3)>(this, cb, c0, c1);
03221 }
03222 
03223 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2, typename A3>
03224 Event<void(A0, A1, A2, A3)> EventQueue::event(R (*func)(B0, B1, B2, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2) {
03225     return Event<void(A0, A1, A2, A3)>(this, func, c0, c1, c2);
03226 }
03227 
03228 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>
03229 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) {
03230     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2);
03231 }
03232 
03233 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>
03234 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) {
03235     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2);
03236 }
03237 
03238 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>
03239 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) {
03240     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2);
03241 }
03242 
03243 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>
03244 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) {
03245     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2);
03246 }
03247 
03248 template <typename R, typename B0, typename B1, typename B2, typename C0, typename C1, typename C2, typename A0, typename A1, typename A2, typename A3>
03249 Event<void(A0, A1, A2, A3)> EventQueue::event(mbed::Callback<R(B0, B1, B2, A0, A1, A2, A3)> cb, C0 c0, C1 c1, C2 c2) {
03250     return Event<void(A0, A1, A2, A3)>(this, cb, c0, c1, c2);
03251 }
03252 
03253 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>
03254 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) {
03255     return Event<void(A0, A1, A2, A3)>(this, func, c0, c1, c2, c3);
03256 }
03257 
03258 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>
03259 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) {
03260     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
03261 }
03262 
03263 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>
03264 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) {
03265     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
03266 }
03267 
03268 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>
03269 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) {
03270     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
03271 }
03272 
03273 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>
03274 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) {
03275     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
03276 }
03277 
03278 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>
03279 Event<void(A0, A1, A2, A3)> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3, A0, A1, A2, A3)> cb, C0 c0, C1 c1, C2 c2, C3 c3) {
03280     return Event<void(A0, A1, A2, A3)>(this, cb, c0, c1, c2, c3);
03281 }
03282 
03283 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>
03284 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) {
03285     return Event<void(A0, A1, A2, A3)>(this, func, c0, c1, c2, c3, c4);
03286 }
03287 
03288 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>
03289 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) {
03290     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
03291 }
03292 
03293 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>
03294 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) {
03295     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
03296 }
03297 
03298 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>
03299 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) {
03300     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
03301 }
03302 
03303 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>
03304 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) {
03305     return Event<void(A0, A1, A2, A3)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
03306 }
03307 
03308 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>
03309 Event<void(A0, A1, A2, A3)> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3, B4, A0, A1, A2, A3)> cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
03310     return Event<void(A0, A1, A2, A3)>(this, cb, c0, c1, c2, c3, c4);
03311 }
03312 
03313 template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
03314 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(R (*func)(A0, A1, A2, A3, A4)) {
03315     return Event<void(A0, A1, A2, A3, A4)>(this, func);
03316 }
03317 
03318 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
03319 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(T *obj, R (T::*method)(A0, A1, A2, A3, A4)) {
03320     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method));
03321 }
03322 
03323 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
03324 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const T *obj, R (T::*method)(A0, A1, A2, A3, A4) const) {
03325     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method));
03326 }
03327 
03328 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
03329 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(volatile T *obj, R (T::*method)(A0, A1, A2, A3, A4) volatile) {
03330     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method));
03331 }
03332 
03333 template <typename T, typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
03334 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const volatile T *obj, R (T::*method)(A0, A1, A2, A3, A4) const volatile) {
03335     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method));
03336 }
03337 
03338 template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4>
03339 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(mbed::Callback<R(A0, A1, A2, A3, A4)> cb) {
03340     return Event<void(A0, A1, A2, A3, A4)>(this, cb);
03341 }
03342 
03343 template <typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3, typename A4>
03344 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(R (*func)(B0, A0, A1, A2, A3, A4), C0 c0) {
03345     return Event<void(A0, A1, A2, A3, A4)>(this, func, c0);
03346 }
03347 
03348 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3, typename A4>
03349 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4), C0 c0) {
03350     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0);
03351 }
03352 
03353 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3, typename A4>
03354 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(const T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4) const, C0 c0) {
03355     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0);
03356 }
03357 
03358 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3, typename A4>
03359 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(volatile T *obj, R (T::*method)(B0, A0, A1, A2, A3, A4) volatile, C0 c0) {
03360     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0);
03361 }
03362 
03363 template <typename T, typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3, typename A4>
03364 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) {
03365     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0);
03366 }
03367 
03368 template <typename R, typename B0, typename C0, typename A0, typename A1, typename A2, typename A3, typename A4>
03369 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(mbed::Callback<R(B0, A0, A1, A2, A3, A4)> cb, C0 c0) {
03370     return Event<void(A0, A1, A2, A3, A4)>(this, cb, c0);
03371 }
03372 
03373 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3, typename A4>
03374 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(R (*func)(B0, B1, A0, A1, A2, A3, A4), C0 c0, C1 c1) {
03375     return Event<void(A0, A1, A2, A3, A4)>(this, func, c0, c1);
03376 }
03377 
03378 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3, typename A4>
03379 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) {
03380     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1);
03381 }
03382 
03383 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3, typename A4>
03384 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) {
03385     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1);
03386 }
03387 
03388 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3, typename A4>
03389 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) {
03390     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1);
03391 }
03392 
03393 template <typename T, typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3, typename A4>
03394 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) {
03395     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1);
03396 }
03397 
03398 template <typename R, typename B0, typename B1, typename C0, typename C1, typename A0, typename A1, typename A2, typename A3, typename A4>
03399 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(mbed::Callback<R(B0, B1, A0, A1, A2, A3, A4)> cb, C0 c0, C1 c1) {
03400     return Event<void(A0, A1, A2, A3, A4)>(this, cb, c0, c1);
03401 }
03402 
03403 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>
03404 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) {
03405     return Event<void(A0, A1, A2, A3, A4)>(this, func, c0, c1, c2);
03406 }
03407 
03408 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>
03409 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) {
03410     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2);
03411 }
03412 
03413 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>
03414 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) {
03415     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2);
03416 }
03417 
03418 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>
03419 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) {
03420     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2);
03421 }
03422 
03423 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>
03424 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) {
03425     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2);
03426 }
03427 
03428 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>
03429 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(mbed::Callback<R(B0, B1, B2, A0, A1, A2, A3, A4)> cb, C0 c0, C1 c1, C2 c2) {
03430     return Event<void(A0, A1, A2, A3, A4)>(this, cb, c0, c1, c2);
03431 }
03432 
03433 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>
03434 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) {
03435     return Event<void(A0, A1, A2, A3, A4)>(this, func, c0, c1, c2, c3);
03436 }
03437 
03438 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>
03439 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) {
03440     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
03441 }
03442 
03443 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>
03444 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) {
03445     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
03446 }
03447 
03448 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>
03449 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) {
03450     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
03451 }
03452 
03453 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>
03454 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) {
03455     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3);
03456 }
03457 
03458 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>
03459 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3, A0, A1, A2, A3, A4)> cb, C0 c0, C1 c1, C2 c2, C3 c3) {
03460     return Event<void(A0, A1, A2, A3, A4)>(this, cb, c0, c1, c2, c3);
03461 }
03462 
03463 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>
03464 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) {
03465     return Event<void(A0, A1, A2, A3, A4)>(this, func, c0, c1, c2, c3, c4);
03466 }
03467 
03468 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>
03469 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) {
03470     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
03471 }
03472 
03473 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>
03474 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) {
03475     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
03476 }
03477 
03478 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>
03479 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) {
03480     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
03481 }
03482 
03483 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>
03484 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) {
03485     return Event<void(A0, A1, A2, A3, A4)>(this, mbed::callback(obj, method), c0, c1, c2, c3, c4);
03486 }
03487 
03488 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>
03489 Event<void(A0, A1, A2, A3, A4)> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3, B4, A0, A1, A2, A3, A4)> cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) {
03490     return Event<void(A0, A1, A2, A3, A4)>(this, cb, c0, c1, c2, c3, c4);
03491 }
03492 
03493 }
03494 
03495 #endif
03496 
03497 /** @}*/