xentara-cpp-control v1.0.1
The Xentara C++ Control Framework
Loading...
Searching...
No Matches
xentara::TimerInfo Class Referencefinal

A class that provides timing information of the control task. More...

#include <xentara/TimerInfo.hpp>

Public Member Functions

 TimerInfo ()=default
 Default Constructor.
 
 TimerInfo (std::chrono::system_clock::duration period, std::chrono::system_clock::duration offset=std::chrono::system_clock::duration::zero())
 Constructor.
 
 operator bool () const noexcept
 Checks if the control is attached to timer.
 
auto hasTimer () const -> bool
 Checks if the current control task uses a timer.
 
auto period () const -> std::chrono::system_clock::duration
 Gets the period for the timer if the control task is using one.
 
auto offset () const -> std::chrono::system_clock::duration
 Gets the offset time for the control tasks timer.
 

Detailed Description

A class that provides timing information of the control task.

This object is returned by InitContext::timerInfo() if the task is attached to a single timer, or by InitContext::attachedTimerInfos() for multiple timers to which the task is attached. You can also create a custom Timer information object to meet your specific requirements.

Constructor & Destructor Documentation

◆ TimerInfo() [1/2]

xentara::TimerInfo::TimerInfo ( )
default

Default Constructor.

This constructor can be used to create your own timer information object.

◆ TimerInfo() [2/2]

xentara::TimerInfo::TimerInfo ( std::chrono::system_clock::duration  period,
std::chrono::system_clock::duration  offset = std::chrono::system_clock::duration::zero() 
)

Constructor.

Parameters
periodThe period of the timer
offsetThe offset of the timer

Member Function Documentation

◆ hasTimer()

auto xentara::TimerInfo::hasTimer ( ) const -> bool

Checks if the current control task uses a timer.

Returns
true, if the control task is scheduled based on a timer

◆ offset()

auto xentara::TimerInfo::offset ( ) const -> std::chrono::system_clock::duration

Gets the offset time for the control tasks timer.

Returns
The reference time used for the timer

◆ operator bool()

xentara::TimerInfo::operator bool ( ) const
explicitnoexcept

Checks if the control is attached to timer.

◆ period()

auto xentara::TimerInfo::period ( ) const -> std::chrono::system_clock::duration

Gets the period for the timer if the control task is using one.

Returns
The duration of the timer period