#include <senf/Scheduler/TimerEventProxy.hh>
The TimerEventProxy is meant to host long term deadline timers to reduce the load of the Scheduler with a huge count of TimerEvent items. It registers deadline timer callbacks which will be called when the timer expires.
The functionality is based on one TimerEvent instance per TimerEventProxy instance and could host a big count of timers.
Definition at line 52 of file TimerEventProxy.hh.
Public Types |
|
typedef boost::function< void(ClockService::clock_type, IdType const &)> |
Callback |
Public Member Functions |
|
TimerEventProxy (std::string const &description="") | |
Instantiate a TimerEventProxy. |
|
void | add (ClockService::clock_type timeout, IdType const &id, Callback cb) |
Add new deadline timer. |
|
bool | remove (IdType const &id) |
Remove timer by given id. |
|
std::vector< std::pair < ClockService::clock_type, IdType > > |
list () const |
Returns a vector of all active timers with timeout and id. |
|
ClockService::clock_type | timeout (IdType const &id) const |
Returns timeout for given id. |
|
unsigned | numEvents () const |
Returns the number of pending timer events. |
|
void | clear () |
Clears all pending timer events. |
typedef boost::function<void(ClockService::clock_type, IdType const &)> senf::scheduler::TimerEventProxy< IdType >:: | ||||
Callback | ||||
Definition at line 55 of file TimerEventProxy.hh.
senf::scheduler::TimerEventProxy< IdType >:: | ||||
TimerEventProxy | ( | std::string const & |
description = ""
|
) |
Instantiate a TimerEventProxy.
[in] | description | Descriptive name (purely informational) |
Definition at line 34 of file TimerEventProxy.ct.
void senf::scheduler::TimerEventProxy< IdType >:: | ||||
add | ( | ClockService::clock_type | timeout, | |
IdType const & | id, | |||
Callback | cb | ) | ||
Add new deadline timer.
Definition at line 59 of file TimerEventProxy.ct.
void senf::scheduler::TimerEventProxy< IdType >:: | ||||
clear | () | |||
Clears all pending timer events.
Definition at line 116 of file TimerEventProxy.ct.
std::vector< std::pair< senf::ClockService::clock_type, IdType > > senf::scheduler::TimerEventProxy< IdType >:: | ||||
list | () | |||
Returns a vector of all active timers with timeout and id.
Definition at line 96 of file TimerEventProxy.ct.
unsigned senf::scheduler::TimerEventProxy< IdType >:: | ||||
numEvents | () | |||
Returns the number of pending timer events.
Definition at line 109 of file TimerEventProxy.ct.
bool senf::scheduler::TimerEventProxy< IdType >:: | ||||
remove | ( | IdType const & | id | ) |
Remove timer by given id.
Definition at line 76 of file TimerEventProxy.ct.
senf::ClockService::clock_type senf::scheduler::TimerEventProxy< IdType >:: | ||||
timeout | ( | IdType const & | id | ) |
Returns timeout for given id.
if no timer for this id is registered 0 is returned.
Definition at line 87 of file TimerEventProxy.ct.