27 #ifndef PDCOM5_VARIABLE_H 28 #define PDCOM5_VARIABLE_H 33 #include "SizeTypeInfo.h" 40 #include <pdcom5_export.h> 51 class VariablePollResult;
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>
175 SetValueFuture setValue(
177 TypeInfo::DataType src_type,
179 const Selector &selector = {
nullptr})
const;
196 TypeInfo::DataType src_type,
198 size_t offset)
const;
204 TypeInfo getTypeInfo()
const;
209 SizeInfo getSizeInfo()
const;
214 std::string getPath()
const;
219 std::string getName()
const;
224 std::string getAlias()
const;
229 int getTaskId()
const;
233 bool isWriteable()
const;
236 std::chrono::duration<double> getSampleTime()
const;
245 bool empty() const noexcept {
return (pimpl_.expired()); }
268 PollFuture poll()
const;
276 std::weak_ptr<const impl::Variable> pimpl_;
288 std::vector<char> data_;
298 const void *getData()
const noexcept {
return data_.data(); }
299 void *getData() noexcept {
return data_.data(); }
300 Variable getVariable()
const noexcept {
return variable_; }
305 #endif // PDCOM5_VARIABLE_H
Definition: Exception.h:33
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:49
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
SetValueFuture setValue(const T(&data)[M][N], const Selector &selector={nullptr}) const
Write to a variable.
Definition: Variable.h:155
bool empty() const noexcept
Checks whether this instance is empty.
Definition: Variable.h:245
TypeInfo getTypeInfo() const
Get details about the variable type.
Definition: details.h:183
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:135
PdCom Variable interface.
Definition: Variable.h:67
Base class for PdCom protocol handler.
Definition: Process.h:86
Result of Variable::poll()
Definition: Variable.h:285
Data Deserialisation helper.
Definition: DataDeserializer.h:50
Definition: ClientStatistics.h:31