EMANE  1.2.1
EMANE::TimerService Class Reference

Platform timer service. More...

#include <timerservice.h>

Inheritance diagram for EMANE::TimerService:
EMANE::Utils::Singleton< TimerService >

Public Member Functions

bool cancelTimedEvent (TimerEventId eventId)
 cancel a timed event More...
 
TimerEventId scheduleTimedEvent (const TimePoint &timePoint, const void *arg, const Duration &interval, TimerServiceUser *pTimerServiceUser)
 schedule a timed event. More...
 
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)
 

Static Public Member Functions

static TimerServiceinstance ()
 
static void destroy ()
 

Protected Member Functions

 TimerService ()=default
 

Detailed Description

Platform timer service.

Realization of the TimerService interface.

Definition at line 53 of file timerservice.h.

Constructor & Destructor Documentation

◆ TimerService()

EMANE::TimerService::TimerService ( )
protecteddefault

Member Function Documentation

◆ cancelTimedEvent()

bool EMANE::TimerService::cancelTimedEvent ( TimerEventId  eventId)

cancel a timed event

Parameters
eventIdevent id to cancel

Definition at line 38 of file timerservice.cc.

◆ destroy()

static void EMANE::Utils::Singleton< TimerService >::destroy ( )
inlinestaticinherited

Destroys the single instance of type T. Once destroyed it cannot be used or recreated. This is not a thread-safe method.

Definition at line 67 of file singleton.h.

◆ instance()

static TimerService * EMANE::Utils::Singleton< TimerService >::instance ( )
inlinestaticinherited

Provides thread-safe access to a single instance of type T. It does not provide thread-safety for T methods.

Returns
A pointer to T

Definition at line 56 of file singleton.h.

◆ schedule() [1/2]

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

Definition at line 34 of file timerservice.inl.

◆ schedule() [2/2]

template<typename Function >
TimerEventId EMANE::TimerService::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

◆ scheduleTimedEvent()

EMANE::TimerEventId EMANE::TimerService::scheduleTimedEvent ( const TimePoint timePoint,
const void *  arg,
const Duration interval,
TimerServiceUser pTimerServiceUser 
)

schedule a timed event.

Parameters
timePointSchedule absolute time for timer to go off
argOpaque data pointer
intervalTimer reschedule interval. Default is one shot.
pTimerServiceUserPointer to the TimerServiceUser
Returns
identifier corresponding to the event id, or -1 on failure

Definition at line 44 of file timerservice.cc.


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