senf::scheduler::TimerEventProxy< IdType > Class Template Reference

Deadline timer proxy. More...

#include <senf/Scheduler/TimerEventProxy.hh>

List of all members.


Detailed Description

template<typename IdType>
class senf::scheduler::TimerEventProxy< IdType >

Deadline timer proxy.

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.

Member Typedef Documentation

template<typename IdType >
typedef boost::function<void(ClockService::clock_type, IdType const &)> senf::scheduler::TimerEventProxy< IdType >::
Callback

Definition at line 55 of file TimerEventProxy.hh.


Constructor & Destructor Documentation

template<typename IdType >
senf::scheduler::TimerEventProxy< IdType >::
TimerEventProxy ( std::string const &  description = "" )

Instantiate a TimerEventProxy.

Parameters:
[in]  description  Descriptive name (purely informational)

Definition at line 34 of file TimerEventProxy.ct.


Member Function Documentation

template<typename IdType >
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.

template<typename IdType >
void senf::scheduler::TimerEventProxy< IdType >::
clear ()

Clears all pending timer events.

Definition at line 116 of file TimerEventProxy.ct.

template<typename IdType >
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.

template<typename IdType >
unsigned senf::scheduler::TimerEventProxy< IdType >::
numEvents ()

Returns the number of pending timer events.

Definition at line 109 of file TimerEventProxy.ct.

template<typename IdType >
bool senf::scheduler::TimerEventProxy< IdType >::
remove ( IdType const &  id )

Remove timer by given id.

Definition at line 76 of file TimerEventProxy.ct.

template<typename IdType >
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.


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