Added an EddystoneURLConfigService in addition to UriBeaconConfigService. Updated README and converted comments that used UriBeacon to EddystoneURL in the EddystoneService.h

Dependents:   mbed_EddystoneURL_Beacon_ssci mbed_EddystoneURL_Beacon_ssci mbed_EddystoneURL_Beacon_ssci

Fork of BLE_API by Bluetooth Low Energy

Embed: (wiki syntax)

« Back to documentation index

CallChainOfFunctionPointersWithContext< ContextType > Class Template Reference

CallChainOfFunctionPointersWithContext< ContextType > Class Template Reference

Group one or more functions in an instance of a CallChainOfFunctionPointersWithContext, then call them in sequence using CallChainOfFunctionPointersWithContext::call(). More...

#include <CallChainOfFunctionPointersWithContext.h>

Public Member Functions

 CallChainOfFunctionPointersWithContext ()
 Create an empty chain.
pFunctionPointerWithContext_t add (void(*function)(ContextType context))
 Add a function at the front of the chain.
template<typename T >
pFunctionPointerWithContext_t add (T *tptr, void(T::*mptr)(ContextType context))
 Add a function at the front of the chain.
void clear (void)
 Clear the call chain (remove all functions in the chain).
void call (ContextType context)
 Call all the functions in the chain in sequence : the stack frames of all the callbacks within the chained FunctionPointers will stack up.

Detailed Description

template<typename ContextType>
class CallChainOfFunctionPointersWithContext< ContextType >

Group one or more functions in an instance of a CallChainOfFunctionPointersWithContext, then call them in sequence using CallChainOfFunctionPointersWithContext::call().

Used mostly by the interrupt chaining code, but can be used for other purposes.

Example:

 CallChainOfFunctionPointersWithContext<void *> chain;

 void first(void *context) {
     printf("'first' function.\n");
 }

 void second(void *context) {
     printf("'second' function.\n");
 }

 class Test {
 public:
     void f(void *context) {
         printf("A::f (class member).\n");
     }
 };

 int main() {
     Test test;

     chain.add(second);
     chain.add_front(first);
     chain.add(&test, &Test::f);
     chain.call();
 }

Definition at line 59 of file CallChainOfFunctionPointersWithContext.h.


Constructor & Destructor Documentation

Create an empty chain.

Parameters:
size(optional) Initial size of the chain

Definition at line 68 of file CallChainOfFunctionPointersWithContext.h.


Member Function Documentation

pFunctionPointerWithContext_t add ( void(*)(ContextType context)  function )

Add a function at the front of the chain.

Parameters:
functionA pointer to a void function
Returns:
The function object created for 'function'

Definition at line 83 of file CallChainOfFunctionPointersWithContext.h.

pFunctionPointerWithContext_t add ( T *  tptr,
void(T::*)(ContextType context)  mptr 
)

Add a function at the front of the chain.

Parameters:
tptrpointer to the object to call the member function on
mptrpointer to the member function to be called
Returns:
The function object created for 'tptr' and 'mptr'

Definition at line 96 of file CallChainOfFunctionPointersWithContext.h.

void call ( ContextType  context )

Call all the functions in the chain in sequence : the stack frames of all the callbacks within the chained FunctionPointers will stack up.

Hopefully there won't be too many chained FunctionPointers.

Definition at line 122 of file CallChainOfFunctionPointersWithContext.h.

void clear ( void   )

Clear the call chain (remove all functions in the chain).

Definition at line 102 of file CallChainOfFunctionPointersWithContext.h.