EMANE  1.0.1
EMANE::TimerServiceProvider Class Referenceabstract

Timer service interface the allows for scheduling timers that are placed on the NEMQueuedLayer functor queue for processing. More...

#include <timerserviceprovider.h>

Inheritance diagram for EMANE::TimerServiceProvider:
EMANE::NEMTimerServiceProxy EMANE::TimerServiceProxy

Public Types

using TimerCallback = std::function< void(const TimePoint &, const TimePoint &, const TimePoint &)>
 

Public Member Functions

virtual ~TimerServiceProvider ()
 
virtual bool cancelTimedEvent (TimerEventId eventId)=0
 
virtual TimerEventId scheduleTimedEvent (const TimePoint &timePoint, const void *arg=nullptr, const Duration &interval=Duration::zero())=0
 
template<typename Function >
TimerEventId schedule (Function fn, const TimePoint &timePoint, const Duration &interval=Duration::zero())
 
template<typename Function >
EMANE::TimerEventId schedule (Function fn, const TimePoint &timePoint, const Duration &interval)
 

Protected Member Functions

virtual TimerEventId schedule_i (TimerCallback callback, const TimePoint &timePoint, const Duration &interval)=0
 
 TimerServiceProvider ()
 

Detailed Description

Timer service interface the allows for scheduling timers that are placed on the NEMQueuedLayer functor queue for processing.

Definition at line 53 of file timerserviceprovider.h.

Member Typedef Documentation

◆ TimerCallback

using EMANE::TimerServiceProvider::TimerCallback = std::function<void(const TimePoint &, const TimePoint &, const TimePoint &)>

Definition at line 100 of file timerserviceprovider.h.

Constructor & Destructor Documentation

◆ ~TimerServiceProvider()

virtual EMANE::TimerServiceProvider::~TimerServiceProvider ( )
inlinevirtual

Definition at line 56 of file timerserviceprovider.h.

◆ TimerServiceProvider()

EMANE::TimerServiceProvider::TimerServiceProvider ( )
inlineprotected

Definition at line 107 of file timerserviceprovider.h.

Member Function Documentation

◆ cancelTimedEvent()

virtual bool EMANE::TimerServiceProvider::cancelTimedEvent ( TimerEventId  eventId)
pure virtual

Cancels a timed event

Parameters
eventIdevent id
Note
It is not an error to cancel an event that has already occured.

Implemented in EMANE::TimerServiceProxy, and EMANE::NEMTimerServiceProxy.

◆ schedule() [1/2]

template<typename Function >
EMANE::TimerEventId EMANE::TimerServiceProvider::schedule ( Function  fn,
const TimePoint timePoint,
const Duration interval 
)

Definition at line 34 of file timerserviceprovider.inl.

◆ schedule() [2/2]

template<typename Function >
TimerEventId EMANE::TimerServiceProvider::schedule ( Function  fn,
const TimePoint timePoint,
const Duration interval = Duration::zero() 
)

Schedules an generic interval timer callable

Parameters
fnA callable object
absoluteTimePointAbsolute time of the timeout
intervalRepeat interval

◆ schedule_i()

virtual TimerEventId EMANE::TimerServiceProvider::schedule_i ( TimerCallback  callback,
const TimePoint timePoint,
const Duration interval 
)
protectedpure virtual

◆ scheduleTimedEvent()

virtual TimerEventId EMANE::TimerServiceProvider::scheduleTimedEvent ( const TimePoint timePoint,
const void *  arg = nullptr,
const Duration interval = Duration::zero() 
)
pure virtual

Schedules a timed event

Parameters
timePointSchedule absolute time for timer to go off
argOpaque data pointer
intervalTimer reschedule interval. Default is one shot.
Returns
timer id

Implemented in EMANE::TimerServiceProxy, and EMANE::NEMTimerServiceProxy.


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