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 using namespace PJ;
8 
9 class MonitoredValue : public QObject
10 {
11  Q_OBJECT
12 public:
13  MonitoredValue(QObject* parent = nullptr) : QObject(parent), _value(0)
14  {
15  }
16 
17  void set(double newValue)
18  {
19  double prev = _value;
20  _value = newValue;
21  if (fabs(newValue - prev) > std::numeric_limits<double>::epsilon())
22  {
23  emit valueChanged(_value);
24  }
25  }
26 
27  double get() const
28  {
29  return _value;
30  }
31 signals:
32  void valueChanged(double);
33 
34 private:
35  double _value;
36 };
37 
38 
39 std::pair<std::vector<QString>,bool> MoveData(PlotDataMapRef& source, PlotDataMapRef& destination);
40 
41 
42 #endif // UTILS_H
std::pair< std::vector< QString >, bool > MoveData(PlotDataMapRef &source, PlotDataMapRef &destination)
Definition: utils.cpp:55
MonitoredValue(QObject *parent=nullptr)
Definition: utils.h:13
double _value
Definition: utils.h:35


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 04:02:48