QtPdCom
1.3.3
|
Subscriber of a single scalar value. More...
#include <ScalarSubscriber.h>
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< Impl > | impl |
Subscriber of a single scalar value.
ScalarSubscriber::ScalarSubscriber | ( | ) |
Constructor.
|
virtual |
Destructor.
References clearVariable().
|
private |
void ScalarSubscriber::clearVariable | ( | ) |
Unsubscribe from a Variable.
References impl, and stateChange().
Referenced by setVariable(), and ~ScalarSubscriber().
const void * ScalarSubscriber::getData | ( | ) | const |
References impl.
double ScalarSubscriber::getFilterConstant | ( | ) | const |
References impl.
|
protected |
References impl.
Referenced by writeValue().
PdCom::Variable ScalarSubscriber::getVariable | ( | ) | const |
References impl.
Referenced by QtPdCom::ScalarSubscriber::Impl::ScalarSubscription::stateChanged(), and writeValue().
bool ScalarSubscriber::hasVariable | ( | ) | const |
|
pure virtual |
Implemented in QtPdCom::ScalarVariable< T >, QtPdCom::ScalarVariable< double >, and QtPdCom::ScalarVariable< int >.
Referenced by QtPdCom::ScalarSubscriber::Impl::ScalarSubscription::newValues().
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.
pv | Process variable. |
selector | Selector. |
transmission | Transmission details. |
scale | Scale factor. |
offset | Offset (applied after scaling). |
tau | PT1 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().
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.
process | Process. |
path | Variable path. |
selector | Selector. |
transmission | Transmission details. |
scale | Scale factor. |
offset | Offset (applied after scaling). |
tau | PT1 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().
|
virtual |
Referenced by clearVariable(), and QtPdCom::ScalarSubscriber::Impl::ScalarSubscription::stateChanged().
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.
|
private |
|
private |
Referenced by clearVariable(), getData(), getFilterConstant(), getSelector(), getVariable(), hasVariable(), and setVariable().
|
protected |
Referenced by setVariable(), and writeValue().
|
protected |
Referenced by setVariable(), and writeValue().