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

An initialization context with configuration information and access to Xentara Elements. More...

#include <xentara/InitContext.hpp>

Public Member Functions

 InitContext ()=delete
 No default construction.
 
auto xentaraSkillElement () const &noexcept -> const skill::Element &
 Gets the Xentara skill element.
 
 InitContext (const InitContext &)=delete
 Delete the copy constructor.
 
auto operator= (const InitContext &) -> InitContext &=delete
 Delete the assignment operator.
 
Access to the environment
auto config () const -> const Config &
 Gets the configuration.
 
auto model () const -> const Model &
 Gets the model.
 
Timer info for controls that use a single timer
auto hasSingleTimer () const -> bool
 Checks if the control is using a single timer.
 
auto timerInfo () const -> TimerInfo
 Gets the timer information if the task is attached to only one timer.
 
Scheduling info for controls that may use multiple timers and events
auto hasAttachedEvent () const -> bool
 Checks if the control is using a event.
 
auto attachedTimerInfos () const -> std::vector< TimerInfo >
 Gets the information about all timers to which the task is attached.
 

Detailed Description

An initialization context with configuration information and access to Xentara Elements.

An object of this class is passed to Control::initialize(). It provides access to configuration parameters, the Xentara model, and timer-related information. You do not create objects of this class manually. You have to use the context to get the required information such as configuration parameter, timers and store it inside your control class as member variable.

Constructor & Destructor Documentation

◆ InitContext() [1/2]

xentara::InitContext::InitContext ( )
delete

No default construction.

◆ InitContext() [2/2]

xentara::InitContext::InitContext ( const InitContext )
delete

Delete the copy constructor.

Member Function Documentation

◆ attachedTimerInfos()

auto xentara::InitContext::attachedTimerInfos ( ) const -> std::vector< TimerInfo >

Gets the information about all timers to which the task is attached.

Returns
A vector of TimerInfo objects containing the schedule information for all attached timers.

◆ config()

auto xentara::InitContext::config ( ) const -> const Config &

Gets the configuration.

Returns
Returns an object that allows you to access the configuration parameters from the Xentara model file.

◆ hasAttachedEvent()

auto xentara::InitContext::hasAttachedEvent ( ) const -> bool

Checks if the control is using a event.

Returns
True if the control is attached to a event, otherwise false.

◆ hasSingleTimer()

auto xentara::InitContext::hasSingleTimer ( ) const -> bool

Checks if the control is using a single timer.

Returns
True if the control is attached to a single timer only, otherwise false.

◆ model()

auto xentara::InitContext::model ( ) const -> const Model &

Gets the model.

Returns
Returns an object that allows you to access the elements and datapoints from the Xentara.

◆ operator=()

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

Delete the assignment operator.

◆ timerInfo()

auto xentara::InitContext::timerInfo ( ) const -> TimerInfo

Gets the timer information if the task is attached to only one timer.

Returns
An object that gets you the timer schedule infomation.
Exceptions
std::runtime_errorthe task is not attached to any timer
std::runtime_errorthe task is not attached to a single timer

◆ xentaraSkillElement()

auto xentara::InitContext::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