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

Deadline timer proxy. More...

#include <senf/Scheduler/TimerEventProxy.hh>

Public Types

typedef boost::function< void(ClockService::clock_type const &, IdType const &)> Callback
 
typedef boost::function< void(IdType const &id, senf::ClockService::clock_type const &duration, StatisticsData const &durationsStats)> DurationExceededCallback
 

Public Member Functions

 TimerEventProxy (std::string const &description="", senf::ClockService::clock_type const &callbackDurationWarningThreshold=senf::ClockService::clock_type(0), DurationExceededCallback _decb=0)
 Instantiate a TimerEventProxy. More...
 
void add (ClockService::clock_type const &timeout, IdType const &id, Callback cb)
 Add new deadline timer. More...
 
bool remove (IdType const &id)
 Remove timer by given id. More...
 
std::vector< std::pair< ClockService::clock_type, IdType > > list () const
 Returns a vector of all active timers with timeout and id. More...
 
ClockService::clock_type timeout (IdType const &id) const
 Returns timeout for given id. More...
 
unsigned numEvents () const
 Returns the number of pending timer events. More...
 
void clear ()
 Clears all pending timer events. More...
 
StatisticsData callbackDurationStats ()
 Returns and clears the timeInCallback statistics. More...
 

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 42 of file TimerEventProxy.hh.

Member Typedef Documentation

◆ Callback

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

Definition at line 45 of file TimerEventProxy.hh.

◆ DurationExceededCallback

template<typename IdType >
typedef boost::function<void(IdType const & id, senf::ClockService::clock_type const & duration, StatisticsData const & durationsStats)> senf::scheduler::TimerEventProxy< IdType >::DurationExceededCallback

Definition at line 46 of file TimerEventProxy.hh.

Constructor & Destructor Documentation

◆ TimerEventProxy()

template<typename IdType >
senf::scheduler::TimerEventProxy< IdType >::TimerEventProxy ( std::string const &  description = "",
senf::ClockService::clock_type const &  callbackDurationWarningThreshold = senf::ClockService::clock_type(0),
DurationExceededCallback  _decb = 0 
)

Instantiate a TimerEventProxy.

Parameters
[in]descriptionDescriptive name (purely informational)
[in]If!=0, the max. time a callback may take for execuion before a warning is generated

Member Function Documentation

◆ add()

template<typename IdType >
void senf::scheduler::TimerEventProxy< IdType >::add ( ClockService::clock_type const &  timeout,
IdType const &  id,
Callback  cb 
)

Add new deadline timer.

◆ callbackDurationStats()

template<typename IdType >
StatisticsData senf::scheduler::TimerEventProxy< IdType >::callbackDurationStats ( )

Returns and clears the timeInCallback statistics.

◆ clear()

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

Clears all pending timer events.

◆ list()

template<typename IdType >
std::vector<std::pair<ClockService::clock_type, IdType> > senf::scheduler::TimerEventProxy< IdType >::list ( ) const

Returns a vector of all active timers with timeout and id.

◆ numEvents()

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

Returns the number of pending timer events.

◆ remove()

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

Remove timer by given id.

◆ timeout()

template<typename IdType >
ClockService::clock_type senf::scheduler::TimerEventProxy< IdType >::timeout ( IdType const &  id) const

Returns timeout for given id.

if no timer for this id is registered 0 is returned.


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