QtPdCom  1.3.3
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
QtPdCom::ScalarSubscriber Class Referenceabstract

Subscriber of a single scalar value. More...

#include <ScalarSubscriber.h>

Inheritance diagram for QtPdCom::ScalarSubscriber:
Inheritance graph
[legend]

Classes

class  Impl
 

Public Member Functions

 ScalarSubscriber ()
 Constructor. More...
 
virtual ~ScalarSubscriber ()
 Destructor. More...
 
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. More...
 
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. More...
 
void clearVariable ()
 Unsubscribe from a Variable. More...
 
bool hasVariable () const
 Subscription active. More...
 
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. More...
 
double getFilterConstant () const
 
PdCom::Variable getVariable () const
 
const void * getData () const
 

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.

◆ ~ScalarSubscriber()

ScalarSubscriber::~ScalarSubscriber ( )
virtual

Destructor.

References clearVariable().

◆ ScalarSubscriber() [2/2]

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

Member Function Documentation

◆ clearVariable()

void ScalarSubscriber::clearVariable ( )

Unsubscribe from a Variable.

References impl, and stateChange().

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

◆ getData()

const void * ScalarSubscriber::getData ( ) const

References impl.

◆ getFilterConstant()

double ScalarSubscriber::getFilterConstant ( ) const

References impl.

◆ 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

◆ setVariable() [1/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().

◆ setVariable() [2/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().

◆ stateChange()

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

◆ writeValue()

template<class T >
void QtPdCom::ScalarSubscriber::writeValue ( 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.

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

Referenced by setVariable(), and writeValue().

◆ scale

double QtPdCom::ScalarSubscriber::scale
protected

Referenced by setVariable(), and writeValue().


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