|
PdCom
5.0
Process data communication client
|
PdCom Variable interface. More...
#include <Variable.h>
Public Member Functions | |
| Variable ()=default | |
| Constructs an empty variable. | |
| template<typename T > | |
| std::enable_if<!std::is_arithmetic< T >::value, bool >::type | setValue (T const &data, size_t index=0) const |
| Write to a variable. More... | |
| template<typename T > | |
| std::enable_if< std::is_arithmetic< T >::value, bool >::type | setValue (T const &data, size_t index=0) const |
| Write to a variable. More... | |
| bool | setValue (const void *src, TypeInfo::DataType src_type, size_t idx, size_t n) const |
| Write to a variable. More... | |
| const TypeInfo & | getTypeInfo () const noexcept |
| Get details about the variable type. More... | |
| const SizeInfo & | getSizeInfo () const noexcept |
| Get details about the variable shape. More... | |
| std::string | getPath () const |
| The Path of the variable. More... | |
| std::string | getName () const |
| The name of the variable. More... | |
| std::string | getAlias () const |
| The alias of the variable, if set. More... | |
| int | getTaskId () const |
| The task id of the variable. More... | |
| bool | empty () const noexcept |
| Checks whether this instance is empty. More... | |
Friends | |
| class | impl::Variable |
This class represents a variable (signal or parameter). It contains information about the datatype and the shape of a variable.
If you default-construct a Variable instance, it does not contain any information. Calling any other member function than empty() is forbidden. To get a valid variable instance, call Process::find().
|
inlinenoexcept |
Checks whether this instance is empty.
Default-constructed variables are empty per default, calling any other member function than empty() will crash.
| std::string PdCom::Variable::getAlias | ( | ) | const |
The alias of the variable, if set.
The variable must not be empty!
| std::string PdCom::Variable::getName | ( | ) | const |
The name of the variable.
The variable must not be empty!
| std::string PdCom::Variable::getPath | ( | ) | const |
The Path of the variable.
The variable must not be empty!
|
noexcept |
| int PdCom::Variable::getTaskId | ( | ) | const |
The task id of the variable.
The variable must not be empty!
|
noexcept |
|
inline |
Write to a variable.
This function is also asynchronous, so the server might still use the old value when this function returns. This overload is for any container of arithmetic types (e.g. std::vector<int>). The variable must not be empty!
T must be a container (must have a size() method and a value_type typedef).
| data | Data. |
| index | Optional offset. No bounds checking! |
|
inline |
Write to a variable.
This function is also asynchronous, so the server might still use the old value when this function returns. This overload is for any arithmetic type (int, double, etc.). The variable must not be empty!
| data | Data. |
| index | Optional offset. No bounds checking! |
| bool PdCom::Variable::setValue | ( | const void * | src, |
| TypeInfo::DataType | src_type, | ||
| size_t | idx, | ||
| size_t | n | ||
| ) | const |
Write to a variable.
This function is also asynchronous, so the server might still use the old value when this function returns. The variable must not be empty!
| src | Pointer to one or more values. |
| src_type | Type of the source. |
| idx | Optional offset. No bounds checking! |
| n | Number of values. |
1.8.14