Torc  0.1
torclogiccontrol.h
Go to the documentation of this file.
1 #ifndef TORCLOGICCONTROL_H
2 #define TORCLOGICCONTROL_H
3 
4 // Torc
5 #include "torcmaths.h"
6 #include "torccontrol.h"
7 
9 {
10  Q_OBJECT
11  public:
12  enum Operation
13  {
15  Passthrough, // no op
21  Any,
22  All,
33  };
34 
36 
37  public:
38  TorcLogicControl(const QString &Type, const QVariantMap &Details);
39  ~TorcLogicControl() = default;
40 
41  bool Validate (void) override;
42  TorcControl::Type GetType (void) const override;
43  QStringList GetDescription (void) override;
44  bool IsPassthrough (void) override;
45 
46  private:
47  void CalculateOutput (void) override;
48 
49  private:
50  Q_DISABLE_COPY(TorcLogicControl)
51  TorcLogicControl::Operation m_operation;
52 
53  // Reference device for controls that require a 'comparison' value (or reset for running avg/max/min)
54  QString m_referenceDeviceId;
55  QObject *m_referenceDevice;
56  QObject *m_inputDevice; // for simplicity
57  // trigger device for updating running average. Reference device resets.
58  QString m_triggerDeviceId;
59  QObject *m_triggerDevice;
60  // 'running' devices
61  TorcAverage<double> m_average;
62  bool m_firstRunningValue;
63  double m_runningValue;
64 };
65 
66 #endif // TORCLOGICCONTROL_H
bool IsPassthrough(void) override
Only certain logic controls can be passthrough.
TorcLogicControl(const QString &Type, const QVariantMap &Details)
Compute a running average.
Definition: torcmaths.h:11
~TorcLogicControl()=default
bool Validate(void) override
static TorcLogicControl::Operation StringToOperation(const QString &Operation)
QStringList GetDescription(void) override
TorcControl::Type GetType(void) const override