31 #ifndef __BASE_CALLBACK_HH__ 32 #define __BASE_CALLBACK_HH__ 63 template <
class T,
void (T::* F)()>
74 : object(o), autoDestroy(auto_destroy)
78 : object(&o), autoDestroy(auto_destroy)
100 std::string
name()
const {
return "CallbackQueue"; }
109 callbacks.push_back(callback);
112 template <
class T,
void (T::* F)()>
119 template <
class T,
void (T::* F)()>
129 bool empty()
const {
return callbacks.empty(); }
137 queue::iterator
i = callbacks.begin();
138 queue::iterator end = callbacks.end();
156 #endif // __BASE_CALLBACK_HH__
virtual void process()=0
virtual process function that is invoked when the callback queue is executed.
void process()
process all callbacks
void process()
virtual process function that is invoked when the callback queue is executed.
virtual void autoDestruct()
virtual ~Callback()
virtualize the destructor to make sure that the correct one gets called.
MakeCallback(T &o, bool auto_destroy=false)
void add(Callback *callback)
Add a callback to the end of the queue.
queue callbacks
List of all callbacks.
void clear()
clear the callback queue
bool empty() const
Find out if there are any callbacks in the queue.
Helper template class to turn a simple class member function into a callback.
std::list< Callback * > queue
Simple typedef for the data structure that stores all of the callbacks.
MakeCallback(T *o, bool auto_destroy=false)