27 #ifndef PDCOM5_VARIABLE_H 28 #define PDCOM5_VARIABLE_H 33 #include "SizeTypeInfo.h" 35 #include "pdcom5_export.h" 50 class VariablePollResult;
68 friend class impl::Variable;
70 explicit Variable(std::weak_ptr<const impl::Variable> pimpl) :
71 pimpl_(std::move(pimpl))
78 std::chrono::nanoseconds>;
101 template <
typename T>
102 typename std::enable_if<!std::is_arithmetic<T>::value,
SetValueFuture>::type
108 typename std::add_lvalue_reference<
109 const typename T::value_type>::type>::value,
110 "Index operator does not return a lvalue reference of an " 114 "Container must be contiguous");
118 data.size(), selector);
132 template <
typename T>
133 typename std::enable_if<std::is_arithmetic<T>::value, SetValueFuture>::type
152 template <
typename T,
size_t M,
size_t N>
174 SetValueFuture setValue(
176 TypeInfo::DataType src_type,
178 const Selector &selector = {
nullptr})
const;
195 TypeInfo::DataType src_type,
197 size_t offset)
const;
203 TypeInfo getTypeInfo()
const;
208 SizeInfo getSizeInfo()
const;
213 std::string getPath()
const;
218 std::string getName()
const;
223 std::string getAlias()
const;
228 int getTaskId()
const;
232 bool isWriteable()
const;
235 std::chrono::duration<double> getSampleTime()
const;
244 bool empty() const noexcept {
return (pimpl_.expired()); }
267 PollFuture poll()
const;
270 std::weak_ptr<const impl::Variable> pimpl_;
282 std::vector<char> data_;
292 const void *getData()
const noexcept {
return data_.data(); }
293 void *getData() noexcept {
return data_.data(); }
294 Variable getVariable()
const noexcept {
return variable_; }
299 #endif // PDCOM5_VARIABLE_H
Definition: Exception.h:34
Selector base class for creating views on multidimensional data.
Definition: Selector.h:47
SizeInfo getSizeInfo() const
Get details about the variable shape.
Callback management handle.
Definition: Future.h:50
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:103
SetValueFuture setValue(const T(&data)[M][N], const Selector &selector={nullptr}) const
Write to a variable.
Definition: Variable.h:154
bool empty() const noexcept
Checks whether this instance is empty.
Definition: Variable.h:244
TypeInfo getTypeInfo() const
Get details about the variable type.
Definition: details.h:186
size_t element_size
Size of one element in bytes.
Definition: SizeTypeInfo.h:56
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:134
PdCom Variable interface.
Definition: Variable.h:66
Result of Variable::poll()
Definition: Variable.h:279
Data Deserialisation helper.
Definition: DataDeserializer.h:50
library version string as "major.minor.patch"
Definition: ClientStatistics.h:31