Function like object hosting a list of FunctionPointerWithContext. More...
#include <CallChainOfFunctionPointersWithContext.h>
Public Types | |
| typedef FunctionPointerWithContext< ContextType > * | pFunctionPointerWithContext_t |
| Alias of the FunctionPointerWithContext type this object can store. More... | |
Public Member Functions | |
| CallChainOfFunctionPointersWithContext () | |
| Create an empty callchain. More... | |
| virtual | ~CallChainOfFunctionPointersWithContext () |
| Destruction of the callchain. More... | |
| pFunctionPointerWithContext_t | add (void(*function)(ContextType context)) |
| Add a function pointer at the front of the chain. More... | |
| template<typename T > | |
| pFunctionPointerWithContext_t | add (T *tptr, void(T::*mptr)(ContextType context)) |
| Add a member function bound to its instance at the front of the chain. More... | |
| pFunctionPointerWithContext_t | add (const FunctionPointerWithContext< ContextType > &func) |
| Add a FunctionPointerWithContext at the front of the chain. More... | |
| bool | detach (const FunctionPointerWithContext< ContextType > &toDetach) |
| Detach a function pointer from a callchain. More... | |
| void | clear (void) |
| Remove all functions registered in the chain. More... | |
| bool | hasCallbacksAttached (void) const |
| Check whether the callchain contains any callbacks. More... | |
| void | call (ContextType context) |
| Call sequentially each member of the chain. More... | |
| void | call (ContextType context) const |
| Call sequentially each member of the chain. More... | |
| void | operator() (ContextType context) const |
| Call sequentially each member of the chain. More... | |
| bool | toBool () const |
| Test if the callchain is empty or not. More... | |
| operator BoolType_t () const | |
| Bool operator implementation, derived class must provide a bool toBool() const function. More... | |
Protected Types | |
| typedef void(base::* | BoolType_t) () const |
| The bool type is a pointer to method that can be used in boolean context. More... | |
Protected Member Functions | |
| void | invalidTag () const |
| Nonimplemented call, use to disallow conversion between unrelated types. More... | |
| void | trueTag () const |
| Special member function that indicates a true value. More... | |
Function like object hosting a list of FunctionPointerWithContext.
Upon call, each FunctionPointerWithContext instance present in the object will be called in sequence with the initial parameters.
It can be seen as a variation of the observer pattern this object being the observable, instances of the FunctionPointerWithContext being the observable and the notify/update operation being the function call.
Example:
| ContextType | Type of the parameter accepted by the callbacks hosted in the object. |
Definition at line 82 of file CallChainOfFunctionPointersWithContext.h.
|
protectedinherited |
The bool type is a pointer to method that can be used in boolean context.
Definition at line 48 of file SafeBool.h.
| typedef FunctionPointerWithContext<ContextType>* pFunctionPointerWithContext_t |
Alias of the FunctionPointerWithContext type this object can store.
Definition at line 88 of file CallChainOfFunctionPointersWithContext.h.
Create an empty callchain.
Definition at line 94 of file CallChainOfFunctionPointersWithContext.h.
|
virtual |
Destruction of the callchain.
Definition at line 99 of file CallChainOfFunctionPointersWithContext.h.
| pFunctionPointerWithContext_t add | ( | void(*)(ContextType context) | function | ) |
Add a function pointer at the front of the chain.
| [in] | function | A pointer to a void function. |
function. Definition at line 111 of file CallChainOfFunctionPointersWithContext.h.
| pFunctionPointerWithContext_t add | ( | T * | tptr, |
| void(T::*)(ContextType context) | mptr | ||
| ) |
Add a member function bound to its instance at the front of the chain.
| [in] | tptr | Pointer to the object to call the member function on. |
| [in] | mptr | Pointer to the member function to be called. |
tptr and mptr. Definition at line 126 of file CallChainOfFunctionPointersWithContext.h.
| pFunctionPointerWithContext_t add | ( | const FunctionPointerWithContext< ContextType > & | func | ) |
Add a FunctionPointerWithContext at the front of the chain.
| [in] | func | The FunctionPointerWithContext to add. |
func. Definition at line 138 of file CallChainOfFunctionPointersWithContext.h.
| void call | ( | ContextType | context | ) |
Call sequentially each member of the chain.
| [in] | context | Parameter to pass to the functions called. |
Definition at line 213 of file CallChainOfFunctionPointersWithContext.h.
| void call | ( | ContextType | context | ) | const |
Call sequentially each member of the chain.
| [in] | context | Parameter to pass to the functions called. |
Definition at line 223 of file CallChainOfFunctionPointersWithContext.h.
| void clear | ( | void | ) |
Remove all functions registered in the chain.
Definition at line 186 of file CallChainOfFunctionPointersWithContext.h.
| bool detach | ( | const FunctionPointerWithContext< ContextType > & | toDetach | ) |
Detach a function pointer from a callchain.
| [in] | toDetach | FunctionPointerWithContext instance to detach from this callchain. |
Definition at line 154 of file CallChainOfFunctionPointersWithContext.h.
| bool hasCallbacksAttached | ( | void | ) | const |
Check whether the callchain contains any callbacks.
Definition at line 203 of file CallChainOfFunctionPointersWithContext.h.
|
protectedinherited |
Nonimplemented call, use to disallow conversion between unrelated types.
|
inherited |
Bool operator implementation, derived class must provide a bool toBool() const function.
Definition at line 117 of file SafeBool.h.
| void operator() | ( | ContextType | context | ) | const |
Call sequentially each member of the chain.
| [in] | context | Parameter to pass to the functions called. |
Definition at line 258 of file CallChainOfFunctionPointersWithContext.h.
| bool toBool | ( | ) | const |
Test if the callchain is empty or not.
Definition at line 283 of file CallChainOfFunctionPointersWithContext.h.
|
protectedinherited |
Special member function that indicates a true value.
Definition at line 58 of file SafeBool.h.