Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
STcallback Class Reference
STcallback - Adds callbacks that take SimpleTask * pointer data type. More...
#include <STcallback.h>
Public Member Functions | |
| STcallback () | |
| Constructor. | |
| void | attach (void(*function)(SimpleTask *)=0) |
| attach - Overloaded attachment function. | |
| template<class T > | |
| void | attach (T *item=0, void(T::*method)(SimpleTask *)=0) |
| attach - Overloaded attachment function. | |
| void | call (SimpleTask *arg) |
| call - Overloaded callback initiator. | |
Protected Attributes | |
| void(* | c_callback )(SimpleTask *) |
| C callback function pointer. | |
| STcallbackDummy * | obj_callback |
| C++ callback object/method pointer (the object part). | |
| void(STcallbackDummy::* | method_callback )(SimpleTask *) |
| C++ callback object/method pointer (the method part). | |
Detailed Description
STcallback - Adds callbacks that take SimpleTask * pointer data type.
The Mbed library supplies a callback using the FunctionPointer object as defined in FunctionPointer.h However, this callback system does not allow the caller to pass a value to the callback. Likewise, the callback itself cannot return a value.
Note, when passing pointers to variables to the callback, if the callback function/method changes that variable's value then it will also change the value the caller sees. If C pointers are new to you, you are strongly advised to read up on the subject. It's pointers that often get beginners into trouble when mis-used.
- See also:
- http://mbed.org/handbook/C-Data-Types
- http://mbed.org/projects/libraries/svn/mbed/trunk/FunctionPointer.h
- http://mbed.org/cookbook/FunctionPointer
- http://mbed.org/cookbook/FPointer
Definition at line 49 of file STcallback.h.
Constructor & Destructor Documentation
| STcallback | ( | ) |
Constructor.
Definition at line 66 of file STcallback.h.
Member Function Documentation
| void attach | ( | void(*)(SimpleTask *) | function = 0 ) |
attach - Overloaded attachment function.
Attach a C type function pointer as the callback.
Note, the callback function prototype must be:-
void myCallbackFunction(SimpleTask *p);
- Parameters:
-
A C function pointer to call.
Definition at line 82 of file STcallback.h.
| void attach | ( | T * | item = 0, |
| void(T::*)(SimpleTask *) | method = 0 |
||
| ) |
attach - Overloaded attachment function.
Attach a C++ type object/method pointer as the callback.
Note, the callback method prototype must be:-
public: void myCallbackFunction(SimpleTask *p);
- Parameters:
-
A C++ object pointer. A C++ method within the object to call.
Definition at line 97 of file STcallback.h.
| void call | ( | SimpleTask * | arg ) |
call - Overloaded callback initiator.
call the callback function.
- Parameters:
-
SimpleTask * pointer.
Definition at line 108 of file STcallback.h.
Field Documentation
void(* c_callback)(SimpleTask *) [protected] |
C callback function pointer.
Definition at line 54 of file STcallback.h.
void(STcallbackDummy::* method_callback)(SimpleTask *) [protected] |
C++ callback object/method pointer (the method part).
Definition at line 60 of file STcallback.h.
STcallbackDummy* obj_callback [protected] |
C++ callback object/method pointer (the object part).
Definition at line 57 of file STcallback.h.
Generated on Fri Jul 15 2022 08:21:53 by
1.7.2