Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions
CallChain Class Reference

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

#include <CallChain.h>

Inheritance diagram for CallChain:
NonCopyable< CallChain >

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
 

Detailed Description

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.

Deprecated:
Do not use this class. This class is not part of the public API of mbed-os and is being removed in the future.
Note
Synchronization level: Not protected

Example:

#include "mbed.h"
CallChain chain;
void first(void) {
printf("'first' function.\n");
}
void second(void) {
printf("'second' function.\n");
}
class Test {
public:
void f(void) {
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 75 of file CallChain.h.

Constructor & Destructor Documentation

CallChain ( int  size = 4)

Create an empty chain.

Deprecated:
Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
Parameters
size(optional) Initial size of the chain
virtual ~CallChain ( )
virtual

Create an empty chain.

Deprecated:
Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.

Member Function Documentation

pFunctionPointer_t add ( Callback< void()>  func)

Add a function at the end of the chain.

Deprecated:
Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
Parameters
funcA pointer to a void function
Returns
The function object created for 'func'
pFunctionPointer_t add ( T *  obj,
method 
)

Add a function at the end of the chain.

Parameters
objpointer to the object to call the member function on
methodpointer to the member function to be called
Returns
The function object created for 'obj' and 'method'
Deprecated:
The add function does not support cv-qualifiers. Replaced by add(callback(obj, method)).

Definition at line 127 of file CallChain.h.

pFunctionPointer_t add_front ( Callback< void()>  func)

Add a function at the beginning of the chain.

Deprecated:
Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
Parameters
funcA pointer to a void function
Returns
The function object created for 'func'
pFunctionPointer_t add_front ( T *  obj,
method 
)

Add a function at the beginning of the chain.

Parameters
objpointer to the object to call the member function on
methodpointer to the member function to be called
Returns
The function object created for the object and method pointers
Deprecated:
The add_front function does not support cv-qualifiers. Replaced by add_front(callback(obj, method)).

Definition at line 162 of file CallChain.h.

void call ( )

Call all the functions in the chain in sequence.

Deprecated:
Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
void clear ( )

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

Deprecated:
Do not use this function. This class is not part of the public API of mbed-os and is being removed in the future.
int find ( pFunctionPointer_t  f) const

Look for a function object in the call chain.

Deprecated:
Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
Parameters
fthe function object to search
Returns
The index of the function object if found, -1 otherwise.
pFunctionPointer_t get ( int  i) const

Get a function object from the chain.

Deprecated:
Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
Parameters
ifunction object index
Returns
The function object at position 'i' in the chain
void operator() ( void  )
Deprecated:
Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.

Definition at line 238 of file CallChain.h.

pFunctionPointer_t operator[] ( int  i) const
Deprecated:
Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.

Definition at line 250 of file CallChain.h.

bool remove ( pFunctionPointer_t  f)

Remove a function object from the chain.

Deprecated:
Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
  • f the function object to remove
Returns
true if the function object was found and removed, false otherwise.
int size ( ) const

Get the number of functions in the chain.

Deprecated:
Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.