Group one or more functions in an instance of a CallChain, then call them in sequence using CallChain::call(). More...
#include <CallChain.h>
Public Member Functions | |
CallChain (int size=4) | |
Create an empty chain. More... | |
virtual | ~CallChain () |
Create an empty chain. More... | |
pFunctionPointer_t | add (Callback< void()> func) |
Add a function at the end of the chain. More... | |
template<typename T , typename M > | |
pFunctionPointer_t | add (T *obj, M method) |
Add a function at the end of the chain. More... | |
pFunctionPointer_t | add_front (Callback< void()> func) |
Add a function at the beginning of the chain. More... | |
template<typename T , typename M > | |
pFunctionPointer_t | add_front (T *obj, M method) |
Add a function at the beginning of the chain. More... | |
int | size () const |
Get the number of functions in the chain. More... | |
pFunctionPointer_t | get (int i) const |
Get a function object from the chain. More... | |
int | find (pFunctionPointer_t f) const |
Look for a function object in the call chain. More... | |
void | clear () |
Clear the call chain (remove all functions in the chain). More... | |
bool | remove (pFunctionPointer_t f) |
Remove a function object from the chain. More... | |
void | call () |
Call all the functions in the chain in sequence. More... | |
void | operator() (void) |
pFunctionPointer_t | operator[] (int i) const |
Group one or more functions in an instance of a CallChain, then call them in sequence using CallChain::call().
Used mostly by the interrupt chaining code, but can be used for other purposes.
Example:
Definition at line 76 of file CallChain.h.
CallChain | ( | int | size = 4 | ) |
Create an empty chain.
size | (optional) Initial size of the chain |
|
virtual |
Create an empty chain.
pFunctionPointer_t add | ( | Callback< void()> | func | ) |
Add a function at the end of the chain.
func | A pointer to a void function |
pFunctionPointer_t add | ( | T * | obj, |
M | method | ||
) |
Add a function at the end of the chain.
obj | pointer to the object to call the member function on |
method | pointer to the member function to be called |
Definition at line 126 of file CallChain.h.
pFunctionPointer_t add_front | ( | Callback< void()> | func | ) |
Add a function at the beginning of the chain.
func | A pointer to a void function |
pFunctionPointer_t add_front | ( | T * | obj, |
M | method | ||
) |
Add a function at the beginning of the chain.
obj | pointer to the object to call the member function on |
method | pointer to the member function to be called |
Definition at line 161 of file CallChain.h.
void call | ( | ) |
Call all the functions in the chain in sequence.
void clear | ( | ) |
Clear the call chain (remove all functions in the chain).
int find | ( | pFunctionPointer_t | f | ) | const |
Look for a function object in the call chain.
f | the function object to search |
pFunctionPointer_t get | ( | int | i | ) | const |
Get a function object from the chain.
i | function object index |
void operator() | ( | void | ) |
Definition at line 237 of file CallChain.h.
pFunctionPointer_t operator[] | ( | int | i | ) | const |
Definition at line 249 of file CallChain.h.
bool remove | ( | pFunctionPointer_t | f | ) |
Remove a function object from the chain.
int size | ( | ) | const |
Get the number of functions in the chain.