diff --git a/events/Event.h b/events/Event.h index a8a2ff6234..7f1c3840c0 100644 --- a/events/Event.h +++ b/events/Event.h @@ -36,8 +36,8 @@ class Event; * Representation of an event for fine-grain dispatch control * @ingroup events */ -template <> -class Event { +template +class Event { public: /** Create an event * @@ -45,8 +45,8 @@ public: * callback acts as the target for the event and is executed in the * context of the event queue's dispatch loop once posted. * - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched + * @param q Event queue to dispatch on + * @param f Function to execute when the event is dispatched */ template Event(EventQueue *q, F f) @@ -135,44 +135,48 @@ public: * The post function is IRQ safe and can act as a mechanism for moving * events out of IRQ contexts. * + * @param args Arguments to pass to the event * @return A unique id that represents the posted event and can * be passed to EventQueue::cancel, or an id of 0 if * there is not enough memory to allocate the event. */ - int post() const + int post(ArgTs... args) const { if (!_event) { return 0; } - _event->id = _event->post(_event); + _event->id = _event->post(_event, args...); return _event->id; } /** Posts an event onto the underlying event queue, returning void * + * @param args Arguments to pass to the event */ - void call() const + void call(ArgTs... args) const { - MBED_UNUSED int id = post(); + MBED_UNUSED int id = post(args...); MBED_ASSERT(id); } /** Posts an event onto the underlying event queue, returning void * + * @param args Arguments to pass to the event */ - void operator()() const + void operator()(ArgTs... args) const { - return call(); + return call(args...); } /** Static thunk for passing as C-style function * * @param func Event to call passed as a void pointer + * @param args Arguments to pass to the event */ - static void thunk(void *func) + static void thunk(void *func, ArgTs... args) { - return static_cast(func)->call(); + return static_cast(func)->call(args...); } /** Cancels the most recently posted event @@ -202,7 +206,7 @@ private: int delay; int period; - int (*post)(struct event *); + int (*post)(struct event *, ArgTs... args); void (*dtor)(struct event *); // F follows @@ -210,15 +214,15 @@ private: // Event attributes template - static int event_post(struct event *e) + static int event_post(struct event *e, ArgTs... args) { - typedef EventQueue::context00 C; + typedef EventQueue::context C; void *p = equeue_alloc(e->equeue, sizeof(C)); if (!p) { return 0; } - new (p) C(*(F *)(e + 1)); + new (p) C(*(F *)(e + 1), args...); equeue_event_delay(p, e->delay); equeue_event_period(p, e->period); equeue_event_dtor(p, &EventQueue::function_dtor); @@ -235,2533 +239,42 @@ public: /** Create an event * @param q Event queue to dispatch on * @param f Function to execute when the event is dispatched - * @param c0 Argument to bind to the callback, these arguments are + * @param context_args Arguments to bind to the callback, these arguments are * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0, the + * memory pool. Must be type-compatible with bound_args, the * arguments to the underlying callback. */ - template - Event(EventQueue *q, F f, C0 c0) - { - new (this) Event(q, EventQueue::context10(f, c0)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b1, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1) - { - new (this) Event(q, EventQueue::context20(f, c0, c1)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b2, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) - { - new (this) Event(q, EventQueue::context30(f, c0, c1, c2)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2,c3 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b3, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) - { - new (this) Event(q, EventQueue::context40(f, c0, c1, c2, c3)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2,c3,c4 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b4, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) - { - new (this) Event(q, EventQueue::context50(f, c0, c1, c2, c3, c4)); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0), B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0) const, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0) volatile, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0) const volatile, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1), B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1) const, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1) volatile, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1) const volatile, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2), B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, B2) const, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, B2) volatile, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1, B2) const volatile, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, B3), B0 b0, B1 b1, B2 b2, B3 b3) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, B2, B3) const, B0 b0, B1 b1, B2 b2, B3 b3) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, B2, B3) volatile, B0 b0, B1 b1, B2 b2, B3 b3) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1, B2, B3) const volatile, B0 b0, B1 b1, B2 b2, B3 b3) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, B3, B4), B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } -}; - -/** Event - * - * Representation of an event for fine-grain dispatch control - * @ingroup events - */ -template -class Event { -public: - /** Create an event - * - * Constructs an event bound to the specified event queue. The specified - * callback acts as the target for the event and is executed in the - * context of the event queue's dispatch loop once posted. - * - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - */ - template - Event(EventQueue *q, F f) - { - _event = static_cast( - equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F))); - - if (_event) { - _event->equeue = &q->_equeue; - _event->id = 0; - _event->delay = 0; - _event->period = -1; - - _event->post = &Event::event_post; - _event->dtor = &Event::event_dtor; - - new (_event + 1) F(f); - - _event->ref = 1; - } - } - - /** Copy constructor for events - */ - Event(const Event &e) - { - _event = 0; - if (e._event) { - _event = e._event; - _event->ref += 1; - } - } - - /** Assignment operator for events - */ - Event &operator=(const Event &that) - { - if (this != &that) { - this->~Event(); - new (this) Event(that); - } - - return *this; - } - - /** Destructor for events - */ - ~Event() - { - if (_event) { - _event->ref -= 1; - if (_event->ref == 0) { - _event->dtor(_event); - equeue_dealloc(_event->equeue, _event); - } - } - } - - /** Configure the delay of an event - * - * @param delay Millisecond delay before dispatching the event - */ - void delay(int delay) - { - if (_event) { - _event->delay = delay; - } - } - - /** Configure the period of an event - * - * @param period Millisecond period for repeatedly dispatching an event - */ - void period(int period) - { - if (_event) { - _event->period = period; - } - } - - /** Posts an event onto the underlying event queue - * - * The event is posted to the underlying queue and is executed in the - * context of the event queue's dispatch loop. - * - * The post function is IRQ safe and can act as a mechanism for moving - * events out of IRQ contexts. - * - * @param a0 Argument to pass to the event - * @return A unique id that represents the posted event and can - * be passed to EventQueue::cancel, or an id of 0 if - * there is not enough memory to allocate the event. - */ - int post(A0 a0) const - { - if (!_event) { - return 0; - } - - _event->id = _event->post(_event, a0); - return _event->id; - } - - /** Posts an event onto the underlying event queue, returning void - * - * @param a0 Argument to pass to the event - */ - void call(A0 a0) const - { - MBED_UNUSED int id = post(a0); - MBED_ASSERT(id); - } - - /** Posts an event onto the underlying event queue, returning void - * - * @param a0 Argument to pass to the event - */ - void operator()(A0 a0) const - { - return call(a0); - } - - /** Static thunk for passing as C-style function - * - * @param func Event to call passed as a void pointer - * @param a0 Argument to pass to the event - */ - static void thunk(void *func, A0 a0) - { - return static_cast(func)->call(a0); - } - - /** Cancels the most recently posted event - * - * Attempts to cancel the most recently posted event. It is safe to call - * cancel after an event has already been dispatched. - * - * The cancel function is IRQ safe. - * - * If called while the event queue's dispatch loop is active, the cancel - * function does not guarantee that the event will not execute after it - * returns, as the event may have already begun executing. - */ - void cancel() const - { - if (_event) { - equeue_cancel(_event->equeue, _event->id); - } - } - -private: - struct event { - unsigned ref; - equeue_t *equeue; - int id; - - int delay; - int period; - - int (*post)(struct event *, A0 a0); - void (*dtor)(struct event *); - - // F follows - } *_event; - - // Event attributes - template - static int event_post(struct event *e, A0 a0) - { - typedef EventQueue::context10 C; - void *p = equeue_alloc(e->equeue, sizeof(C)); - if (!p) { - return 0; - } - - new (p) C(*(F *)(e + 1), a0); - equeue_event_delay(p, e->delay); - equeue_event_period(p, e->period); - equeue_event_dtor(p, &EventQueue::function_dtor); - return equeue_post(e->equeue, &EventQueue::function_call, p); - } - - template - static void event_dtor(struct event *e) - { - ((F *)(e + 1))->~F(); - } - -public: - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0 Argument to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0) - { - new (this) Event(q, EventQueue::context11(f, c0)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b1, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1) - { - new (this) Event(q, EventQueue::context21(f, c0, c1)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b2, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) - { - new (this) Event(q, EventQueue::context31(f, c0, c1, c2)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2,c3 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b3, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) - { - new (this) Event(q, EventQueue::context41(f, c0, c1, c2, c3)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2,c3,c4 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b4, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) - { - new (this) Event(q, EventQueue::context51(f, c0, c1, c2, c3, c4)); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, A0), B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, A0) const, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, A0) volatile, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, A0) const volatile, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, A0), B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, A0) const, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, A0) volatile, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1, A0) const volatile, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, A0), B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, B2, A0) const, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, B2, A0) volatile, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1, B2, A0) const volatile, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, B3, A0), B0 b0, B1 b1, B2 b2, B3 b3) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, B2, B3, A0) const, B0 b0, B1 b1, B2 b2, B3 b3) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, B2, B3, A0) volatile, B0 b0, B1 b1, B2 b2, B3 b3) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, B3, B4, A0), B0 b0, B1 b1, B2 b2, B3 b3, B4 b4) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } -}; - -/** Event - * - * Representation of an event for fine-grain dispatch control - * @ingroup events - */ -template -class Event { -public: - /** Create an event - * - * Constructs an event bound to the specified event queue. The specified - * callback acts as the target for the event and is executed in the - * context of the event queue's dispatch loop once posted. - * - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - */ - template - Event(EventQueue *q, F f) - { - _event = static_cast( - equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F))); - - if (_event) { - _event->equeue = &q->_equeue; - _event->id = 0; - _event->delay = 0; - _event->period = -1; - - _event->post = &Event::event_post; - _event->dtor = &Event::event_dtor; - - new (_event + 1) F(f); - - _event->ref = 1; - } - } - - /** Copy constructor for events - */ - Event(const Event &e) - { - _event = 0; - if (e._event) { - _event = e._event; - _event->ref += 1; - } - } - - /** Assignment operator for events - */ - Event &operator=(const Event &that) - { - if (this != &that) { - this->~Event(); - new (this) Event(that); - } - - return *this; - } - - /** Destructor for events - */ - ~Event() - { - if (_event) { - _event->ref -= 1; - if (_event->ref == 0) { - _event->dtor(_event); - equeue_dealloc(_event->equeue, _event); - } - } - } - - /** Configure the delay of an event - * - * @param delay Millisecond delay before dispatching the event - */ - void delay(int delay) - { - if (_event) { - _event->delay = delay; - } - } - - /** Configure the period of an event - * - * @param period Millisecond period for repeatedly dispatching an event - */ - void period(int period) - { - if (_event) { - _event->period = period; - } - } - - /** Posts an event onto the underlying event queue - * - * The event is posted to the underlying queue and is executed in the - * context of the event queue's dispatch loop. - * - * The post function is IRQ safe and can act as a mechanism for moving - * events out of IRQ contexts. - * - * @param a0,a1 Arguments to pass to the event - * @return A unique id that represents the posted event and can - * be passed to EventQueue::cancel, or an id of 0 if - * there is not enough memory to allocate the event. - */ - int post(A0 a0, A1 a1) const - { - if (!_event) { - return 0; - } - - _event->id = _event->post(_event, a0, a1); - return _event->id; - } - - /** Posts an event onto the underlying event queue, returning void - * - * @param a0,a1 Arguments to pass to the event - */ - void call(A0 a0, A1 a1) const - { - MBED_UNUSED int id = post(a0, a1); - MBED_ASSERT(id); - } - - /** Posts an event onto the underlying event queue, returning void - * - * @param a0,a1 Arguments to pass to the event - */ - void operator()(A0 a0, A1 a1) const - { - return call(a0, a1); - } - - /** Static thunk for passing as C-style function - * - * @param func Event to call passed as a void pointer - * @param a0,a1 Arguments to pass to the event - */ - static void thunk(void *func, A0 a0, A1 a1) - { - return static_cast(func)->call(a0, a1); - } - - /** Cancels the most recently posted event - * - * Attempts to cancel the most recently posted event. It is safe to call - * cancel after an event has already been dispatched. - * - * The cancel function is IRQ safe. - * - * If called while the event queue's dispatch loop is active, the cancel - * function does not guarantee that the event will not execute after it - * returns, as the event may have already begun executing. - */ - void cancel() const - { - if (_event) { - equeue_cancel(_event->equeue, _event->id); - } - } - -private: - struct event { - unsigned ref; - equeue_t *equeue; - int id; - - int delay; - int period; - - int (*post)(struct event *, A0 a0, A1 a1); - void (*dtor)(struct event *); - - // F follows - } *_event; - - // Event attributes - template - static int event_post(struct event *e, A0 a0, A1 a1) - { - typedef EventQueue::context20 C; - void *p = equeue_alloc(e->equeue, sizeof(C)); - if (!p) { - return 0; - } - - new (p) C(*(F *)(e + 1), a0, a1); - equeue_event_delay(p, e->delay); - equeue_event_period(p, e->period); - equeue_event_dtor(p, &EventQueue::function_dtor); - return equeue_post(e->equeue, &EventQueue::function_call, p); - } - - template - static void event_dtor(struct event *e) - { - ((F *)(e + 1))->~F(); - } - -public: - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0 Argument to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0) - { - new (this) Event(q, EventQueue::context12(f, c0)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b1, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1) - { - new (this) Event(q, EventQueue::context22(f, c0, c1)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b2, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) - { - new (this) Event(q, EventQueue::context32(f, c0, c1, c2)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2,c3 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b3, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) - { - new (this) Event(q, EventQueue::context42(f, c0, c1, c2, c3)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2,c3,c4 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b4, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) - { - new (this) Event(q, EventQueue::context52(f, c0, c1, c2, c3, c4)); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, A0, A1), B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, A0, A1) const, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, A0, A1) volatile, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, A0, A1) const volatile, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, A0, A1), B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, A0, A1) const, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, A0, A1) volatile, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1, A0, A1) const volatile, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, A0, A1), B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, B2, A0, A1) const, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1) volatile, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1) const volatile, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1), B0 b0, B1 b1, B2 b2, B3 b3) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1) const, B0 b0, B1 b1, B2 b2, B3 b3) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1) volatile, B0 b0, B1 b1, B2 b2, B3 b3) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } -}; - -/** Event - * - * Representation of an event for fine-grain dispatch control - * @ingroup events - */ -template -class Event { -public: - /** Create an event - * - * Constructs an event bound to the specified event queue. The specified - * callback acts as the target for the event and is executed in the - * context of the event queue's dispatch loop once posted. - * - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - */ - template - Event(EventQueue *q, F f) - { - _event = static_cast( - equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F))); - - if (_event) { - _event->equeue = &q->_equeue; - _event->id = 0; - _event->delay = 0; - _event->period = -1; - - _event->post = &Event::event_post; - _event->dtor = &Event::event_dtor; - - new (_event + 1) F(f); - - _event->ref = 1; - } - } - - /** Copy constructor for events - */ - Event(const Event &e) - { - _event = 0; - if (e._event) { - _event = e._event; - _event->ref += 1; - } - } - - /** Assignment operator for events - */ - Event &operator=(const Event &that) - { - if (this != &that) { - this->~Event(); - new (this) Event(that); - } - - return *this; - } - - /** Destructor for events - */ - ~Event() - { - if (_event) { - _event->ref -= 1; - if (_event->ref == 0) { - _event->dtor(_event); - equeue_dealloc(_event->equeue, _event); - } - } - } - - /** Configure the delay of an event - * - * @param delay Millisecond delay before dispatching the event - */ - void delay(int delay) - { - if (_event) { - _event->delay = delay; - } - } - - /** Configure the period of an event - * - * @param period Millisecond period for repeatedly dispatching an event - */ - void period(int period) - { - if (_event) { - _event->period = period; - } - } - - /** Posts an event onto the underlying event queue - * - * The event is posted to the underlying queue and is executed in the - * context of the event queue's dispatch loop. - * - * The post function is IRQ safe and can act as a mechanism for moving - * events out of IRQ contexts. - * - * @param a0,a1,a2 Arguments to pass to the event - * @return A unique id that represents the posted event and can - * be passed to EventQueue::cancel, or an id of 0 if - * there is not enough memory to allocate the event. - */ - int post(A0 a0, A1 a1, A2 a2) const - { - if (!_event) { - return 0; - } - - _event->id = _event->post(_event, a0, a1, a2); - return _event->id; - } - - /** Posts an event onto the underlying event queue, returning void - * - * @param a0,a1,a2 Arguments to pass to the event - */ - void call(A0 a0, A1 a1, A2 a2) const - { - MBED_UNUSED int id = post(a0, a1, a2); - MBED_ASSERT(id); - } - - /** Posts an event onto the underlying event queue, returning void - * - * @param a0,a1,a2 Arguments to pass to the event - */ - void operator()(A0 a0, A1 a1, A2 a2) const - { - return call(a0, a1, a2); - } - - /** Static thunk for passing as C-style function - * - * @param func Event to call passed as a void pointer - * @param a0,a1,a2 Arguments to pass to the event - */ - static void thunk(void *func, A0 a0, A1 a1, A2 a2) - { - return static_cast(func)->call(a0, a1, a2); - } - - /** Cancels the most recently posted event - * - * Attempts to cancel the most recently posted event. It is safe to call - * cancel after an event has already been dispatched. - * - * The cancel function is IRQ safe. - * - * If called while the event queue's dispatch loop is active, the cancel - * function does not guarantee that the event will not execute after it - * returns, as the event may have already begun executing. - */ - void cancel() const - { - if (_event) { - equeue_cancel(_event->equeue, _event->id); - } - } - -private: - struct event { - unsigned ref; - equeue_t *equeue; - int id; - - int delay; - int period; - - int (*post)(struct event *, A0 a0, A1 a1, A2 a2); - void (*dtor)(struct event *); - - // F follows - } *_event; - - // Event attributes - template - static int event_post(struct event *e, A0 a0, A1 a1, A2 a2) - { - typedef EventQueue::context30 C; - void *p = equeue_alloc(e->equeue, sizeof(C)); - if (!p) { - return 0; - } - - new (p) C(*(F *)(e + 1), a0, a1, a2); - equeue_event_delay(p, e->delay); - equeue_event_period(p, e->period); - equeue_event_dtor(p, &EventQueue::function_dtor); - return equeue_post(e->equeue, &EventQueue::function_call, p); - } - - template - static void event_dtor(struct event *e) - { - ((F *)(e + 1))->~F(); - } - -public: - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0 Argument to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0) - { - new (this) Event(q, EventQueue::context13(f, c0)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b1, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1) - { - new (this) Event(q, EventQueue::context23(f, c0, c1)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b2, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) - { - new (this) Event(q, EventQueue::context33(f, c0, c1, c2)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2,c3 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b3, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) - { - new (this) Event(q, EventQueue::context43(f, c0, c1, c2, c3)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2,c3,c4 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b4, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) - { - new (this) Event(q, EventQueue::context53(f, c0, c1, c2, c3, c4)); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, A0, A1, A2), B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, A0, A1, A2) const, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, A0, A1, A2) volatile, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, A0, A1, A2) const volatile, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, A0, A1, A2), B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, A0, A1, A2) const, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2) volatile, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2) const volatile, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2), B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2) const, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2) volatile, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2) const volatile, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1, A2), B0 b0, B1 b1, B2 b2, B3 b3) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } -}; - -/** Event - * - * Representation of an event for fine-grain dispatch control - * @ingroup events - */ -template -class Event { -public: - /** Create an event - * - * Constructs an event bound to the specified event queue. The specified - * callback acts as the target for the event and is executed in the - * context of the event queue's dispatch loop once posted. - * - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - */ - template - Event(EventQueue *q, F f) - { - _event = static_cast( - equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F))); - - if (_event) { - _event->equeue = &q->_equeue; - _event->id = 0; - _event->delay = 0; - _event->period = -1; - - _event->post = &Event::event_post; - _event->dtor = &Event::event_dtor; - - new (_event + 1) F(f); - - _event->ref = 1; - } - } - - /** Copy constructor for events - */ - Event(const Event &e) - { - _event = 0; - if (e._event) { - _event = e._event; - _event->ref += 1; - } - } - - /** Assignment operator for events - */ - Event &operator=(const Event &that) - { - if (this != &that) { - this->~Event(); - new (this) Event(that); - } - - return *this; - } - - /** Destructor for events - */ - ~Event() - { - if (_event) { - _event->ref -= 1; - if (_event->ref == 0) { - _event->dtor(_event); - equeue_dealloc(_event->equeue, _event); - } - } - } - - /** Configure the delay of an event - * - * @param delay Millisecond delay before dispatching the event - */ - void delay(int delay) - { - if (_event) { - _event->delay = delay; - } - } - - /** Configure the period of an event - * - * @param period Millisecond period for repeatedly dispatching an event - */ - void period(int period) - { - if (_event) { - _event->period = period; - } - } - - /** Posts an event onto the underlying event queue - * - * The event is posted to the underlying queue and is executed in the - * context of the event queue's dispatch loop. - * - * The post function is IRQ safe and can act as a mechanism for moving - * events out of IRQ contexts. - * - * @param a0,a1,a2,a3 Arguments to pass to the event - * @return A unique id that represents the posted event and can - * be passed to EventQueue::cancel, or an id of 0 if - * there is not enough memory to allocate the event. - */ - int post(A0 a0, A1 a1, A2 a2, A3 a3) const - { - if (!_event) { - return 0; - } - - _event->id = _event->post(_event, a0, a1, a2, a3); - return _event->id; - } - - /** Posts an event onto the underlying event queue, returning void - * - * @param a0,a1,a2,a3 Arguments to pass to the event - */ - void call(A0 a0, A1 a1, A2 a2, A3 a3) const - { - MBED_UNUSED int id = post(a0, a1, a2, a3); - MBED_ASSERT(id); - } - - /** Posts an event onto the underlying event queue, returning void - * - * @param a0,a1,a2,a3 Arguments to pass to the event - */ - void operator()(A0 a0, A1 a1, A2 a2, A3 a3) const - { - return call(a0, a1, a2, a3); - } - - /** Static thunk for passing as C-style function - * - * @param func Event to call passed as a void pointer - * @param a0,a1,a2,a3 Arguments to pass to the event - */ - static void thunk(void *func, A0 a0, A1 a1, A2 a2, A3 a3) - { - return static_cast(func)->call(a0, a1, a2, a3); - } - - /** Cancels the most recently posted event - * - * Attempts to cancel the most recently posted event. It is safe to call - * cancel after an event has already been dispatched. - * - * The cancel function is IRQ safe. - * - * If called while the event queue's dispatch loop is active, the cancel - * function does not guarantee that the event will not execute after it - * returns, as the event may have already begun executing. - */ - void cancel() const - { - if (_event) { - equeue_cancel(_event->equeue, _event->id); - } - } - -private: - struct event { - unsigned ref; - equeue_t *equeue; - int id; - - int delay; - int period; - - int (*post)(struct event *, A0 a0, A1 a1, A2 a2, A3 a3); - void (*dtor)(struct event *); - - // F follows - } *_event; - - // Event attributes - template - static int event_post(struct event *e, A0 a0, A1 a1, A2 a2, A3 a3) - { - typedef EventQueue::context40 C; - void *p = equeue_alloc(e->equeue, sizeof(C)); - if (!p) { - return 0; - } - - new (p) C(*(F *)(e + 1), a0, a1, a2, a3); - equeue_event_delay(p, e->delay); - equeue_event_period(p, e->period); - equeue_event_dtor(p, &EventQueue::function_dtor); - return equeue_post(e->equeue, &EventQueue::function_call, p); - } - - template - static void event_dtor(struct event *e) - { - ((F *)(e + 1))->~F(); - } - -public: -#if !defined(DOXYGEN_ONLY) - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0 Argument to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0) - { - new (this) Event(q, EventQueue::context14(f, c0)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b1, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1) - { - new (this) Event(q, EventQueue::context24(f, c0, c1)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b2, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) - { - new (this) Event(q, EventQueue::context34(f, c0, c1, c2)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2,c3 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b3, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) - { - new (this) Event(q, EventQueue::context44(f, c0, c1, c2, c3)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2,c3,c4 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b4, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) - { - new (this) Event(q, EventQueue::context54(f, c0, c1, c2, c3, c4)); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, A0, A1, A2, A3), B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, A0, A1, A2, A3) const, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, A0, A1, A2, A3) volatile, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, A0, A1, A2, A3) const volatile, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3), B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3) const, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3) volatile, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3) const volatile, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3), B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3) const, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3) volatile, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1, A2, A3), B0 b0, B1 b1, B2 b2, B3 b3) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } -}; - -/** Event - * - * Representation of an event for fine-grain dispatch control - * @ingroup events - */ -template -class Event { -public: - /** Create an event - * - * Constructs an event bound to the specified event queue. The specified - * callback acts as the target for the event and is executed in the - * context of the event queue's dispatch loop once posted. - * - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - */ - template - Event(EventQueue *q, F f) - { - _event = static_cast( - equeue_alloc(&q->_equeue, sizeof(struct event) + sizeof(F))); - - if (_event) { - _event->equeue = &q->_equeue; - _event->id = 0; - _event->delay = 0; - _event->period = -1; - - _event->post = &Event::event_post; - _event->dtor = &Event::event_dtor; - - new (_event + 1) F(f); - - _event->ref = 1; - } - } - - /** Copy constructor for events - */ - Event(const Event &e) - { - _event = 0; - if (e._event) { - _event = e._event; - _event->ref += 1; - } - } - - /** Assignment operator for events - */ - Event &operator=(const Event &that) - { - if (this != &that) { - this->~Event(); - new (this) Event(that); - } - - return *this; - } - - /** Destructor for events - */ - ~Event() - { - if (_event) { - _event->ref -= 1; - if (_event->ref == 0) { - _event->dtor(_event); - equeue_dealloc(_event->equeue, _event); - } - } - } - - /** Configure the delay of an event - * - * @param delay Millisecond delay before dispatching the event - */ - void delay(int delay) - { - if (_event) { - _event->delay = delay; - } - } - - /** Configure the period of an event - * - * @param period Millisecond period for repeatedly dispatching an event - */ - void period(int period) - { - if (_event) { - _event->period = period; - } - } - - /** Posts an event onto the underlying event queue - * - * The event is posted to the underlying queue and is executed in the - * context of the event queue's dispatch loop. - * - * The post function is IRQ safe and can act as a mechanism for moving - * events out of IRQ contexts. - * - * @param a0,a1,a2,a3,a4 Arguments to pass to the event - * @return A unique id that represents the posted event and can - * be passed to EventQueue::cancel, or an id of 0 if - * there is not enough memory to allocate the event. - */ - int post(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) const - { - if (!_event) { - return 0; - } - - _event->id = _event->post(_event, a0, a1, a2, a3, a4); - return _event->id; - } - - /** Posts an event onto the underlying event queue, returning void - * - * @param a0,a1,a2,a3,a4 Arguments to pass to the event - */ - void call(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) const - { - MBED_UNUSED int id = post(a0, a1, a2, a3, a4); - MBED_ASSERT(id); - } - - /** Posts an event onto the underlying event queue, returning void - * - * @param a0,a1,a2,a3,a4 Arguments to pass to the event - */ - void operator()(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) const - { - return call(a0, a1, a2, a3, a4); - } - - /** Static thunk for passing as C-style function - * - * @param func Event to call passed as a void pointer - * @param a0,a1,a2,a3,a4 Arguments to pass to the event - */ - static void thunk(void *func, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return static_cast(func)->call(a0, a1, a2, a3, a4); - } - - /** Cancels the most recently posted event - * - * Attempts to cancel the most recently posted event. It is safe to call - * cancel after an event has already been dispatched. - * - * The cancel function is IRQ safe. - * - * If called while the event queue's dispatch loop is active, the cancel - * function does not guarantee that the event will not execute after it - * returns, as the event may have already begun executing. - */ - void cancel() const - { - if (_event) { - equeue_cancel(_event->equeue, _event->id); - } - } - -private: - struct event { - unsigned ref; - equeue_t *equeue; - int id; - - int delay; - int period; - - int (*post)(struct event *, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4); - void (*dtor)(struct event *); - - // F follows - } *_event; - - // Event attributes - template - static int event_post(struct event *e, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - typedef EventQueue::context50 C; - void *p = equeue_alloc(e->equeue, sizeof(C)); - if (!p) { - return 0; - } - - new (p) C(*(F *)(e + 1), a0, a1, a2, a3, a4); - equeue_event_delay(p, e->delay); - equeue_event_period(p, e->period); - equeue_event_dtor(p, &EventQueue::function_dtor); - return equeue_post(e->equeue, &EventQueue::function_call, p); - } - - template - static void event_dtor(struct event *e) - { - ((F *)(e + 1))->~F(); - } - -public: - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0 Argument to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0) - { - new (this) Event(q, EventQueue::context15(f, c0)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b1, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1) - { - new (this) Event(q, EventQueue::context25(f, c0, c1)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b2, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2) - { - new (this) Event(q, EventQueue::context35(f, c0, c1, c2)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2,c3 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b3, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3) - { - new (this) Event(q, EventQueue::context45(f, c0, c1, c2, c3)); - } - - /** Create an event - * @param q Event queue to dispatch on - * @param f Function to execute when the event is dispatched - * @param c0,c1,c2,c3,c4 Arguments to bind to the callback, these arguments are - * allocated on an IRQ-safe allocator from the event queue's - * memory pool. Must be type-compatible with b0..b4, the - * arguments to the underlying callback. - */ - template - Event(EventQueue *q, F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) - { - new (this) Event(q, EventQueue::context55(f, c0, c1, c2, c3, c4)); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, A0, A1, A2, A3, A4), B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, A0, A1, A2, A3, A4) const, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, A0, A1, A2, A3, A4) volatile, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, A0, A1, A2, A3, A4) const volatile, B0 b0) - { - new (this) Event(q, mbed::callback(obj, method), b0); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3, A4), B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3, A4) const, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3, A4) volatile, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3, A4) const volatile, B0 b0, B1 b1) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3, A4), B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, const T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) const, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - Event(EventQueue *q, volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) volatile, B0 b0, B1 b1, B2 b2) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } - - /** Create an event - * @see Event::Event - */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3); - } + template + Event(EventQueue *q, F f, ContextArgTs... context_args) : + Event(q, EventQueue::context(f, context_args...)) { } /** Create an event * @see Event::Event */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } + template + Event(EventQueue *q, T *obj, R(T::*method)(BoundArgTs..., ArgTs...), BoundArgTs... context_args) : + Event(q, mbed::callback(obj, method), context_args...) { } /** Create an event * @see Event::Event */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } + template + Event(EventQueue *q, const T *obj, R(T::*method)(BoundArgTs..., ArgTs...) const, BoundArgTs... context_args) : + Event(q, mbed::callback(obj, method), context_args...) { } /** Create an event * @see Event::Event */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } + template + Event(EventQueue *q, volatile T *obj, R(T::*method)(BoundArgTs..., ArgTs...) volatile, BoundArgTs... context_args) : + Event(q, mbed::callback(obj, method), context_args...) { } /** Create an event * @see Event::Event */ - template - 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) - { - new (this) Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4); - } + template + Event(EventQueue *q, const volatile T *obj, R(T::*method)(BoundArgTs..., ArgTs...) const volatile, BoundArgTs... context_args) : + Event(q, mbed::callback(obj, method), context_args...) { } }; @@ -2770,1302 +283,41 @@ public: // Convenience functions declared here to avoid cyclic // dependency between Event and EventQueue -template -Event EventQueue::event(R(*func)()) +template +Event EventQueue::event(R(*func)(BoundArgTs..., ArgTs...), ContextArgTs... context_args) { - return Event(this, func); + return Event(this, func, context_args...); } -template -Event EventQueue::event(T *obj, R(T::*method)()) +template +Event EventQueue::event(T *obj, R(T::*method)(BoundArgTs..., ArgTs...), ContextArgTs... context_args) { - return Event(this, mbed::callback(obj, method)); + return Event(this, mbed::callback(obj, method), context_args...); } -template -Event EventQueue::event(const T *obj, R(T::*method)() const) +template +Event EventQueue::event(const T *obj, R(T::*method)(BoundArgTs..., ArgTs...) const, ContextArgTs... context_args) { - return Event(this, mbed::callback(obj, method)); + return Event(this, mbed::callback(obj, method), context_args...); } -template -Event EventQueue::event(volatile T *obj, R(T::*method)() volatile) +template +Event EventQueue::event(volatile T *obj, R(T::*method)(BoundArgTs..., ArgTs...) volatile, ContextArgTs... context_args) { - return Event(this, mbed::callback(obj, method)); + return Event(this, mbed::callback(obj, method), context_args...); } -template -Event EventQueue::event(const volatile T *obj, R(T::*method)() const volatile) +template +Event EventQueue::event(const volatile T *obj, R(T::*method)(BoundArgTs..., ArgTs...) const volatile, ContextArgTs... context_args) { - return Event(this, mbed::callback(obj, method)); + return Event(this, mbed::callback(obj, method), context_args...); } -template -Event EventQueue::event(mbed::Callback cb) +template +Event EventQueue::event(mbed::Callback cb, ContextArgTs... context_args) { - return Event(this, cb); + return Event(this, cb, context_args...); } - -template -Event EventQueue::event(R(*func)(B0), C0 c0) -{ - return Event(this, func, c0); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0), C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0) const, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0) volatile, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0) const volatile, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0) -{ - return Event(this, cb, c0); -} - -template -Event EventQueue::event(R(*func)(B0, B1), C0 c0, C1 c1) -{ - return Event(this, func, c0, c1); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1), C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1) const, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1) volatile, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1) const volatile, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1) -{ - return Event(this, cb, c0, c1); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2), C0 c0, C1 c1, C2 c2) -{ - return Event(this, func, c0, c1, c2); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2), C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, B2) const, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, B2) volatile, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, B2) const volatile, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2) -{ - return Event(this, cb, c0, c1, c2); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, B3), C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, func, c0, c1, c2, c3); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, B3), C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, B2, B3) const, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, B2, B3) volatile, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, B2, B3) const volatile, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, cb, c0, c1, c2, c3); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, B3, B4), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, func, c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, B3, B4), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, B2, B3, B4) const, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, B2, B3, B4) volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, cb, c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(R(*func)(A0)) -{ - return Event(this, func); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(A0)) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(A0) const) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(A0) volatile) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(A0) const volatile) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(mbed::Callback cb) -{ - return Event(this, cb); -} - -template -Event EventQueue::event(R(*func)(B0, A0), C0 c0) -{ - return Event(this, func, c0); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, A0), C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, A0) const, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, A0) volatile, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, A0) const volatile, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0) -{ - return Event(this, cb, c0); -} - -template -Event EventQueue::event(R(*func)(B0, B1, A0), C0 c0, C1 c1) -{ - return Event(this, func, c0, c1); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, A0), C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, A0) const, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, A0) volatile, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, A0) const volatile, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1) -{ - return Event(this, cb, c0, c1); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, A0), C0 c0, C1 c1, C2 c2) -{ - return Event(this, func, c0, c1, c2); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, A0), C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, B2, A0) const, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, B2, A0) volatile, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, B2, A0) const volatile, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2) -{ - return Event(this, cb, c0, c1, c2); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, B3, A0), C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, func, c0, c1, c2, c3); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, B3, A0), C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, B2, B3, A0) const, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, B2, B3, A0) volatile, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, B2, B3, A0) const volatile, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, cb, c0, c1, c2, c3); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, B3, B4, A0), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, func, c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, B3, B4, A0), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, cb, c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(R(*func)(A0, A1)) -{ - return Event(this, func); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(A0, A1)) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(A0, A1) const) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(A0, A1) volatile) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(A0, A1) const volatile) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(mbed::Callback cb) -{ - return Event(this, cb); -} - -template -Event EventQueue::event(R(*func)(B0, A0, A1), C0 c0) -{ - return Event(this, func, c0); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, A0, A1), C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, A0, A1) const, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, A0, A1) volatile, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, A0, A1) const volatile, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0) -{ - return Event(this, cb, c0); -} - -template -Event EventQueue::event(R(*func)(B0, B1, A0, A1), C0 c0, C1 c1) -{ - return Event(this, func, c0, c1); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, A0, A1), C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, A0, A1) const, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, A0, A1) volatile, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, A0, A1) const volatile, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1) -{ - return Event(this, cb, c0, c1); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, A0, A1), C0 c0, C1 c1, C2 c2) -{ - return Event(this, func, c0, c1, c2); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, A0, A1), C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, B2, A0, A1) const, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1) volatile, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1) const volatile, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2) -{ - return Event(this, cb, c0, c1, c2); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, B3, A0, A1), C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, func, c0, c1, c2, c3); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1), C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1) const, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1) volatile, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, cb, c0, c1, c2, c3); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, B3, B4, A0, A1), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, func, c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, B3, B4, A0, A1), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, cb, c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(R(*func)(A0, A1, A2)) -{ - return Event(this, func); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(A0, A1, A2)) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(A0, A1, A2) const) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(A0, A1, A2) volatile) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(A0, A1, A2) const volatile) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(mbed::Callback cb) -{ - return Event(this, cb); -} - -template -Event EventQueue::event(R(*func)(B0, A0, A1, A2), C0 c0) -{ - return Event(this, func, c0); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, A0, A1, A2), C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, A0, A1, A2) const, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, A0, A1, A2) volatile, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, A0, A1, A2) const volatile, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0) -{ - return Event(this, cb, c0); -} - -template -Event EventQueue::event(R(*func)(B0, B1, A0, A1, A2), C0 c0, C1 c1) -{ - return Event(this, func, c0, c1); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, A0, A1, A2), C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, A0, A1, A2) const, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2) volatile, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2) const volatile, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1) -{ - return Event(this, cb, c0, c1); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, A0, A1, A2), C0 c0, C1 c1, C2 c2) -{ - return Event(this, func, c0, c1, c2); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2), C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2) const, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2) volatile, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2) const volatile, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2) -{ - return Event(this, cb, c0, c1, c2); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, B3, A0, A1, A2), C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, func, c0, c1, c2, c3); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1, A2), C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1, A2) const, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1, A2) volatile, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, cb, c0, c1, c2, c3); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, B3, B4, A0, A1, A2), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, func, c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, cb, c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(R(*func)(A0, A1, A2, A3)) -{ - return Event(this, func); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(A0, A1, A2, A3)) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(A0, A1, A2, A3) const) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(A0, A1, A2, A3) volatile) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(A0, A1, A2, A3) const volatile) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(mbed::Callback cb) -{ - return Event(this, cb); -} - -template -Event EventQueue::event(R(*func)(B0, A0, A1, A2, A3), C0 c0) -{ - return Event(this, func, c0); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, A0, A1, A2, A3), C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, A0, A1, A2, A3) const, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, A0, A1, A2, A3) volatile, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, A0, A1, A2, A3) const volatile, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0) -{ - return Event(this, cb, c0); -} - -template -Event EventQueue::event(R(*func)(B0, B1, A0, A1, A2, A3), C0 c0, C1 c1) -{ - return Event(this, func, c0, c1); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3), C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3) const, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3) volatile, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3) const volatile, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1) -{ - return Event(this, cb, c0, c1); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2) -{ - return Event(this, func, c0, c1, c2); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3) const, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3) volatile, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3) const volatile, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2) -{ - return Event(this, cb, c0, c1, c2); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, B3, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, func, c0, c1, c2, c3); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, cb, c0, c1, c2, c3); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, B3, B4, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, func, c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, cb, c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(R(*func)(A0, A1, A2, A3, A4)) -{ - return Event(this, func); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(A0, A1, A2, A3, A4)) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(A0, A1, A2, A3, A4) const) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(A0, A1, A2, A3, A4) volatile) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(A0, A1, A2, A3, A4) const volatile) -{ - return Event(this, mbed::callback(obj, method)); -} - -template -Event EventQueue::event(mbed::Callback cb) -{ - return Event(this, cb); -} - -template -Event EventQueue::event(R(*func)(B0, A0, A1, A2, A3, A4), C0 c0) -{ - return Event(this, func, c0); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, A0, A1, A2, A3, A4), C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, A0, A1, A2, A3, A4) const, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, A0, A1, A2, A3, A4) volatile, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, A0, A1, A2, A3, A4) const volatile, C0 c0) -{ - return Event(this, mbed::callback(obj, method), c0); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0) -{ - return Event(this, cb, c0); -} - -template -Event EventQueue::event(R(*func)(B0, B1, A0, A1, A2, A3, A4), C0 c0, C1 c1) -{ - return Event(this, func, c0, c1); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3, A4), C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3, A4) const, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3, A4) volatile, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(const volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3, A4) const volatile, C0 c0, C1 c1) -{ - return Event(this, mbed::callback(obj, method), c0, c1); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1) -{ - return Event(this, cb, c0, c1); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2) -{ - return Event(this, func, c0, c1, c2); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(const T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) const, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) volatile, C0 c0, C1 c1, C2 c2) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2) -{ - return Event(this, cb, c0, c1, c2); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, B3, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, func, c0, c1, c2, c3); -} - -template -Event EventQueue::event(T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3) -{ - return Event(this, cb, c0, c1, c2, c3); -} - -template -Event EventQueue::event(R(*func)(B0, B1, B2, B3, B4, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, func, c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event 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) -{ - return Event(this, mbed::callback(obj, method), c0, c1, c2, c3, c4); -} - -template -Event EventQueue::event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) -{ - return Event(this, cb, c0, c1, c2, c3, c4); -} -#endif } #endif diff --git a/events/EventQueue.h b/events/EventQueue.h index 2b6b200a77..f31d55c415 100644 --- a/events/EventQueue.h +++ b/events/EventQueue.h @@ -462,9 +462,9 @@ public: * callback acts as the target for the event and is executed in the * context of the event queue's dispatch loop once posted. * - * @param func Function to execute when the event is dispatched - * @param args Arguments to pass to the callback - * @return Event that dispatches on the specific queue + * @param func Function to execute when the event is dispatched + * @param context_args Arguments to pass to the callback + * @return Event that dispatches on the specific queue * * @code * #include "mbed.h" @@ -498,8 +498,8 @@ public: */ // AStyle ignore, not handling correctly below // *INDENT-OFF* - template - Event event(R (*func)(BoundArgs...), Args ...args); + template + Event event(R (*func)(BoundArgs..., Args...), ContextArgs ...context_args); // *INDENT-ON* /** Creates an event bound to the event queue @@ -638,272 +638,48 @@ public: /** Calls an event on the queue * @see EventQueue::call * @param f Function to execute in the context of the dispatch loop - * @param a0 Argument to pass to the callback + * @param args Arguments to pass to the callback */ - template - int call(F f, A0 a0) + template + int call(F f, ArgTs... args) { - return call(context10(f, a0)); - } - - /** Calls an event on the queue - * @see EventQueue::call - * @param f Function to execute in the context of the dispatch loop - * @param a0,a1 Arguments to pass to the callback - */ - template - int call(F f, A0 a0, A1 a1) - { - return call(context20(f, a0, a1)); - } - - /** Calls an event on the queue - * @see EventQueue::call - * @param f Function to execute in the context of the dispatch loop - * @param a0,a1,a2 Arguments to pass to the callback - */ - template - int call(F f, A0 a0, A1 a1, A2 a2) - { - return call(context30(f, a0, a1, a2)); - } - - /** Calls an event on the queue - * @see EventQueue::call - * @param f Function to execute in the context of the dispatch loop - * @param a0,a1,a2,a3 Arguments to pass to the callback - */ - template - int call(F f, A0 a0, A1 a1, A2 a2, A3 a3) - { - return call(context40(f, a0, a1, a2, a3)); - } - - /** Calls an event on the queue - * @see EventQueue::call - * @param f Function to execute in the context of the dispatch loop - * @param a0,a1,a2,a3,a4 Arguments to pass to the callback - */ - template - int call(F f, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call(context50(f, a0, a1, a2, a3, a4)); + return call(context(f, args...)); } /** Calls an event on the queue * @see EventQueue::call */ - template - int call(T *obj, R(T::*method)()) + template + int call(T *obj, R(T::*method)(ArgTs...), ArgTs... args) { - return call(mbed::callback(obj, method)); + return call(mbed::callback(obj, method), args...); } /** Calls an event on the queue * @see EventQueue::call */ - template - int call(const T *obj, R(T::*method)() const) + template + int call(const T *obj, R(T::*method)(ArgTs...) const, ArgTs... args) { - return call(mbed::callback(obj, method)); + return call(mbed::callback(obj, method), args...); } /** Calls an event on the queue * @see EventQueue::call */ - template - int call(volatile T *obj, R(T::*method)() volatile) + template + int call(volatile T *obj, R(T::*method)(ArgTs...) volatile, ArgTs... args) { - return call(mbed::callback(obj, method)); + return call(mbed::callback(obj, method), args...); } /** Calls an event on the queue * @see EventQueue::call */ - template - int call(const volatile T *obj, R(T::*method)() const volatile) + template + int call(const volatile T *obj, R(T::*method)(ArgTs...) const volatile, ArgTs... args) { - return call(mbed::callback(obj, method)); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(T *obj, R(T::*method)(A0), A0 a0) - { - return call(mbed::callback(obj, method), a0); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(const T *obj, R(T::*method)(A0) const, A0 a0) - { - return call(mbed::callback(obj, method), a0); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(volatile T *obj, R(T::*method)(A0) volatile, A0 a0) - { - return call(mbed::callback(obj, method), a0); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(const volatile T *obj, R(T::*method)(A0) const volatile, A0 a0) - { - return call(mbed::callback(obj, method), a0); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(T *obj, R(T::*method)(A0, A1), A0 a0, A1 a1) - { - return call(mbed::callback(obj, method), a0, a1); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(const T *obj, R(T::*method)(A0, A1) const, A0 a0, A1 a1) - { - return call(mbed::callback(obj, method), a0, a1); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(volatile T *obj, R(T::*method)(A0, A1) volatile, A0 a0, A1 a1) - { - return call(mbed::callback(obj, method), a0, a1); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(const volatile T *obj, R(T::*method)(A0, A1) const volatile, A0 a0, A1 a1) - { - return call(mbed::callback(obj, method), a0, a1); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(T *obj, R(T::*method)(A0, A1, A2), A0 a0, A1 a1, A2 a2) - { - return call(mbed::callback(obj, method), a0, a1, a2); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(const T *obj, R(T::*method)(A0, A1, A2) const, A0 a0, A1 a1, A2 a2) - { - return call(mbed::callback(obj, method), a0, a1, a2); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(volatile T *obj, R(T::*method)(A0, A1, A2) volatile, A0 a0, A1 a1, A2 a2) - { - return call(mbed::callback(obj, method), a0, a1, a2); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(const volatile T *obj, R(T::*method)(A0, A1, A2) const volatile, A0 a0, A1 a1, A2 a2) - { - return call(mbed::callback(obj, method), a0, a1, a2); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(T *obj, R(T::*method)(A0, A1, A2, A3), A0 a0, A1 a1, A2 a2, A3 a3) - { - return call(mbed::callback(obj, method), a0, a1, a2, a3); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(const T *obj, R(T::*method)(A0, A1, A2, A3) const, A0 a0, A1 a1, A2 a2, A3 a3) - { - return call(mbed::callback(obj, method), a0, a1, a2, a3); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(volatile T *obj, R(T::*method)(A0, A1, A2, A3) volatile, A0 a0, A1 a1, A2 a2, A3 a3) - { - return call(mbed::callback(obj, method), a0, a1, a2, a3); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(const volatile T *obj, R(T::*method)(A0, A1, A2, A3) const volatile, A0 a0, A1 a1, A2 a2, A3 a3) - { - return call(mbed::callback(obj, method), a0, a1, a2, a3); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(T *obj, R(T::*method)(A0, A1, A2, A3, A4), A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call(mbed::callback(obj, method), a0, a1, a2, a3, a4); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(const T *obj, R(T::*method)(A0, A1, A2, A3, A4) const, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call(mbed::callback(obj, method), a0, a1, a2, a3, a4); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(volatile T *obj, R(T::*method)(A0, A1, A2, A3, A4) volatile, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call(mbed::callback(obj, method), a0, a1, a2, a3, a4); - } - - /** Calls an event on the queue - * @see EventQueue::call - */ - template - int call(const volatile T *obj, R(T::*method)(A0, A1, A2, A3, A4) const volatile, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call(mbed::callback(obj, method), a0, a1, a2, a3, a4); + return call(mbed::callback(obj, method), args...); } /** Calls an event on the queue after a specified delay @@ -938,276 +714,48 @@ public: * @see EventQueue::call_in * @param ms Time to delay in milliseconds * @param f Function to execute in the context of the dispatch loop - * @param a0 Argument to pass to the callback + * @param args Arguments to pass to the callback */ - template - int call_in(int ms, F f, A0 a0) + template + int call_in(int ms, F f, ArgTs... args) { - return call_in(ms, context10(f, a0)); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - * @param ms Time to delay in milliseconds - * @param f Function to execute in the context of the dispatch loop - * @param a0,a1 Arguments to pass to the callback - */ - template - int call_in(int ms, F f, A0 a0, A1 a1) - { - return call_in(ms, context20(f, a0, a1)); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - * @param ms Time to delay in milliseconds - * @param f Function to execute in the context of the dispatch loop - * @param a0,a1,a2 Arguments to pass to the callback - */ - template - int call_in(int ms, F f, A0 a0, A1 a1, A2 a2) - { - return call_in(ms, context30(f, a0, a1, a2)); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - * @param ms Time to delay in milliseconds - * @param f Function to execute in the context of the dispatch loop - * @param a0,a1,a2,a3 Arguments to pass to the callback - */ - template - int call_in(int ms, F f, A0 a0, A1 a1, A2 a2, A3 a3) - { - return call_in(ms, context40(f, a0, a1, a2, a3)); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - * @param ms Time to delay in milliseconds - * @param f Function to execute in the context of the dispatch loop - * @param a0,a1,a2,a3,a4 Arguments to pass to the callback - */ - template - int call_in(int ms, F f, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call_in(ms, context50(f, a0, a1, a2, a3, a4)); + return call_in(ms, context(f, args...)); } /** Calls an event on the queue after a specified delay * @see EventQueue::call_in */ - template - int call_in(int ms, T *obj, R(T::*method)()) + template + int call_in(int ms, T *obj, R(T::*method)(ArgTs...), ArgTs... args) { - return call_in(ms, mbed::callback(obj, method)); + return call_in(ms, mbed::callback(obj, method), args...); } /** Calls an event on the queue after a specified delay * @see EventQueue::call_in */ - template - int call_in(int ms, const T *obj, R(T::*method)() const) + template + int call_in(int ms, const T *obj, R(T::*method)(ArgTs...) const, ArgTs... args) { - return call_in(ms, mbed::callback(obj, method)); + return call_in(ms, mbed::callback(obj, method), args...); } /** Calls an event on the queue after a specified delay * @see EventQueue::call_in */ - template - int call_in(int ms, volatile T *obj, R(T::*method)() volatile) + template + int call_in(int ms, volatile T *obj, R(T::*method)(ArgTs...) volatile, ArgTs... args) { - return call_in(ms, mbed::callback(obj, method)); + return call_in(ms, mbed::callback(obj, method), args...); } /** Calls an event on the queue after a specified delay * @see EventQueue::call_in */ - template - int call_in(int ms, const volatile T *obj, R(T::*method)() const volatile) + template + int call_in(int ms, const volatile T *obj, R(T::*method)(ArgTs...) const volatile, ArgTs... args) { - return call_in(ms, mbed::callback(obj, method)); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, T *obj, R(T::*method)(A0), A0 a0) - { - return call_in(ms, mbed::callback(obj, method), a0); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, const T *obj, R(T::*method)(A0) const, A0 a0) - { - return call_in(ms, mbed::callback(obj, method), a0); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, volatile T *obj, R(T::*method)(A0) volatile, A0 a0) - { - return call_in(ms, mbed::callback(obj, method), a0); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, const volatile T *obj, R(T::*method)(A0) const volatile, A0 a0) - { - return call_in(ms, mbed::callback(obj, method), a0); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, T *obj, R(T::*method)(A0, A1), A0 a0, A1 a1) - { - return call_in(ms, mbed::callback(obj, method), a0, a1); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, const T *obj, R(T::*method)(A0, A1) const, A0 a0, A1 a1) - { - return call_in(ms, mbed::callback(obj, method), a0, a1); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, volatile T *obj, R(T::*method)(A0, A1) volatile, A0 a0, A1 a1) - { - return call_in(ms, mbed::callback(obj, method), a0, a1); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, const volatile T *obj, R(T::*method)(A0, A1) const volatile, A0 a0, A1 a1) - { - return call_in(ms, mbed::callback(obj, method), a0, a1); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, T *obj, R(T::*method)(A0, A1, A2), A0 a0, A1 a1, A2 a2) - { - return call_in(ms, mbed::callback(obj, method), a0, a1, a2); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, const T *obj, R(T::*method)(A0, A1, A2) const, A0 a0, A1 a1, A2 a2) - { - return call_in(ms, mbed::callback(obj, method), a0, a1, a2); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, volatile T *obj, R(T::*method)(A0, A1, A2) volatile, A0 a0, A1 a1, A2 a2) - { - return call_in(ms, mbed::callback(obj, method), a0, a1, a2); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, const volatile T *obj, R(T::*method)(A0, A1, A2) const volatile, A0 a0, A1 a1, A2 a2) - { - return call_in(ms, mbed::callback(obj, method), a0, a1, a2); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, T *obj, R(T::*method)(A0, A1, A2, A3), A0 a0, A1 a1, A2 a2, A3 a3) - { - return call_in(ms, mbed::callback(obj, method), a0, a1, a2, a3); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, const T *obj, R(T::*method)(A0, A1, A2, A3) const, A0 a0, A1 a1, A2 a2, A3 a3) - { - return call_in(ms, mbed::callback(obj, method), a0, a1, a2, a3); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, volatile T *obj, R(T::*method)(A0, A1, A2, A3) volatile, A0 a0, A1 a1, A2 a2, A3 a3) - { - return call_in(ms, mbed::callback(obj, method), a0, a1, a2, a3); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, const volatile T *obj, R(T::*method)(A0, A1, A2, A3) const volatile, A0 a0, A1 a1, A2 a2, A3 a3) - { - return call_in(ms, mbed::callback(obj, method), a0, a1, a2, a3); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, T *obj, R(T::*method)(A0, A1, A2, A3, A4), A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call_in(ms, mbed::callback(obj, method), a0, a1, a2, a3, a4); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, const T *obj, R(T::*method)(A0, A1, A2, A3, A4) const, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call_in(ms, mbed::callback(obj, method), a0, a1, a2, a3, a4); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, volatile T *obj, R(T::*method)(A0, A1, A2, A3, A4) volatile, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call_in(ms, mbed::callback(obj, method), a0, a1, a2, a3, a4); - } - - /** Calls an event on the queue after a specified delay - * @see EventQueue::call_in - */ - template - int call_in(int ms, const volatile T *obj, R(T::*method)(A0, A1, A2, A3, A4) const volatile, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call_in(ms, mbed::callback(obj, method), a0, a1, a2, a3, a4); + return call_in(ms, mbed::callback(obj, method), args...); } /** Calls an event on the queue periodically @@ -1245,277 +793,49 @@ public: /** Calls an event on the queue periodically * @see EventQueue::call_every * @param f Function to execute in the context of the dispatch loop - * @param a0 Argument to pass to the callback + * @param args Arguments to pass to the callback * @param ms Period of the event in milliseconds */ - template - int call_every(int ms, F f, A0 a0) + template + int call_every(int ms, F f, ArgTs... args) { - return call_every(ms, context10(f, a0)); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - * @param f Function to execute in the context of the dispatch loop - * @param a0,a1 Arguments to pass to the callback - * @param ms Period of the event in milliseconds - */ - template - int call_every(int ms, F f, A0 a0, A1 a1) - { - return call_every(ms, context20(f, a0, a1)); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - * @param f Function to execute in the context of the dispatch loop - * @param a0,a1,a2 Arguments to pass to the callback - * @param ms Period of the event in milliseconds - */ - template - int call_every(int ms, F f, A0 a0, A1 a1, A2 a2) - { - return call_every(ms, context30(f, a0, a1, a2)); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - * @param f Function to execute in the context of the dispatch loop - * @param a0,a1,a2,a3 Arguments to pass to the callback - * @param ms Period of the event in milliseconds - */ - template - int call_every(int ms, F f, A0 a0, A1 a1, A2 a2, A3 a3) - { - return call_every(ms, context40(f, a0, a1, a2, a3)); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - * @param f Function to execute in the context of the dispatch loop - * @param a0,a1,a2,a3,a4 Arguments to pass to the callback - * @param ms Period of the event in milliseconds - */ - template - int call_every(int ms, F f, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call_every(ms, context50(f, a0, a1, a2, a3, a4)); + return call_every(ms, context(f, args...)); } /** Calls an event on the queue periodically * @see EventQueue::call_every */ - template - int call_every(int ms, T *obj, R(T::*method)()) + template + int call_every(int ms, T *obj, R(T::*method)(ArgTs...), ArgTs... args) { - return call_every(ms, mbed::callback(obj, method)); + return call_every(ms, mbed::callback(obj, method), args...); } /** Calls an event on the queue periodically * @see EventQueue::call_every */ - template - int call_every(int ms, const T *obj, R(T::*method)() const) + template + int call_every(int ms, const T *obj, R(T::*method)(ArgTs...) const, ArgTs... args) { - return call_every(ms, mbed::callback(obj, method)); + return call_every(ms, mbed::callback(obj, method), args...); } /** Calls an event on the queue periodically * @see EventQueue::call_every */ - template - int call_every(int ms, volatile T *obj, R(T::*method)() volatile) + template + int call_every(int ms, volatile T *obj, R(T::*method)(ArgTs...) volatile, ArgTs... args) { - return call_every(ms, mbed::callback(obj, method)); + return call_every(ms, mbed::callback(obj, method), args...); } /** Calls an event on the queue periodically * @see EventQueue::call_every */ - template - int call_every(int ms, const volatile T *obj, R(T::*method)() const volatile) + template + int call_every(int ms, const volatile T *obj, R(T::*method)(ArgTs...) const volatile, ArgTs... args) { - return call_every(ms, mbed::callback(obj, method)); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, T *obj, R(T::*method)(A0), A0 a0) - { - return call_every(ms, mbed::callback(obj, method), a0); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, const T *obj, R(T::*method)(A0) const, A0 a0) - { - return call_every(ms, mbed::callback(obj, method), a0); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, volatile T *obj, R(T::*method)(A0) volatile, A0 a0) - { - return call_every(ms, mbed::callback(obj, method), a0); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, const volatile T *obj, R(T::*method)(A0) const volatile, A0 a0) - { - return call_every(ms, mbed::callback(obj, method), a0); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, T *obj, R(T::*method)(A0, A1), A0 a0, A1 a1) - { - return call_every(ms, mbed::callback(obj, method), a0, a1); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, const T *obj, R(T::*method)(A0, A1) const, A0 a0, A1 a1) - { - return call_every(ms, mbed::callback(obj, method), a0, a1); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, volatile T *obj, R(T::*method)(A0, A1) volatile, A0 a0, A1 a1) - { - return call_every(ms, mbed::callback(obj, method), a0, a1); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, const volatile T *obj, R(T::*method)(A0, A1) const volatile, A0 a0, A1 a1) - { - return call_every(ms, mbed::callback(obj, method), a0, a1); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, T *obj, R(T::*method)(A0, A1, A2), A0 a0, A1 a1, A2 a2) - { - return call_every(ms, mbed::callback(obj, method), a0, a1, a2); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, const T *obj, R(T::*method)(A0, A1, A2) const, A0 a0, A1 a1, A2 a2) - { - return call_every(ms, mbed::callback(obj, method), a0, a1, a2); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, volatile T *obj, R(T::*method)(A0, A1, A2) volatile, A0 a0, A1 a1, A2 a2) - { - return call_every(ms, mbed::callback(obj, method), a0, a1, a2); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, const volatile T *obj, R(T::*method)(A0, A1, A2) const volatile, A0 a0, A1 a1, A2 a2) - { - return call_every(ms, mbed::callback(obj, method), a0, a1, a2); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, T *obj, R(T::*method)(A0, A1, A2, A3), A0 a0, A1 a1, A2 a2, A3 a3) - { - return call_every(ms, mbed::callback(obj, method), a0, a1, a2, a3); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, const T *obj, R(T::*method)(A0, A1, A2, A3) const, A0 a0, A1 a1, A2 a2, A3 a3) - { - return call_every(ms, mbed::callback(obj, method), a0, a1, a2, a3); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, volatile T *obj, R(T::*method)(A0, A1, A2, A3) volatile, A0 a0, A1 a1, A2 a2, A3 a3) - { - return call_every(ms, mbed::callback(obj, method), a0, a1, a2, a3); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, const volatile T *obj, R(T::*method)(A0, A1, A2, A3) const volatile, A0 a0, A1 a1, A2 a2, A3 a3) - { - return call_every(ms, mbed::callback(obj, method), a0, a1, a2, a3); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, T *obj, R(T::*method)(A0, A1, A2, A3, A4), A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call_every(ms, mbed::callback(obj, method), a0, a1, a2, a3, a4); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, const T *obj, R(T::*method)(A0, A1, A2, A3, A4) const, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call_every(ms, mbed::callback(obj, method), a0, a1, a2, a3, a4); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, volatile T *obj, R(T::*method)(A0, A1, A2, A3, A4) volatile, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call_every(ms, mbed::callback(obj, method), a0, a1, a2, a3, a4); - } - - /** Calls an event on the queue periodically - * @see EventQueue::call_every - */ - template - int call_every(int ms, const volatile T *obj, R(T::*method)(A0, A1, A2, A3, A4) const volatile, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - return call_every(ms, mbed::callback(obj, method), a0, a1, a2, a3, a4); + return call_every(ms, mbed::callback(obj, method), args...); } /** Creates an event bound to the event queue @@ -1527,1298 +847,38 @@ public: * @param func Function to execute when the event is dispatched * @return Event that will dispatch on the specific queue */ - template - Event event(R(*func)()); + template + Event event(R(*func)(BoundArgTs..., ArgTs...), ContextArgTs... context_args); /** Creates an event bound to the event queue * @see EventQueue::event */ - template - Event event(T *obj, R(T::*method)()); + template + Event event(T *obj, R(T::*method)(BoundArgTs..., ArgTs...), ContextArgTs... context_args); /** Creates an event bound to the event queue * @see EventQueue::event */ - template - Event event(const T *obj, R(T::*method)() const); + template + Event event(const T *obj, R(T::*method)(BoundArgTs..., ArgTs...) const, ContextArgTs... context_args); /** Creates an event bound to the event queue * @see EventQueue::event */ - template - Event event(volatile T *obj, R(T::*method)() volatile); + template + Event event(volatile T *obj, R(T::*method)(BoundArgTs..., ArgTs...) volatile, ContextArgTs... context_args); /** Creates an event bound to the event queue * @see EventQueue::event */ - template - Event event(const volatile T *obj, R(T::*method)() const volatile); + template + Event event(const volatile T *obj, R(T::*method)(BoundArgTs..., ArgTs...) const volatile, ContextArgTs... context_args); /** Creates an event bound to the event queue * @see EventQueue::event */ - template - Event event(mbed::Callback cb); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0), C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0), C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0) const, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0) volatile, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0) const volatile, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1), C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1), C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1) const, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1) volatile, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1) const volatile, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2), C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2), C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, B2) const, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, B2) volatile, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1, B2) const volatile, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, B3), C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, B3), C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, B2, B3) const, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, B2, B3) volatile, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1, B2, B3) const volatile, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, B3, B4), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, B3, B4), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, B2, B3, B4) const, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, B2, B3, B4) volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(A0)); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(A0)); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(A0) const); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(A0) volatile); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(A0) const volatile); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, A0), C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, A0), C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, A0) const, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, A0) volatile, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, A0) const volatile, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, A0), C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, A0), C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, A0) const, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, A0) volatile, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1, A0) const volatile, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, A0), C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, A0), C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, B2, A0) const, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, B2, A0) volatile, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1, B2, A0) const volatile, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, B3, A0), C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, B3, A0), C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, B2, B3, A0) const, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, B2, B3, A0) volatile, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1, B2, B3, A0) const volatile, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, B3, B4, A0), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, B3, B4, A0), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, B2, B3, B4, A0) const, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, B2, B3, B4, A0) volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(A0, A1)); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(A0, A1)); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(A0, A1) const); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(A0, A1) volatile); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(A0, A1) const volatile); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, A0, A1), C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, A0, A1), C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, A0, A1) const, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, A0, A1) volatile, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, A0, A1) const volatile, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, A0, A1), C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, A0, A1), C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, A0, A1) const, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, A0, A1) volatile, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1, A0, A1) const volatile, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, A0, A1), C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, A0, A1), C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, B2, A0, A1) const, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1) volatile, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1) const volatile, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, B3, A0, A1), C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1), C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1) const, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1) volatile, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1) const volatile, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, B3, B4, A0, A1), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, B3, B4, A0, A1), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(A0, A1, A2)); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(A0, A1, A2)); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(A0, A1, A2) const); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(A0, A1, A2) volatile); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(A0, A1, A2) const volatile); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, A0, A1, A2), C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, A0, A1, A2), C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, A0, A1, A2) const, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, A0, A1, A2) volatile, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, A0, A1, A2) const volatile, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, A0, A1, A2), C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, A0, A1, A2), C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, A0, A1, A2) const, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2) volatile, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2) const volatile, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, A0, A1, A2), C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2), C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2) const, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2) volatile, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2) const volatile, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, B3, A0, A1, A2), C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1, A2), C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1, A2) const, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1, A2) volatile, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, B3, B4, A0, A1, A2), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, B3, B4, A0, A1, A2), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(A0, A1, A2, A3)); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(A0, A1, A2, A3)); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(A0, A1, A2, A3) const); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(A0, A1, A2, A3) volatile); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(A0, A1, A2, A3) const volatile); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, A0, A1, A2, A3), C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, A0, A1, A2, A3), C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, A0, A1, A2, A3) const, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, A0, A1, A2, A3) volatile, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, A0, A1, A2, A3) const volatile, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, A0, A1, A2, A3), C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3), C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3) const, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3) volatile, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3) const volatile, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3) const, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3) volatile, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3) const volatile, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, B3, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1, A2, A3) const, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1, A2, A3) volatile, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, B3, B4, A0, A1, A2, A3), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(A0, A1, A2, A3, A4)); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(A0, A1, A2, A3, A4)); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(A0, A1, A2, A3, A4) const); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(A0, A1, A2, A3, A4) volatile); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(A0, A1, A2, A3, A4) const volatile); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, A0, A1, A2, A3, A4), C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, A0, A1, A2, A3, A4), C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, A0, A1, A2, A3, A4) const, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, A0, A1, A2, A3, A4) volatile, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, A0, A1, A2, A3, A4) const volatile, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, A0, A1, A2, A3, A4), C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3, A4), C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3, A4) const, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3, A4) volatile, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1, A0, A1, A2, A3, A4) const volatile, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) const, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) volatile, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(const volatile T *obj, R(T::*method)(B0, B1, B2, A0, A1, A2, A3, A4) const volatile, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, B3, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(T *obj, R(T::*method)(B0, B1, B2, B3, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(R(*func)(B0, B1, B2, B3, B4, A0, A1, A2, A3, A4), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event 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); - - /** Creates an event bound to the event queue - * @see EventQueue::event - */ - template - Event event(mbed::Callback cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4); + template + Event event(mbed::Callback cb, ContextArgTs... context_args); #endif protected: @@ -2842,83 +902,91 @@ protected: } // Context structures + template + struct context; + template - struct context00 { + struct context { F f; - context00(F f) + context(F f) : f(f) {} - void operator()() + template + void operator()(ArgTs... args) { - f(); + f(args...); } }; template - struct context10 { + struct context { F f; C0 c0; - context10(F f, C0 c0) + context(F f, C0 c0) : f(f), c0(c0) {} - void operator()() + template + void operator()(ArgTs... args) { - f(c0); + f(c0, args...); } }; template - struct context20 { + struct context { F f; C0 c0; C1 c1; - context20(F f, C0 c0, C1 c1) + context(F f, C0 c0, C1 c1) : f(f), c0(c0), c1(c1) {} - void operator()() + template + void operator()(ArgTs... args) { - f(c0, c1); + f(c0, c1, args...); } }; template - struct context30 { + struct context { F f; C0 c0; C1 c1; C2 c2; - context30(F f, C0 c0, C1 c1, C2 c2) + context(F f, C0 c0, C1 c1, C2 c2) : f(f), c0(c0), c1(c1), c2(c2) {} - void operator()() + template + void operator()(ArgTs... args) { - f(c0, c1, c2); + f(c0, c1, c2, args...); } }; template - struct context40 { + struct context { F f; C0 c0; C1 c1; C2 c2; C3 c3; - context40(F f, C0 c0, C1 c1, C2 c2, C3 c3) + context(F f, C0 c0, C1 c1, C2 c2, C3 c3) : f(f), c0(c0), c1(c1), c2(c2), c3(c3) {} - void operator()() + template + void operator()(ArgTs... args) { - f(c0, c1, c2, c3); + f(c0, c1, c2, c3, args...); } }; template - struct context50 { + struct context { F f; C0 c0; C1 c1; @@ -2926,477 +994,13 @@ protected: C3 c3; C4 c4; - context50(F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) + context(F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) : f(f), c0(c0), c1(c1), c2(c2), c3(c3), c4(c4) {} - void operator()() + template + void operator()(ArgTs... args) { - f(c0, c1, c2, c3, c4); - } - }; - - template - struct context01 { - F f; - - context01(F f) - : f(f) {} - - void operator()(A0 a0) - { - f(a0); - } - }; - - template - struct context11 { - F f; - C0 c0; - - context11(F f, C0 c0) - : f(f), c0(c0) {} - - void operator()(A0 a0) - { - f(c0, a0); - } - }; - - template - struct context21 { - F f; - C0 c0; - C1 c1; - - context21(F f, C0 c0, C1 c1) - : f(f), c0(c0), c1(c1) {} - - void operator()(A0 a0) - { - f(c0, c1, a0); - } - }; - - template - struct context31 { - F f; - C0 c0; - C1 c1; - C2 c2; - - context31(F f, C0 c0, C1 c1, C2 c2) - : f(f), c0(c0), c1(c1), c2(c2) {} - - void operator()(A0 a0) - { - f(c0, c1, c2, a0); - } - }; - - template - struct context41 { - F f; - C0 c0; - C1 c1; - C2 c2; - C3 c3; - - context41(F f, C0 c0, C1 c1, C2 c2, C3 c3) - : f(f), c0(c0), c1(c1), c2(c2), c3(c3) {} - - void operator()(A0 a0) - { - f(c0, c1, c2, c3, a0); - } - }; - - template - struct context51 { - F f; - C0 c0; - C1 c1; - C2 c2; - C3 c3; - C4 c4; - - context51(F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) - : f(f), c0(c0), c1(c1), c2(c2), c3(c3), c4(c4) {} - - void operator()(A0 a0) - { - f(c0, c1, c2, c3, c4, a0); - } - }; - - template - struct context02 { - F f; - - context02(F f) - : f(f) {} - - void operator()(A0 a0, A1 a1) - { - f(a0, a1); - } - }; - - template - struct context12 { - F f; - C0 c0; - - context12(F f, C0 c0) - : f(f), c0(c0) {} - - void operator()(A0 a0, A1 a1) - { - f(c0, a0, a1); - } - }; - - template - struct context22 { - F f; - C0 c0; - C1 c1; - - context22(F f, C0 c0, C1 c1) - : f(f), c0(c0), c1(c1) {} - - void operator()(A0 a0, A1 a1) - { - f(c0, c1, a0, a1); - } - }; - - template - struct context32 { - F f; - C0 c0; - C1 c1; - C2 c2; - - context32(F f, C0 c0, C1 c1, C2 c2) - : f(f), c0(c0), c1(c1), c2(c2) {} - - void operator()(A0 a0, A1 a1) - { - f(c0, c1, c2, a0, a1); - } - }; - - template - struct context42 { - F f; - C0 c0; - C1 c1; - C2 c2; - C3 c3; - - context42(F f, C0 c0, C1 c1, C2 c2, C3 c3) - : f(f), c0(c0), c1(c1), c2(c2), c3(c3) {} - - void operator()(A0 a0, A1 a1) - { - f(c0, c1, c2, c3, a0, a1); - } - }; - - template - struct context52 { - F f; - C0 c0; - C1 c1; - C2 c2; - C3 c3; - C4 c4; - - context52(F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) - : f(f), c0(c0), c1(c1), c2(c2), c3(c3), c4(c4) {} - - void operator()(A0 a0, A1 a1) - { - f(c0, c1, c2, c3, c4, a0, a1); - } - }; - - template - struct context03 { - F f; - - context03(F f) - : f(f) {} - - void operator()(A0 a0, A1 a1, A2 a2) - { - f(a0, a1, a2); - } - }; - - template - struct context13 { - F f; - C0 c0; - - context13(F f, C0 c0) - : f(f), c0(c0) {} - - void operator()(A0 a0, A1 a1, A2 a2) - { - f(c0, a0, a1, a2); - } - }; - - template - struct context23 { - F f; - C0 c0; - C1 c1; - - context23(F f, C0 c0, C1 c1) - : f(f), c0(c0), c1(c1) {} - - void operator()(A0 a0, A1 a1, A2 a2) - { - f(c0, c1, a0, a1, a2); - } - }; - - template - struct context33 { - F f; - C0 c0; - C1 c1; - C2 c2; - - context33(F f, C0 c0, C1 c1, C2 c2) - : f(f), c0(c0), c1(c1), c2(c2) {} - - void operator()(A0 a0, A1 a1, A2 a2) - { - f(c0, c1, c2, a0, a1, a2); - } - }; - - template - struct context43 { - F f; - C0 c0; - C1 c1; - C2 c2; - C3 c3; - - context43(F f, C0 c0, C1 c1, C2 c2, C3 c3) - : f(f), c0(c0), c1(c1), c2(c2), c3(c3) {} - - void operator()(A0 a0, A1 a1, A2 a2) - { - f(c0, c1, c2, c3, a0, a1, a2); - } - }; - - template - struct context53 { - F f; - C0 c0; - C1 c1; - C2 c2; - C3 c3; - C4 c4; - - context53(F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) - : f(f), c0(c0), c1(c1), c2(c2), c3(c3), c4(c4) {} - - void operator()(A0 a0, A1 a1, A2 a2) - { - f(c0, c1, c2, c3, c4, a0, a1, a2); - } - }; - - template - struct context04 { - F f; - - context04(F f) - : f(f) {} - - void operator()(A0 a0, A1 a1, A2 a2, A3 a3) - { - f(a0, a1, a2, a3); - } - }; - - template - struct context14 { - F f; - C0 c0; - - context14(F f, C0 c0) - : f(f), c0(c0) {} - - void operator()(A0 a0, A1 a1, A2 a2, A3 a3) - { - f(c0, a0, a1, a2, a3); - } - }; - - template - struct context24 { - F f; - C0 c0; - C1 c1; - - context24(F f, C0 c0, C1 c1) - : f(f), c0(c0), c1(c1) {} - - void operator()(A0 a0, A1 a1, A2 a2, A3 a3) - { - f(c0, c1, a0, a1, a2, a3); - } - }; - - template - struct context34 { - F f; - C0 c0; - C1 c1; - C2 c2; - - context34(F f, C0 c0, C1 c1, C2 c2) - : f(f), c0(c0), c1(c1), c2(c2) {} - - void operator()(A0 a0, A1 a1, A2 a2, A3 a3) - { - f(c0, c1, c2, a0, a1, a2, a3); - } - }; - - template - struct context44 { - F f; - C0 c0; - C1 c1; - C2 c2; - C3 c3; - - context44(F f, C0 c0, C1 c1, C2 c2, C3 c3) - : f(f), c0(c0), c1(c1), c2(c2), c3(c3) {} - - void operator()(A0 a0, A1 a1, A2 a2, A3 a3) - { - f(c0, c1, c2, c3, a0, a1, a2, a3); - } - }; - - template - struct context54 { - F f; - C0 c0; - C1 c1; - C2 c2; - C3 c3; - C4 c4; - - context54(F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) - : f(f), c0(c0), c1(c1), c2(c2), c3(c3), c4(c4) {} - - void operator()(A0 a0, A1 a1, A2 a2, A3 a3) - { - f(c0, c1, c2, c3, c4, a0, a1, a2, a3); - } - }; - - template - struct context05 { - F f; - - context05(F f) - : f(f) {} - - void operator()(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - f(a0, a1, a2, a3, a4); - } - }; - - template - struct context15 { - F f; - C0 c0; - - context15(F f, C0 c0) - : f(f), c0(c0) {} - - void operator()(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - f(c0, a0, a1, a2, a3, a4); - } - }; - - template - struct context25 { - F f; - C0 c0; - C1 c1; - - context25(F f, C0 c0, C1 c1) - : f(f), c0(c0), c1(c1) {} - - void operator()(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - f(c0, c1, a0, a1, a2, a3, a4); - } - }; - - template - struct context35 { - F f; - C0 c0; - C1 c1; - C2 c2; - - context35(F f, C0 c0, C1 c1, C2 c2) - : f(f), c0(c0), c1(c1), c2(c2) {} - - void operator()(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - f(c0, c1, c2, a0, a1, a2, a3, a4); - } - }; - - template - struct context45 { - F f; - C0 c0; - C1 c1; - C2 c2; - C3 c3; - - context45(F f, C0 c0, C1 c1, C2 c2, C3 c3) - : f(f), c0(c0), c1(c1), c2(c2), c3(c3) {} - - void operator()(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - f(c0, c1, c2, c3, a0, a1, a2, a3, a4); - } - }; - - template - struct context55 { - F f; - C0 c0; - C1 c1; - C2 c2; - C3 c3; - C4 c4; - - context55(F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4) - : f(f), c0(c0), c1(c1), c2(c2), c3(c3), c4(c4) {} - - void operator()(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { - f(c0, c1, c2, c3, c4, a0, a1, a2, a3, a4); + f(c0, c1, c2, c3, c4, args...); } }; #endif //!defined(DOXYGEN_ONLY)