klee
|
#include <Timer.h>
Public Member Functions | |
Timer (const time::Span &interval, std::function< void()> &&callback) | |
time::Span | getInterval () const |
Return specified interval between invocations. More... | |
void | invoke (const time::Point ¤tTime) |
Execute callback if invocation time exceeded. More... | |
void | reset (const time::Point ¤tTime) |
Set new invocation time to currentTime + interval . More... | |
Private Attributes | |
time::Span | interval |
Approximate interval between callback invocations. More... | |
time::Point | nextInvocationTime |
Wall time for next invocation. More... | |
std::function< void()> | run |
The event callback. More... | |
A Timer repeatedly executes a callback
after a specified interval
. An object of this class is passive and only keeps track of the next invocation time. Passive means, that it has to be invoke
d by an external caller with the current time. Only when the time span between the current time and the last invocation exceeds the specified interval
, the callback
will be executed. Multiple timers are typically managed by a TimerGroup.
Timer::Timer | ( | const time::Span & | interval, |
std::function< void()> && | callback | ||
) |
time::Span Timer::getInterval | ( | ) | const |
Return specified interval
between invocations.
Definition at line 32 of file Timer.cpp.
References interval.
Referenced by klee::TimerGroup::add().
void Timer::invoke | ( | const time::Point & | currentTime | ) |
Execute callback
if invocation time exceeded.
Definition at line 36 of file Timer.cpp.
References interval, nextInvocationTime, and run.
Referenced by klee::TimerGroup::invoke().
void Timer::reset | ( | const time::Point & | currentTime | ) |
Set new invocation time to currentTime + interval
.
Definition at line 43 of file Timer.cpp.
References interval, and nextInvocationTime.
Referenced by klee::TimerGroup::reset().
|
private |
Approximate interval between callback invocations.
Definition at line 45 of file Timer.h.
Referenced by getInterval(), invoke(), and reset().
|
private |
|
private |