EMANE  1.2.1
EMANE::Utils::Timer Class Reference

A timer class that uses Linux interval timers. More...

#include <timer.h>

Classes

class  TimerException
 

Public Types

using TimerId = std::size_t
 

Public Member Functions

 Timer ()
 
 ~Timer ()
 
bool cancel (TimerId timerId)
 
template<typename Function >
TimerId schedule (Function fn, const TimePoint &absoluteTimePoint)
 
template<typename Function >
TimerId scheduleInterval (Function fn, const TimePoint &absoluteTimePoint, const Duration &interval)
 
template<typename Function >
EMANE::Utils::Timer::TimerId schedule (Function fn, const TimePoint &absoluteTimePoint)
 
template<typename Function >
EMANE::Utils::Timer::TimerId scheduleInterval (Function fn, const TimePoint &absoluteTimePoint, const Duration &interval)
 

Detailed Description

A timer class that uses Linux interval timers.

Definition at line 54 of file timer.h.

Member Typedef Documentation

◆ TimerId

using EMANE::Utils::Timer::TimerId = std::size_t

Definition at line 57 of file timer.h.

Constructor & Destructor Documentation

◆ Timer()

EMANE::Utils::Timer::Timer ( )

Creates an timer

Exceptions
TimerExceptionwhen an internal exception occurs.

Definition at line 39 of file timer.cc.

◆ ~Timer()

EMANE::Utils::Timer::~Timer ( )

Destroys an timer

Definition at line 55 of file timer.cc.

Member Function Documentation

◆ cancel()

bool EMANE::Utils::Timer::cancel ( TimerId  timerId)

Cancels a timer

Parameters
timerIdId of timer to cancel
Returns
bool flag true - canceled, false - not canceled
Note
Canceling an expired timer has not effect.

Definition at line 75 of file timer.cc.

◆ schedule() [1/2]

template<typename Function >
EMANE::Utils::Timer::TimerId EMANE::Utils::Timer::schedule ( Function  fn,
const TimePoint absoluteTimePoint 
)

Definition at line 34 of file timer.inl.

◆ schedule() [2/2]

template<typename Function >
TimerId EMANE::Utils::Timer::schedule ( Function  fn,
const TimePoint absoluteTimePoint 
)

Sechules a one shot timer

Parameters
fnA callable object that takes a single TimerId parameter
absoluteTimePointAbsolute time of the timeout

◆ scheduleInterval() [1/2]

template<typename Function >
EMANE::Utils::Timer::TimerId EMANE::Utils::Timer::scheduleInterval ( Function  fn,
const TimePoint absoluteTimePoint,
const Duration interval 
)

Definition at line 41 of file timer.inl.

◆ scheduleInterval() [2/2]

template<typename Function >
TimerId EMANE::Utils::Timer::scheduleInterval ( Function  fn,
const TimePoint absoluteTimePoint,
const Duration interval 
)

Sechules an interval timer

Parameters
fnA callable object that takes a single TimerId parameter
absoluteTimePointAbsolute time of the timeout
intervalRepeat interval

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