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

An run context with execution information and is required for the read and write for Input and Output respectively. More...

#include <xentara/RunContext.hpp>

Public Member Functions

 RunContext ()=delete
 No default construction.
 
auto scheduledTimestamp () const -> std::chrono::system_clock::time_point
 Gets the time the pipeline was scheduled for.
 
auto currentStage () const -> Stage
 Gets the current stage of Xentara.
 
auto counter () const -> std::int64_t
 Gets the execution counter of the trigger.
 
auto xentaraSkillElement () const &noexcept -> const skill::Element &
 Gets the Xentara skill element.
 
 RunContext (const RunContext &)=delete
 Delete the copy constructor.
 
auto operator= (const RunContext &) -> RunContext &=delete
 Delete the assignment operator.
 
Error Handling
auto error () const -> std::error_code
 Gets the error that occurred during read or write operations.
 
auto setError (std::error_code error) -> void
 Sets the error code with the provided value.
 
auto resetError () -> void
 Resets the error code.
 

Detailed Description

An run context with execution information and is required for the read and write for Input and Output respectively.

An object of this class is passed to the callbacks of Control::step(), Control::enterPreOp(), Control::enterOperational(), Control::enterPostOp() and Control::final(). It provides information about the current execution, like the scheduled time, current stage and execution counter of the pipeline. This object is also passed to the Input::read() and Output::write() functions and provides errors information occurring during read and write operations. You never create objects of this class yourself. If you want to handle errors yourself, you can use the cleanRunContext() function to get your own RunContext for managing.

Constructor & Destructor Documentation

◆ RunContext() [1/2]

xentara::RunContext::RunContext ( )
delete

No default construction.

◆ RunContext() [2/2]

xentara::RunContext::RunContext ( const RunContext )
delete

Delete the copy constructor.

Member Function Documentation

◆ counter()

auto xentara::RunContext::counter ( ) const -> std::int64_t

Gets the execution counter of the trigger.

Returns
The number of times the trigger has been executed. On the first execution, 0 is returned.

◆ currentStage()

auto xentara::RunContext::currentStage ( ) const -> Stage

Gets the current stage of Xentara.

Returns
Stage from Stage enum

◆ error()

auto xentara::RunContext::error ( ) const -> std::error_code

Gets the error that occurred during read or write operations.

Returns
The corresponding error code

◆ operator=()

auto xentara::RunContext::operator= ( const RunContext ) -> RunContext &=delete
delete

Delete the assignment operator.

◆ resetError()

auto xentara::RunContext::resetError ( ) -> void

Resets the error code.

◆ scheduledTimestamp()

auto xentara::RunContext::scheduledTimestamp ( ) const -> std::chrono::system_clock::time_point

Gets the time the pipeline was scheduled for.

Returns
The time the pipeline was scheduled for. This is not the actual time at the time the function is called, but the time that the pipeline was initially intended to run. For timers, this is the time that the timer was scheduled to run, and for events, the time that the event occurred.

◆ setError()

auto xentara::RunContext::setError ( std::error_code  error) -> void

Sets the error code with the provided value.

Note
passing std::error_code() will reset the error code.

◆ xentaraSkillElement()

auto xentara::RunContext::xentaraSkillElement ( ) const & -> const skill::Element &
noexcept

Gets the Xentara skill element.

This function gives access to the control skill element in the Xentara.

Returns
A reference to the skill element