22 #ifndef QTPDCOM_SCALARVARIABLE_H 23 #define QTPDCOM_SCALARVARIABLE_H 42 using QObject::QObject;
53 typename std::enable_if<std::is_arithmetic<T>::value,
void>::type
56 PdCom::details::copyData(
57 &dest, PdCom::details::TypeInfoTraits<T>::type_info.type,
59 getVariable().getTypeInfo().type, 1);
83 std::chrono::nanoseconds
getMTime()
const;
93 void newValues(std::chrono::nanoseconds)
override;
161 inline std::chrono::nanoseconds
176 writeValue(value + 1);
190 newValue = newValue * scale + offset;
191 mTime = std::chrono::nanoseconds(ts);
193 if (newValue != value || !dataPresent) {
Exception(const QString &msg)
Constructor.
Definition: ScalarVariable.h:47
Abstract Scalar Value.
Definition: ScalarVariable.h:36
T getValue() const
Definition: ScalarVariable.h:150
virtual ~ScalarVariable()
Destructor.
Definition: ScalarVariable.h:119
Definition: BroadcastModel.h:32
QString msg
Exception message.
Definition: ScalarVariable.h:49
void newValues(std::chrono::nanoseconds) override
This virtual method is called by the ProcessVariable, if its value changes.
Definition: ScalarVariable.h:185
std::chrono::nanoseconds mTime
Modification Time of Current value.
Definition: ScalarVariable.h:89
T value
Current value.
Definition: ScalarVariable.h:87
Subscriber of a single scalar value.
Definition: ScalarSubscriber.h:39
bool hasData() const
Definition: ScalarVariable.h:139
#define QTPDCOM_PUBLIC
Definition: Export.h:30
void inc()
Increments the current value and writes it to the process.
Definition: ScalarVariable.h:174
void clearData()
Definition: ScalarVariable.h:126
Scalar Value Template.
Definition: ScalarVariable.h:72
ScalarVariable< double > DoubleVariable
Definition: ScalarVariable.h:100
ScalarVariable< int > IntVariable
Definition: ScalarVariable.h:99
bool dataPresent
There is a process value to display.
Definition: ScalarVariable.h:90
ScalarVariable(QObject *parent=nullptr)
Constructor.
Definition: ScalarVariable.h:107
std::chrono::nanoseconds getMTime() const
Definition: ScalarVariable.h:162
Definition: ScalarVariable.h:44
ScalarVariable< bool > BoolVariable
Definition: ScalarVariable.h:98
std::enable_if< std::is_arithmetic< T >::value, void >::type copyData(T &dest) const
Definition: ScalarVariable.h:54