QtPdCom  1.5.2
QtPdCom::ScalarSubscriber Class Referenceabstract

Subscriber of a single scalar value. More...

#include <ScalarSubscriber.h>

Inheritance diagram for QtPdCom::ScalarSubscriber:

Classes

class  Impl

Public Member Functions

 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 newValues (std::chrono::nanoseconds)=0
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.

Protected Member Functions

const PdCom::Selector & getSelector () const

Protected Attributes

double scale
double offset

Private Member Functions

 ScalarSubscriber (const ScalarSubscriber &)

Private Attributes

struct Q_DECL_HIDDEN Impl
std::unique_ptr< Implimpl

Detailed Description

Subscriber of a single scalar value.

Constructor & Destructor Documentation

◆ ScalarSubscriber() [1/2]

ScalarSubscriber::ScalarSubscriber ( )

Constructor.

References impl, offset, and scale.

Referenced by QtPdCom::ScalarSubscriber::Impl::Impl(), and ScalarSubscriber().

◆ ~ScalarSubscriber()

ScalarSubscriber::~ScalarSubscriber ( )
virtual

Destructor.

References clearVariable().

◆ ScalarSubscriber() [2/2]

QtPdCom::ScalarSubscriber::ScalarSubscriber ( const ScalarSubscriber & )
private

References ScalarSubscriber().

Member Function Documentation

◆ clearVariable()

void ScalarSubscriber::clearVariable ( )

Unsubscribe from a Variable.

References impl, and stateChange().

Referenced by setVariable(), setVariable(), and ~ScalarSubscriber().

◆ getData()

const void * ScalarSubscriber::getData ( ) const

◆ getFilterConstant()

double ScalarSubscriber::getFilterConstant ( ) const

References impl.

Referenced by newValues().

◆ getSelector()

const PdCom::Selector & ScalarSubscriber::getSelector ( ) const
protected

References impl.

Referenced by writeValue().

◆ getVariable()

PdCom::Variable ScalarSubscriber::getVariable ( ) const

◆ hasVariable()

bool ScalarSubscriber::hasVariable ( ) const

Subscription active.

References impl.

Referenced by writeValue().

◆ newValues()

virtual void QtPdCom::ScalarSubscriber::newValues ( std::chrono::nanoseconds )
pure virtual

◆ poll()

bool QtPdCom::ScalarSubscriber::poll ( )

Poll an active subscription.

Returns
false if variable could not be polled.

References impl.

Referenced by newValues(), and QtPdCom::ScalarSubscriber::Impl::ScalarSubscription::stateChanged().

◆ setVariable() [1/2]

void ScalarSubscriber::setVariable ( PdCom::Process * process,
const QString & path,
const PdCom::Selector & selector = {},
const Transmission & transmission = event_mode,
double scale = 1.0,
double offset = 0.0,
double tau = 0.0 )

Subscribe to a process variable via process and path.

Subscribes to a ProcessVariable.

Parameters
processProcess.
pathVariable path.
selectorSelector.
transmissionTransmission details.
scaleScale factor.
offsetOffset (applied after scaling).
tauPT1 filter time constant. A value less or equal to 0.0 means, that no filter is applied.

References clearVariable(), QtPdCom::Transmission::getInterval(), impl, QtPdCom::Transmission::isContinuous(), QtPdCom::Transmission::isPoll(), offset, scale, and QtPdCom::Transmission::toString().

◆ setVariable() [2/2]

void ScalarSubscriber::setVariable ( PdCom::Variable pv,
const PdCom::Selector & selector = {},
const Transmission & transmission = event_mode,
double scale = 1.0,
double offset = 0.0,
double tau = 0.0 )

Subscribe to a process variable via variable.

Subscribes to a ProcessVariable.

Parameters
pvProcess variable.
selectorSelector.
transmissionTransmission details.
scaleScale factor.
offsetOffset (applied after scaling).
tauPT1 filter time constant. A value less or equal to 0.0 means, that no filter is applied.

References clearVariable(), QtPdCom::Transmission::getInterval(), impl, QtPdCom::Transmission::isContinuous(), QtPdCom::Transmission::isPoll(), offset, scale, and QtPdCom::Transmission::toString().

Referenced by QtPdCom::PdConnection::setVariable().

◆ stateChange()

void ScalarSubscriber::stateChange ( PdCom::Subscription::State )
virtual

Referenced by clearVariable(), and newValues().

◆ writeValue()

template<class T>
void QtPdCom::ScalarSubscriber::writeValue ( T value)

Write a value to the process.

This is a convenience function, that checks for the subscription, before writing the value.

References getSelector(), getVariable(), hasVariable(), offset, and scale.

Referenced by QtPdCom::ScalarVariable< T >::inc(), and newValues().

Member Data Documentation

◆ Impl

struct Q_DECL_HIDDEN QtPdCom::ScalarSubscriber::Impl
private

◆ impl

std::unique_ptr<Impl> QtPdCom::ScalarSubscriber::impl
private

◆ offset

double QtPdCom::ScalarSubscriber::offset
protected

◆ scale

double QtPdCom::ScalarSubscriber::scale
protected

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