27#ifndef PDCOM5_VARIABLE_H
28#define PDCOM5_VARIABLE_H
33#include "SizeTypeInfo.h"
40#include <pdcom5_export.h>
67class PDCOM5_PUBLIC Variable
69 friend class impl::Variable;
71 explicit Variable(std::weak_ptr<const impl::Variable> pimpl) :
72 pimpl_(std::move(pimpl))
79 std::chrono::nanoseconds>;
102 template <
typename T>
103 typename std::enable_if<!std::is_arithmetic<T>::value, SetValueFuture>::type
109 typename std::add_lvalue_reference<
110 const typename T::value_type>::type>::value,
111 "Index operator does not return a lvalue reference of an "
115 "Container must be contiguous");
119 data.size(), selector);
133 template <
typename T>
134 typename std::enable_if<std::is_arithmetic<T>::value, SetValueFuture>::type
153 template <
typename T,
size_t M,
size_t N>
177 TypeInfo::DataType src_type,
179 const Selector &selector = {
nullptr})
const;
196 TypeInfo::DataType src_type,
198 size_t offset)
const;
245 bool empty() const noexcept {
return (pimpl_.expired()); }
276 std::weak_ptr<const impl::Variable> pimpl_;
285class PDCOM5_PUBLIC VariablePollResult :
288 std::vector<char> data_;
292 explicit VariablePollResult(
Variable var) :
298 const void *getData()
const noexcept {
return data_.data(); }
299 void *getData()
noexcept {
return data_.data(); }
300 Variable getVariable()
const noexcept {
return variable_; }
Callback management handle.
Definition Future.h:50
Base class for PdCom protocol handler.
Definition Process.h:87
Size of a Variable.
Definition SizeTypeInfo.h:67
Result of Variable::poll()
Definition Variable.h:287
PdCom Variable interface.
Definition Variable.h:68
SetValueFuture setValue(const void *src, TypeInfo::DataType src_type, size_t count, const Selector &selector={nullptr}) const
Write to a variable.
PdCom::Variable::SetValueFuture setValue(const void *src, TypeInfo::DataType src_type, size_t count, size_t offset) const
Write to a variable.
std::string getPath() const
The Path of the variable.
Process * getProcess() const
Get the assigned Process.
Variable()=default
Constructs an empty variable.
std::chrono::duration< double > getSampleTime() const
PollFuture poll() const
Read a variable without subscription.
TypeInfo getTypeInfo() const
Get details about the variable type.
std::enable_if<!std::is_arithmetic< T >::value, SetValueFuture >::type setValue(T const &data, const Selector &selector={nullptr}) const
Write to a variable.
Definition Variable.h:104
std::string getName() const
The name of the variable.
SizeInfo getSizeInfo() const
Get details about the variable shape.
std::string getAlias() const
The alias of the variable, if set.
bool empty() const noexcept
Checks whether this instance is empty.
Definition Variable.h:245
int getTaskId() const
The task id of the variable.
SetValueFuture setValue(const T(&data)[M][N], const Selector &selector={nullptr}) const
Write to a variable.
Definition Variable.h:155
std::enable_if< std::is_arithmetic< T >::value, SetValueFuture >::type setValue(T const &data, const Selector &selector={nullptr}) const
Write to a variable.
Definition Variable.h:135
Data Deserialisation helper.
Definition DataDeserializer.h:51
Definition Exception.h:34
Selector base class for creating views on multidimensional data.
Definition Selector.h:48
Type of a Variable.
Definition SizeTypeInfo.h:34
size_t element_size
Size of one element in bytes.
Definition SizeTypeInfo.h:56