mbed-drivers
Public Member Functions | List of all members
mbed::CallChain Class Reference

Public Member Functions

 CallChain (int size=4)
 
pFunctionPointer_t add (void(*function)(void))
 
template<typename T >
pFunctionPointer_t add (T *tptr, void(T::*mptr)(void))
 
pFunctionPointer_t add_front (void(*function)(void))
 
template<typename T >
pFunctionPointer_t add_front (T *tptr, void(T::*mptr)(void))
 
int size () const
 
pFunctionPointer_t get (int i) const
 
int find (pFunctionPointer_t f) const
 
void clear ()
 
bool remove (pFunctionPointer_t f)
 
void call ()
 
void operator() (void)
 
pFunctionPointer_t operator[] (int i) const
 

Constructor & Destructor Documentation

mbed::CallChain::CallChain ( int  size = 4)

Create an empty chain

Parameters
size(optional) Initial size of the chain

Member Function Documentation

pFunctionPointer_t mbed::CallChain::add ( void(*)(void)  function)

Add a function at the end of the chain

Parameters
functionA pointer to a void function
Returns
The function object created for 'function'
template<typename T >
pFunctionPointer_t mbed::CallChain::add ( T *  tptr,
void(T::*)(void)  mptr 
)
inline

Add a function at the end 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'
pFunctionPointer_t mbed::CallChain::add_front ( void(*)(void)  function)

Add a function at the beginning of the chain

Parameters
functionA pointer to a void function
Returns
The function object created for 'function'
template<typename T >
pFunctionPointer_t mbed::CallChain::add_front ( T *  tptr,
void(T::*)(void)  mptr 
)
inline

Add a function at the beginning 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'
void mbed::CallChain::call ( )

Call all the functions in the chain in sequence

void mbed::CallChain::clear ( )

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

int mbed::CallChain::find ( pFunctionPointer_t  f) const

Look for a function object in the call chain

Parameters
fthe function object to search
Returns
The index of the function object if found, -1 otherwise.
pFunctionPointer_t mbed::CallChain::get ( int  i) const

Get a function object from the chain

Parameters
ifunction object index
Returns
The function object at position 'i' in the chain
bool mbed::CallChain::remove ( pFunctionPointer_t  f)

Remove a function object from the chain

  • f the function object to remove
Returns
true if the function object was found and removed, false otherwise.
int mbed::CallChain::size ( ) const

Get the number of functions in the chain


The documentation for this class was generated from the following files: