mbed.org local branch of microbit-dal. The real version lives in git at https://github.com/lancaster-university/microbit-dal

Dependencies:   BLE_API nRF51822 mbed-dev-bin

Dependents:   microbit Microbit IoTChallenge1 microbit ... more

Embed: (wiki syntax)

« Back to documentation index

MemberFunctionCallback Class Reference

MemberFunctionCallback Class Reference

Class definition for a MemberFunctionCallback. More...

#include <MemberFunctionCallback.h>

Public Member Functions

template<typename T >
 MemberFunctionCallback (T *object, void(T::*method)(MicroBitEvent e))
 Constructor.
bool operator== (const MemberFunctionCallback &mfc)
 A comparison of two MemberFunctionCallback objects.
void fire (MicroBitEvent e)
 Calls the method reference held by this MemberFunctionCallback.

Detailed Description

Class definition for a MemberFunctionCallback.

C++ member functions (also known as methods) have a more complex representation than normal C functions. This class allows a reference to a C++ member function to be stored then called at a later date.

This class is used extensively by the MicroBitMessageBus to deliver events to C++ methods.

Definition at line 44 of file MemberFunctionCallback.h.


Constructor & Destructor Documentation

MemberFunctionCallback ( T *  object,
void(T::*)(MicroBitEvent e)  method 
)

Constructor.

Creates a MemberFunctionCallback based on a pointer to given method.

Parameters:
objectThe object the callback method should be invooked on.
methodThe method to invoke.

Definition at line 86 of file MemberFunctionCallback.h.


Member Function Documentation

void fire ( MicroBitEvent  e )

Calls the method reference held by this MemberFunctionCallback.

Class definition for a MemberFunctionCallback.

Parameters:
eThe event to deliver to the method

C++ member functions (also known as methods) have a more complex representation than normal C functions. This class allows a reference to a C++ member function to be stored then called at a later date.

This class is used extensively by the MicroBitMessageBus to deliver events to C++ methods. Calls the method reference held by this MemberFunctionCallback.

Parameters:
eThe event to deliver to the method

Definition at line 45 of file MemberFunctionCallback.cpp.

bool operator== ( const MemberFunctionCallback mfc )

A comparison of two MemberFunctionCallback objects.

Returns:
true if the given MemberFunctionCallback is equivalent to this one, false otherwise.

Definition at line 55 of file MemberFunctionCallback.cpp.