ON Semiconductor / mbed-os

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

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