mbed-os/hal/api
Christopher Haster 161a2ec259 callback - Added size-limited function-object overloads to Callback
The callback class can now accept generalized function-objects:

    class Thing {
    public:
        int value;

        void operator()() {
            printf("hi! %d\n", value);
        }
    };

    Callback<void()> cb(Thing(2));

However, with the intention of avoiding implicit dynamic-memory
allocations, the Callback class is limited to a single word of storage.
Exceeding this size will eliminate the function-object type from the
overload set and fail to compile.

Effort was invested to make this situation very clear to the user. Here
is an example error message with noise removed:

    [ERROR] ./main.cpp: In function 'int main()':
    ./mbed-os/hal/api/Ticker.h:101:10: note:
        no known conversion for argument 1 from 'BigFunc' to 'mbed::Callback<void()>'

The real benefit of this change is the ability for users to hook into
the attributes of the Callback class. This mostly allows lifetime
management of the function-objects from third-party libraries (such as
the Event class from mbed-events).

Note: The convenient `callback` function may become ambiguous if
provided with a type that defines multiple incompatible `operator()`
member functions.
2016-09-28 12:23:29 -05:00
..
AnalogIn.h Create dedicated file for PlatformMutex 2016-07-28 14:21:04 -05:00
AnalogOut.h Create dedicated file for PlatformMutex 2016-07-28 14:21:04 -05:00
BusIn.h Create dedicated file for PlatformMutex 2016-07-28 14:21:04 -05:00
BusInOut.h Create dedicated file for PlatformMutex 2016-07-28 14:21:04 -05:00
BusOut.h Create dedicated file for PlatformMutex 2016-07-28 14:21:04 -05:00
CAN.h Set size of callback irq array to IrqCnt 2016-08-30 10:33:44 -05:00
CThunk.h Change cthunk implementation + cm7 support 2016-09-13 15:45:58 +02:00
CallChain.h Added support for cv-qualifiers in Callback class 2016-08-26 09:40:22 -05:00
Callback.h callback - Added size-limited function-object overloads to Callback 2016-09-28 12:23:29 -05:00
CircularBuffer.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
DigitalIn.h Remove macro for operators. Enable these as default behavior 2016-07-10 13:47:13 -05:00
DigitalInOut.h Remove macro for operators. Enable these as default behavior 2016-07-10 13:47:13 -05:00
DigitalOut.h Remove macro for operators. Enable these as default behavior 2016-07-10 13:47:13 -05:00
DirHandle.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
Ethernet.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
FileBase.h Create dedicated file for PlatformMutex 2016-07-28 14:21:04 -05:00
FileHandle.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
FileLike.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
FilePath.h Simplify layout: 2016-05-23 09:13:59 +01:00
FileSystemLike.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
FunctionPointer.h Updated minor functionality of the Callback class 2016-08-26 09:54:02 -05:00
I2C.h Create dedicated file for PlatformMutex 2016-07-28 14:21:04 -05:00
I2CSlave.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
InterruptIn.h Added support for cv-qualifiers in Callback class 2016-08-26 09:40:22 -05:00
InterruptManager.h Create dedicated file for PlatformMutex 2016-07-28 14:21:04 -05:00
LocalFileSystem.h Create dedicated file for PlatformMutex 2016-07-28 14:21:04 -05:00
LowPowerTicker.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
LowPowerTimeout.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
LowPowerTimer.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
PlatformMutex.h Create dedicated file for PlatformMutex 2016-07-28 14:21:04 -05:00
PortIn.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
PortInOut.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
PortOut.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
PwmOut.h Remove macro for operators. Enable these as default behavior 2016-07-10 13:47:13 -05:00
RawSerial.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
SPI.h Merge pull request #2297 from neilt6/spi-mutex-fix 2016-07-29 17:30:38 +02:00
SPISlave.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
Serial.h Create dedicated file for PlatformMutex 2016-07-28 14:21:04 -05:00
SerialBase.h Merge pull request #2584 from c1728p9/array_size_count 2016-09-10 07:08:07 -05:00
SingletonPtr.h Fix SingletonPtr problems 2016-08-19 18:41:16 -05:00
Stream.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
Ticker.h Added support for cv-qualifiers in Callback class 2016-08-26 09:40:22 -05:00
Timeout.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
Timer.h Remove macro for operators. Enable these as default behavior 2016-07-10 13:47:13 -05:00
TimerEvent.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
Transaction.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
can_helper.h Simplify layout: 2016-05-23 09:13:59 +01:00
critical.h Minor documentation updates for critical 2016-07-06 13:06:37 -05:00
mbed.h mbed lib revision - 123 2016-08-15 14:55:12 +01:00
mbed_assert.h Simplify layout: 2016-05-23 09:13:59 +01:00
mbed_debug.h Simplify layout: 2016-05-23 09:13:59 +01:00
mbed_error.h Simplify layout: 2016-05-23 09:13:59 +01:00
mbed_interface.h Update assert and error to be interrupt safe 2016-06-11 17:33:10 +01:00
mbed_mem_trace.h Runtime dynamic memory tracing 2016-08-26 09:42:39 -05:00
mbed_stats.h Heap statistics 2016-08-22 18:32:51 -05:00
platform.h Create dedicated file for PlatformMutex 2016-07-28 14:21:04 -05:00
rtc_time.h Add sync level documentation to classes 2016-06-11 17:33:09 +01:00
semihost_api.h semihost - fix inline __semihost for IAR (add static) 2016-05-23 09:50:20 +01:00
toolchain.h Runtime dynamic memory tracing 2016-08-26 09:42:39 -05:00
wait_api.h Simplify layout: 2016-05-23 09:13:59 +01:00