xronos-sdk 0.15.0
Xronos C++ SDK
Loading...
Searching...
No Matches
xronos::sdk::BaseReaction::ProgrammableTimerEffect< T > Class Template Reference

A reaction's effect on a ProgrammableTimer. More...

#include <xronos/sdk/reaction.hh>

Inheritance diagram for xronos::sdk::BaseReaction::ProgrammableTimerEffect< T >:
[legend]

Public Member Functions

 ProgrammableTimerEffect (ProgrammableTimer< T > &timer, const ReactionContext &context)
 Constructor.
template<class U>
requires (!std::is_same_v<U, void> && std::is_same_v<T, U>)
void schedule (const U &value, Duration delay=Duration::zero())
 Schedule a future event.
void schedule (const Value< T > &value, Duration delay=Duration::zero())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void schedule (const ValueView< T > &view, Duration delay=Duration::zero())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void schedule (Duration delay=Duration::zero())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class U>
requires (!std::is_same_v<U, void> && std::is_same_v<T, U>)
void schedule (U &&value, Duration delay=Duration::zero())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Detailed Description

template<class T>
class xronos::sdk::BaseReaction::ProgrammableTimerEffect< T >

A reaction's effect on a ProgrammableTimer.

Through it the handler schedules events.

Template Parameters
TThe value type associated with the programmable timer.

Constructor & Destructor Documentation

◆ ProgrammableTimerEffect()

template<class T>
xronos::sdk::BaseReaction::ProgrammableTimerEffect< T >::ProgrammableTimerEffect ( ProgrammableTimer< T > & timer,
const ReactionContext & context )

Constructor.

Parameters
timerThe ProgrammableTimer for which the reaction should have write access.
contextThe context of the reaction the effect is declared for. Can be obtained using context().

Member Function Documentation

◆ schedule() [1/5]

template<class T>
template<class U>
requires (!std::is_same_v<U, void> && std::is_same_v<T, U>)
void xronos::sdk::BaseReaction::ProgrammableTimerEffect< T >::schedule ( const U & value,
Duration delay = Duration::zero() )

Schedule a future event.

The timer emits the event at the current time plus delay.

Parameters
valueThe value to be associated with the future event occurrence. Copy constructs the value from the given lvalue reference.
delayThe delay from the current time to the event's timestamp.
Exceptions
ValidationErrorIf called before execution has started.

◆ schedule() [2/5]

template<class T>
void xronos::sdk::BaseReaction::ProgrammableTimerEffect< T >::schedule ( const Value< T > & value,
Duration delay = Duration::zero() )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Schedules the given value without copying it. The value must not be empty (asserted in debug builds); nothing is scheduled otherwise.

◆ schedule() [3/5]

template<class T>
void xronos::sdk::BaseReaction::ProgrammableTimerEffect< T >::schedule ( const ValueView< T > & view,
Duration delay = Duration::zero() )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Schedules the viewed value without copying it. The view must not be absent (asserted in debug builds); nothing is scheduled otherwise.

◆ schedule() [4/5]

template<class T>
void xronos::sdk::BaseReaction::ProgrammableTimerEffect< T >::schedule ( Duration delay = Duration::zero())

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Schedule an event without an associated value. This is only available if T is void.

◆ schedule() [5/5]

template<class T>
template<class U>
requires (!std::is_same_v<U, void> && std::is_same_v<T, U>)
void xronos::sdk::BaseReaction::ProgrammableTimerEffect< T >::schedule ( U && value,
Duration delay = Duration::zero() )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Move constructs the value using the given rvalue reference.


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