#include <thread_util.h>
Public Methods | |
CallBack (const CallBack &) | |
CallBack () | |
size_t | Add (CBFunct *callback_inst) |
Add a instance to callback list. More... | |
bool | Del (size_t ID) |
void | Run (const T &t) |
Run thru the callback list and call back. More... |
This class makes the use of C++ like callbacks easy. You can simply add or remove an instance to/from callback list. If you call the method Run(const T&) all callbacks get called. It is safe and usefull, to make a instance of this class to public member of the object, that uses callbacks.
T | The callback get a constant reference to this type as parameter. |
|
|
|
Add a instance to callback list. Since CBFunct is abstract, you have to inherit it from CBFunct and overload the CBFunct::operator()(const Arg &). You can call this function even within a callback of the same instance.
|
|
\biref Delete a instance from callback list. You can call this function even within a callback of the same instance.
|
|
Run thru the callback list and call back. Simply calls all callbacks in list, but can handle callbacks, that access the same instance (i.e. adding or deleting somthing from callback list)
|