Kea  2.1.7-git
isc::asiolink::IntervalTimerImpl Class Reference

This class holds a call back function of asynchronous operations. More...

+ Inheritance diagram for isc::asiolink::IntervalTimerImpl:

Public Member Functions

 IntervalTimerImpl (IOService &io_service)
 Constructor. More...
 ~IntervalTimerImpl ()
 Destructor. More...
void callback (const boost::system::error_code &error)
 Callback function which calls the registerd callback. More...
void cancel ()
 Cancel timer. More...
long getInterval () const
 Get the timer interval. More...
void setup (const IntervalTimer::Callback &cbfunc, const long interval, const IntervalTimer::Mode &interval_mode=IntervalTimer::REPEATING)
 Setup function to register callback and start timer. More...

Detailed Description

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:

Definition at line 35 of file

Constructor & Destructor Documentation

◆ IntervalTimerImpl()

isc::asiolink::IntervalTimerImpl::IntervalTimerImpl ( IOService io_service)


io_serviceThe IO service used to handle events.

Definition at line 103 of file

◆ ~IntervalTimerImpl()

isc::asiolink::IntervalTimerImpl::~IntervalTimerImpl ( )


Definition at line 108 of file

Member Function Documentation

◆ callback()

void isc::asiolink::IntervalTimerImpl::callback ( const boost::system::error_code &  error)

Callback function which calls the registerd callback.

errorThe error code retrieved from the timer.

Definition at line 155 of file

References isc_throw, and isc::asiolink::IntervalTimer::REPEATING.

Referenced by setup().

◆ cancel()

void isc::asiolink::IntervalTimerImpl::cancel ( )

Cancel timer.

Definition at line 63 of file

◆ getInterval()

long isc::asiolink::IntervalTimerImpl::getInterval ( ) const

Get the timer interval.

The timer interval.

Definition at line 72 of file

References mode_.

◆ setup()

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.

cbfuncThe callback function registered on timer.
intervalThe interval used to start the timer.
interval_modeThe interval mode used by the timer.

Definition at line 113 of file

References callback(), isc_throw, and isc::Exception::what().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: