Kea  1.5.0
isc::dhcp::TimerMgrImpl Class Reference

Implementation of the TimerMgr. More...

Public Member Functions

 TimerMgrImpl ()
 Constructor. More...
 
void cancel (const std::string &timer_name)
 Cancels the execution of the interval timer. More...
 
bool isTimerRegistered (const std::string &timer_name)
 Checks if the timer with a specified name has been registered. More...
 
void registerTimer (const std::string &timer_name, const asiolink::IntervalTimer::Callback &callback, const long interval, const asiolink::IntervalTimer::Mode &scheduling_mode)
 Registers new timer in the TimerMgr. More...
 
void setIOService (const IOServicePtr &io_service)
 Sets IO service to be used by the Timer Manager. More...
 
void setup (const std::string &timer_name)
 Schedules the execution of the interval timer. More...
 
size_t timersCount () const
 Returns the number of registered timers. More...
 
void unregisterTimer (const std::string &timer_name)
 Unregisters specified timer. More...
 
void unregisterTimers ()
 Unregisters all timers. More...
 

Detailed Description

Implementation of the TimerMgr.

Definition at line 73 of file timer_mgr.cc.

Constructor & Destructor Documentation

◆ TimerMgrImpl()

isc::dhcp::TimerMgrImpl::TimerMgrImpl ( )

Constructor.

Definition at line 164 of file timer_mgr.cc.

Member Function Documentation

◆ cancel()

void isc::dhcp::TimerMgrImpl::cancel ( const std::string &  timer_name)

Cancels the execution of the interval timer.

Parameters
timer_nameUnique timer name.
Exceptions
BadValueif the timer hasn't been registered.

Definition at line 273 of file timer_mgr.cc.

References isc_throw.

Referenced by isc::dhcp::TimerMgr::cancel(), and unregisterTimer().

◆ isTimerRegistered()

bool isc::dhcp::TimerMgrImpl::isTimerRegistered ( const std::string &  timer_name)

Checks if the timer with a specified name has been registered.

Parameters
timer_nameName of the timer.
Returns
true if the timer with the specified name has been registered, false otherwise.

Definition at line 244 of file timer_mgr.cc.

Referenced by isc::dhcp::TimerMgr::isTimerRegistered().

◆ registerTimer()

void isc::dhcp::TimerMgrImpl::registerTimer ( const std::string &  timer_name,
const asiolink::IntervalTimer::Callback callback,
const long  interval,
const asiolink::IntervalTimer::Mode scheduling_mode 
)

Registers new timer in the TimerMgr.

Parameters
timer_nameUnique name for the timer.
callbackPointer to the callback function to be invoked when the timer elapses, e.g. function processing expired leases in the DHCP server.
intervalTimer interval in milliseconds.
scheduling_modeScheduling mode of the timer as described in asiolink::IntervalTimer::Mode.
Exceptions
BadValueif the timer name is invalid or duplicate.

Definition at line 177 of file timer_mgr.cc.

References isc_throw.

Referenced by isc::dhcp::TimerMgr::registerTimer().

◆ setIOService()

void isc::dhcp::TimerMgrImpl::setIOService ( const IOServicePtr io_service)

Sets IO service to be used by the Timer Manager.

Parameters
io_servicePointer to the new IO service.

Definition at line 169 of file timer_mgr.cc.

References isc_throw.

Referenced by isc::dhcp::TimerMgr::setIOService().

◆ setup()

void isc::dhcp::TimerMgrImpl::setup ( const std::string &  timer_name)

Schedules the execution of the interval timer.

This method schedules the timer, i.e. the callback will be executed after specified interval elapses. The interval has been specified during timer registration. Depending on the mode selected during the timer registration, the callback will be executed once after it has been scheduled or until it is cancelled. Though, in the former case the timer can be re-scheduled in the callback function.

Parameters
timer_nameUnique timer name.
Exceptions
BadValueif the timer hasn't been registered.

Definition at line 254 of file timer_mgr.cc.

References isc_throw.

Referenced by isc::dhcp::TimerMgr::setup().

◆ timersCount()

size_t isc::dhcp::TimerMgrImpl::timersCount ( ) const

Returns the number of registered timers.

Definition at line 249 of file timer_mgr.cc.

Referenced by isc::dhcp::TimerMgr::timersCount().

◆ unregisterTimer()

void isc::dhcp::TimerMgrImpl::unregisterTimer ( const std::string &  timer_name)

Unregisters specified timer.

This method cancels the timer if it is setup and removes the timer from the internal collection of timers.

Parameters
timer_nameName of the timer to be unregistered.
Exceptions
BadValueif the specified timer hasn't been registered.

Definition at line 205 of file timer_mgr.cc.

References cancel(), and isc_throw.

Referenced by isc::dhcp::TimerMgr::unregisterTimer(), and unregisterTimers().

+ Here is the call graph for this function:

◆ unregisterTimers()

void isc::dhcp::TimerMgrImpl::unregisterTimers ( )

Unregisters all timers.

This method must be explicitly called prior to termination of the process.

Definition at line 224 of file timer_mgr.cc.

References unregisterTimer().

Referenced by isc::dhcp::TimerMgr::unregisterTimers(), and isc::dhcp::TimerMgr::~TimerMgr().

+ Here is the call graph for this function:

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