A trigger that emits events in regular intervals. More...
#include <xronos/sdk/periodic_timer.hh>
Public Member Functions | |
PeriodicTimer (std::string_view name, ReactorContext context, Duration period, Duration offset=Duration::zero()) | |
Construct a new PeriodicTimer object. | |
auto | period () const noexcept -> const Duration & |
The delay in between two events emitted by the timer. | |
auto | offset () const noexcept -> const Duration & |
The delay between Reactor::startup and the first event emitted by the timer. | |
![]() | |
auto | name () const noexcept -> const std::string & |
The name of the current element. | |
auto | fqn () const noexcept -> const std::string & |
The fully qualified name of the current element. | |
![]() | |
virtual | ~EventSource ()=default |
Correct deletion of an instance of a derived class is permitted. | |
virtual | ~EventSource ()=default |
Correct deletion of an instance of a derived class is permitted. | |
A trigger that emits events in regular intervals.
xronos::sdk::PeriodicTimer::PeriodicTimer | ( | std::string_view | name, |
ReactorContext | context, | ||
Duration | period, | ||
Duration | offset = Duration::zero() ) |
Construct a new PeriodicTimer
object.
name | The name of the timer event. |
context | The current reactor's initialization context, which can be obtained using the Reactor::context method. |
period | The delay in between two events emitted by the timer. See Timer::period for details. |
offset | The delay between Reactor::startup and the first event emitted by the timer. |
|
nodiscardnoexcept |
The delay in between two events emitted by the timer.
If period
is 0 (the default), then the timer will trigger only once with a delay of offset
after Reactor::startup
triggers. If offset
is also set to 0, the timer triggers simultaneously to Reactor::startup
.
|
nodiscardnoexcept |
The delay between Reactor::startup
and the first event emitted by the timer.
Reactor::startup
and the first event emitted by the timer.