ARMmbed / mbed-events

DEPRECATED! This project has moved to mbed-os
https://github.com/ARMmbed/mbed-os/tree/master/events
Apache License 2.0
11 stars 6 forks source link

Add member-function overloads for event functions #19

Closed geky closed 7 years ago

geky commented 7 years ago

Added the following overloads:

event(T *,                R (T::*)(A...),                A...);
event(const T *,          R (T::*)(A...) const,          A...);
event(volatile T *,       R (T::*)(A...) volatile,       A...);
event(const volatile T *, R (T::*)(A...) const volatile, A...);

To the following functions:

EventQueue::call
EventQueue::call_in
EventQueue::call_every
EventQueue::event
Event::Event

This does allow the traditional form of mbed callbacks:

Event<void(int)> event(&object, &Object::method, arg1);
event->post(arg2);

But also adds a significant number of overloads due to the cv attributes. It may be worth it in this situation to conform to the user's expectations.

@pan-, @bogdanm thoughts?

bogdanm commented 7 years ago

:+1: