![]() |
VR-Forces 4.7 Class Documentation
|
This is a templated class which manages a list of callbacks. More...
Classes | |
| struct | DtCallbackInfoType |
Public Member Functions | |
| DtCallbackListT () | |
| Default constructor. | |
| DtCallbackConnection | addCallback (const Callback &callback, bool *addedFirst=0) |
| Adds a new callback to the list. | |
| void | removeCallback (const Callback &callback, bool *removedLast=0) |
| Removes the specified callback from the list if it exists. | |
| void | removeCallback (const boost::function< bool(const Callback &)> &removePredicate, bool *removedLast=0) |
| Removes the specified callback from the list if it exists. | |
| void | removeAll () |
| Removes all callbacks that have been registered. | |
| void | invokeCallbacks () |
| Invokes all the callbacks currently on the callback list. | |
| template<typename T1 > | |
| void | invokeCallbacks (const T1 &) |
| template<typename T1 , typename T2 > | |
| void | invokeCallbacks (const T1 &, const T2 &) |
| template<typename T1 , typename T2 , typename T3 > | |
| void | invokeCallbacks (const T1 &, const T2 &, const T3 &) |
Protected Member Functions | |
| bool | disconnect (const typename DtCallbackInfoType::WPtr &) |
Protected Attributes | |
| tbb::spin_mutex | myMutex |
| DtCallbackInfoType::List | myCallbackList |
| unsigned | myCallbackCount |
Private Member Functions | |
| DtCallbackListT (const DtCallbackListT &) | |
| DtCallbackListT & | operator= (const DtCallbackListT &) |
This is a templated class which manages a list of callbacks.
A class is instantiated from this template by specifying the the callback class. The callback class must have an operator() which calls the callback. The callback can take any number of arguments which will be passed to it from invokeCallbacks.
|
inline |
Default constructor.
|
private |
| DtCallbackConnection DtCallbackListT< Callback >::addCallback | ( | const Callback & | callback, |
| bool * | addedFirst = 0 |
||
| ) |
Adds a new callback to the list.
A duplicate entry is checked for first, and if found, this new function is not added.
| addedFirst | if supplied will be set to true if this was the first callback added. |
| void DtCallbackListT< Callback >::removeCallback | ( | const Callback & | callback, |
| bool * | removedLast = 0 |
||
| ) |
Removes the specified callback from the list if it exists.
Uses the equality operator of the supplied callback to test which callback to remove.
| removedLast | if supplied will be set to true if the removed callback was the last one in the list. |
| void DtCallbackListT< Callback >::removeCallback | ( | const boost::function< bool(const Callback &)> & | removePredicate, |
| bool * | removedLast = 0 |
||
| ) |
Removes the specified callback from the list if it exists.
| removePredicate | predicate to select which callback to remove. Use this if constructing a Callback object for equality testing is expensive. |
| removedLast | if supplied will be set to true if the removed callback was the last one in the list. |
| void DtCallbackListT< Callback >::removeAll | ( | ) |
Removes all callbacks that have been registered.
| void DtCallbackListT< Callback >::invokeCallbacks | ( | ) |
Invokes all the callbacks currently on the callback list.
| void DtCallbackListT< Callback >::invokeCallbacks | ( | const T1 & | ) |
| void DtCallbackListT< Callback >::invokeCallbacks | ( | const T1 & | , |
| const T2 & | |||
| ) |
| void DtCallbackListT< Callback >::invokeCallbacks | ( | const T1 & | , |
| const T2 & | , | ||
| const T3 & | |||
| ) |
|
protected |
|
private |
|
mutableprotected |
|
protected |
|
protected |