Asynchronous Serial Library with flow control and tag detection.
FunctionPointerWithContext< ContextType > Class Template Reference
A class for storing and calling a pointer to a static or member void function which takes a context. More...
#include <FunctionPointerWithContext.h>
Public Member Functions | |
FunctionPointerWithContext (void(*function)(ContextType context)=NULL) | |
Create a FunctionPointerWithContext, attaching a static function. | |
template<typename T > | |
FunctionPointerWithContext (T *object, void(T::*member)(ContextType context)) | |
Create a FunctionPointerWithContext, attaching a member function. | |
void | attach (void(*function)(ContextType context)=NULL) |
Attach a static function. | |
template<typename T > | |
void | attach (T *object, void(T::*member)(ContextType context)) |
Attach a member function. | |
void | call (ContextType context) |
Call the attached static or member function; and if there are chained FunctionPointers their callbacks are invoked as well. | |
void | chainAsNext (pFunctionPointerWithContext_t next) |
Setup an external FunctionPointer as a next in the chain of related callbacks. |
Detailed Description
template<typename ContextType>
class FunctionPointerWithContext< ContextType >
A class for storing and calling a pointer to a static or member void function which takes a context.
Definition at line 27 of file FunctionPointerWithContext.h.
Constructor & Destructor Documentation
FunctionPointerWithContext | ( | void(*)(ContextType context) | function = NULL ) |
Create a FunctionPointerWithContext, attaching a static function.
- Parameters:
-
function The void static function to attach (default is none)
Definition at line 36 of file FunctionPointerWithContext.h.
FunctionPointerWithContext | ( | T * | object, |
void(T::*)(ContextType context) | member | ||
) |
Create a FunctionPointerWithContext, attaching a member function.
- Parameters:
-
object The object pointer to invoke the member function on (i.e. the this pointer) function The address of the void member function to attach
Definition at line 47 of file FunctionPointerWithContext.h.
Member Function Documentation
void attach | ( | void(*)(ContextType context) | function = NULL ) |
Attach a static function.
- Parameters:
-
function The void static function to attach (default is none)
Definition at line 56 of file FunctionPointerWithContext.h.
void attach | ( | T * | object, |
void(T::*)(ContextType context) | member | ||
) |
Attach a member function.
- Parameters:
-
object The object pointer to invoke the member function on (i.e. the this pointer) function The address of the void member function to attach
Definition at line 67 of file FunctionPointerWithContext.h.
void call | ( | ContextType | context ) |
Call the attached static or member function; and if there are chained FunctionPointers their callbacks are invoked as well.
: all chained callbacks stack up; so hopefully there won't be too many FunctionPointers in a chain.
Definition at line 78 of file FunctionPointerWithContext.h.
void chainAsNext | ( | pFunctionPointerWithContext_t | next ) |
Setup an external FunctionPointer as a next in the chain of related callbacks.
Invoking call() on the head FunctionPointer will invoke all chained callbacks.
Refer to 'CallChain' as an alternative.
Definition at line 98 of file FunctionPointerWithContext.h.
Generated on Tue Jul 12 2022 18:48:23 by 1.7.2