8 #include <boost/function.hpp>
9 #include <boost/system/error_code.hpp>
14 #include <boost/asio.hpp>
21 virtual void timer_callback() = 0;
29 typedef boost::function<void()> Handler;
30 typedef boost::function<void(
CallbackInfo *info)> HandlerCBI;
33 SimpleTimer(
const std::size_t& tid = 10,
const std::size_t& interval = 500, Handler _handler = NULL)
34 : _tid(tid), _interval(interval), _tickCount(0)
46 const std::size_t& tid = 10,
47 const std::size_t& interval = 500,
48 Handler _handler = NULL)
49 : _strand(io_service),
63 void SetInterval(
long i);
64 void SetHandler(Handler handler);
67 void SetHandler(HandlerCBI hcb,
void * c);
80 void Print (
const boost::system::error_code& error);
81 void HandleTimerEvent(
const boost::system::error_code &error);
84 HandlerCBI _handlerCallbackInfo;
91 std::size_t _interval;
92 std::size_t _tickCount;
97 boost::asio::strand _strand;
99 boost::asio::deadline_timer _timer;
Used for callbacks, in particular for the SimpleTimer class.
Definition: CallbackInfo.h:10
Definition: SimpleTimer.h:27
void SetCaller(TimerCallback *caller)
tell caller to call its callback method - seems simplest
Definition: SimpleTimer.h:70
Definition: SimpleTimer.h:20