RTXI  3.0.0
The Real-Time eXperiment Interface Reference Manual
Public Member Functions
Widgets::Component Class Reference

#include <widgets.hpp>

Inheritance diagram for Widgets::Component:
Inheritance graph
Collaboration diagram for Widgets::Component:
Collaboration graph

Public Member Functions

 Component (Widgets::Plugin *hplugin, const std::string &mod_name, const std::vector< IO::channel_t > &channels, const std::vector< Widgets::Variable::Info > &variables)
 
template<typename T >
getValue (const size_t &var_id)
 
template<typename T >
void setValue (const size_t &var_id, T value)
 
std::string getDescription (const size_t &var_id)
 
std::string getValueString (const size_t &var_id)
 
RT::State::state_t getState () const
 
void setState (RT::State::state_t state)
 
std::vector< Widgets::Variable::InfogetParametersInfo ()
 
Widgets::PlugingetHostPlugin ()
 
- Public Member Functions inherited from RT::Thread
 Thread (std::string n, const std::vector< IO::channel_t > &c)
 
 Thread (const Thread &connector)=default
 
Threadoperator= (const Thread &connector)=default
 
 Thread (Thread &&)=delete
 
Threadoperator= (Thread &&)=delete
 
 ~Thread () override=default
 
virtual void execute ()=0
 
- Public Member Functions inherited from IO::Block
 Block (std::string blockname, const std::vector< channel_t > &channels, bool isdependent)
 
 Block (const Block &block)=default
 
Blockoperator= (const Block &block)=default
 
 Block (Block &&)=delete
 
Blockoperator= (Block &&)=delete
 
virtual ~Block ()=default
 
std::string getName () const
 
size_t getCount (flags_t type) const
 
std::string getChannelName (IO::flags_t type, size_t index) const
 
std::string getChannelDescription (IO::flags_t type, size_t index) const
 
void writeinput (size_t index, const double &data)
 
const double & readPort (IO::flags_t direction, size_t index)
 
bool dependent () const
 
bool getActive () const
 
void setActive (bool act)
 
void assignID (size_t block_id)
 
size_t getID () const
 

Additional Inherited Members

- Protected Member Functions inherited from IO::Block
double & readinput (size_t index)
 
void writeoutput (size_t index, const double &data)
 

Detailed Description

Class responsible for running real-time code.

This is where the magic happens. This class contains the low level logic to interface with the real-time loop, as well as low level facilities for parameter and input/output update. Inherit this class to run a periodic real-time function. It inherits the RT::Thread interface and therefore is considered dependent on inputs from other blocks. It will autoamtically be scheduled to run after dependency Components from other plugins.

Definition at line 183 of file widgets.hpp.

Constructor & Destructor Documentation

◆ Component()

Widgets::Component::Component(Widgets::Pluginhplugin,
const std::string & mod_name,
const std::vector< IO::channel_t > & channels,
const std::vector< Widgets::Variable::Info > & variables 
)

Definition at line 98 of file widgets.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ getDescription()

std::string Widgets::Component::getDescription(const size_t & var_id)

This function returns the developer description of the parameter

Parameters
var_idthe variable id
Returns
the variable description

Definition at line 120 of file widgets.cpp.

◆ getHostPlugin()

Widgets::Plugin* Widgets::Component::getHostPlugin()
inline

Get the plugin object that owns this component

Parameters
Pointerto Widgets::Plugin object that owns this component.

Definition at line 267 of file widgets.hpp.

◆ getParametersInfo()

std::vector<Widgets::Variable::Info> Widgets::Component::getParametersInfo()
inline

Get a list of all parameters for this widget

Returns
A vector of Widgets::Variable::Info structs representing widget parameters
See also
Widgets::Variable::Info

Definition at line 257 of file widgets.hpp.

◆ getState()

RT::State::state_t Widgets::Component::getState()const
inline

Obtain Widget realtime state information

Returns
RT::State::state_t representing Widgets::Component state
See also
RT::State::state_t

Definition at line 242 of file widgets.hpp.

◆ getValue()

template<typename T >
T Widgets::Component::getValue(const size_t & var_id)
inline

Retrieves value from the component. Typically this function is only called by the real time loop and should not be called from the gui thread.

Parameters
var_idThe parameter identification number
Returns
the value stored

Definition at line 200 of file widgets.hpp.

◆ getValueString()

std::string Widgets::Component::getValueString(const size_t & var_id)

This function automatically converts the value stored as a human readable string

Parameters
var_idthe variable id
Returns
a string representation of the value stored

Definition at line 125 of file widgets.cpp.

◆ setState()

void Widgets::Component::setState(RT::State::state_t state)
inline

set realtime state

Parameters
statean RT::State::state_t enum representing new state

Definition at line 249 of file widgets.hpp.

◆ setValue()

template<typename T >
void Widgets::Component::setValue(const size_t & var_id,
value 
)
inline

Changes a parameter value

Parameters
var_idThe parameter identification number
valuethe value to store

Definition at line 212 of file widgets.hpp.


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