QtPdCom  1.5.2
QtPdCom::ScalarVariable< T > Class Template Reference

Scalar Value Template. More...

#include <ScalarVariable.h>

Inheritance diagram for QtPdCom::ScalarVariable< T >:
Collaboration diagram for QtPdCom::ScalarVariable< T >:

Public Member Functions

 ScalarVariable (QObject *parent=nullptr)
 Constructor.
virtual ~ScalarVariable ()
 Destructor.
void clearData ()
bool hasData () const
getValue () const
std::chrono::nanoseconds getMTime () const
void inc ()
 Increments the current value and writes it to the process.
Public Member Functions inherited from QtPdCom::AbstractScalarVariable
template<typename T>
std::enable_if< std::is_arithmetic< T >::value, void >::type copyData (T &dest) const
Public Member Functions inherited from QtPdCom::ScalarSubscriber
 ScalarSubscriber ()
 Constructor.
virtual ~ScalarSubscriber ()
 Destructor.
void setVariable (PdCom::Variable pv, const PdCom::Selector &selector={}, const Transmission &=event_mode, double scale=1.0, double offset=0.0, double tau=0.0)
 Subscribe to a process variable via variable.
void setVariable (PdCom::Process *process, const QString &path, const PdCom::Selector &selector={}, const Transmission &=event_mode, double scale=1.0, double offset=0.0, double tau=0.0)
 Subscribe to a process variable via process and path.
void clearVariable ()
 Unsubscribe from a Variable.
bool hasVariable () const
 Subscription active.
virtual void stateChange (PdCom::Subscription::State)
template<class T>
void writeValue (T)
 Write a value to the process.
double getFilterConstant () const
PdCom::Variable getVariable () const
const void * getData () const
Q_INVOKABLE bool poll ()
 Poll an active subscription.

Private Member Functions

void newValues (std::chrono::nanoseconds) override
 This virtual method is called if the process variable's value changed.

Private Attributes

value
 Current value.
std::chrono::nanoseconds mTime
 Modification Time of Current value.
bool dataPresent
 There is a process value to display.

Additional Inherited Members

Signals inherited from QtPdCom::AbstractScalarVariable
void valueChanged ()
 Emitted, when the value changes, or the variable is disconnected.
Protected Member Functions inherited from QtPdCom::ScalarSubscriber
const PdCom::Selector & getSelector () const
Protected Attributes inherited from QtPdCom::ScalarSubscriber
double scale
double offset

Detailed Description

template<class T>
class QtPdCom::ScalarVariable< T >

Scalar Value Template.

Constructor & Destructor Documentation

◆ ScalarVariable()

template<class T>
QtPdCom::ScalarVariable< T >::ScalarVariable ( QObject * parent = nullptr)

Constructor.

References dataPresent, and value.

◆ ~ScalarVariable()

template<class T>
QtPdCom::ScalarVariable< T >::~ScalarVariable ( )
virtual

Destructor.

Member Function Documentation

◆ clearData()

template<class T>
void QtPdCom::ScalarVariable< T >::clearData ( )

◆ getMTime()

template<class T>
std::chrono::nanoseconds QtPdCom::ScalarVariable< T >::getMTime ( ) const
inline
Returns
The current Modification Time.

References mTime.

◆ getValue()

template<class T>
T QtPdCom::ScalarVariable< T >::getValue ( ) const
inline
Returns
The current value.

References value.

Referenced by QtPdCom::MessageModel::Impl::stateChanged().

◆ hasData()

template<class T>
bool QtPdCom::ScalarVariable< T >::hasData ( ) const
inline
Returns
true, if data are present.

References dataPresent.

Referenced by QtPdCom::MessageModel::Impl::stateChanged().

◆ inc()

template<class T>
void QtPdCom::ScalarVariable< T >::inc ( )

Increments the current value and writes it to the process.

This does not update value directly.

References value, and QtPdCom::ScalarSubscriber::writeValue().

◆ newValues()

template<class T>
void QtPdCom::ScalarVariable< T >::newValues ( std::chrono::nanoseconds ts)
overrideprivatevirtual

Member Data Documentation

◆ dataPresent

template<class T>
bool QtPdCom::ScalarVariable< T >::dataPresent
private

There is a process value to display.

Referenced by clearData(), hasData(), newValues(), and ScalarVariable().

◆ mTime

template<class T>
std::chrono::nanoseconds QtPdCom::ScalarVariable< T >::mTime
private

Modification Time of Current value.

Referenced by getMTime(), and newValues().

◆ value

template<class T>
T QtPdCom::ScalarVariable< T >::value
private

Current value.

Referenced by clearData(), getValue(), inc(), newValues(), and ScalarVariable().


The documentation for this class was generated from the following file: