utils.h
Go to the documentation of this file.
1 #ifndef UTILS_H
2 #define UTILS_H
3 
4 #include <QObject>
5 #include "PlotJuggler/plotdata.h"
6 
7 
8 
9 class MonitoredValue: public QObject{
10  Q_OBJECT
11 public:
12  MonitoredValue(QObject* parent = nullptr): QObject(parent), _value(0) {}
13 
14  void set(double newValue){
15  double prev = _value;
16  _value = newValue;
17  if( fabs( newValue - prev ) > std::numeric_limits<double>::epsilon() )
18  {
19  emit valueChanged(_value);
20  }
21  }
22 
23  double get() const { return _value; }
24 signals:
25  void valueChanged(double);
26 private:
27  double _value;
28 };
29 
30 #endif // UTILS_H
MonitoredValue(QObject *parent=nullptr)
Definition: utils.h:12
void valueChanged(double)
double _value
Definition: utils.h:27


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:18