![]() |
Kea 2.7.3
|
This class holds a call back function of asynchronous operations. More...
Public Member Functions | |
IntervalTimerImpl (const IOServicePtr &io_service) | |
Constructor. | |
~IntervalTimerImpl () | |
Destructor. | |
void | callback (const boost::system::error_code &error) |
Callback function which calls the registerd callback. | |
void | cancel () |
Cancel timer. | |
long | getInterval () const |
Get the timer interval. | |
void | setup (const IntervalTimer::Callback &cbfunc, const long interval, const IntervalTimer::Mode &interval_mode=IntervalTimer::REPEATING) |
Setup function to register callback and start timer. | |
This class holds a call back function of asynchronous operations.
To ensure the object is alive while an asynchronous operation refers to it, we use shared_ptr and enable_shared_from_this. The object will be destructed in case IntervalTimer has been destructed and no asynchronous operation refers to it. Please follow the link to get an example: http://think-async.com/asio/asio-1.4.8/doc/asio/tutorial/tutdaytime3.html#asio.tutorial.tutdaytime3.the_tcp_connection_class
Definition at line 35 of file interval_timer.cc.
isc::asiolink::IntervalTimerImpl::IntervalTimerImpl | ( | const IOServicePtr & | io_service | ) |
Constructor.
io_service | The IO service used to handle events. |
Definition at line 106 of file interval_timer.cc.
isc::asiolink::IntervalTimerImpl::~IntervalTimerImpl | ( | ) |
Destructor.
Definition at line 111 of file interval_timer.cc.
void isc::asiolink::IntervalTimerImpl::callback | ( | const boost::system::error_code & | error | ) |
Callback function which calls the registerd callback.
error | The error code retrieved from the timer. |
Definition at line 158 of file interval_timer.cc.
References isc_throw, and isc::asiolink::IntervalTimer::REPEATING.
|
inline |
Cancel timer.
Definition at line 62 of file interval_timer.cc.
|
inline |
void isc::asiolink::IntervalTimerImpl::setup | ( | const IntervalTimer::Callback & | cbfunc, |
const long | interval, | ||
const IntervalTimer::Mode & | interval_mode = IntervalTimer::REPEATING ) |
Setup function to register callback and start timer.
cbfunc | The callback function registered on timer. |
interval | The interval used to start the timer. |
interval_mode | The interval mode used by the timer. |
Definition at line 116 of file interval_timer.cc.
References isc_throw.