utils.h
Go to the documentation of this file.
1 /*
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5  */
6 
7 #ifndef UTILS_H
8 #define UTILS_H
9 
10 #include <QObject>
11 #include "PlotJuggler/plotdata.h"
12 
13 using namespace PJ;
14 
15 class MonitoredValue : public QObject
16 {
17  Q_OBJECT
18 public:
19  MonitoredValue(QObject* parent = nullptr) : QObject(parent), _value(0)
20  {
21  }
22 
23  void set(double newValue)
24  {
25  double prev = _value;
26  _value = newValue;
27  if (fabs(newValue - prev) > std::numeric_limits<double>::epsilon())
28  {
29  emit valueChanged(_value);
30  }
31  }
32 
33  double get() const
34  {
35  return _value;
36  }
37 signals:
38  void valueChanged(double);
39 
40 private:
41  double _value;
42 };
43 
45 {
46  std::vector<std::string> added_curves;
47  bool curves_updated = false;
48  bool data_pushed = false;
49 };
50 
52  bool remove_older);
53 
54 #endif // UTILS_H
MoveDataRet
Definition: utils.h:44
MonitoredValue::MonitoredValue
MonitoredValue(QObject *parent=nullptr)
Definition: utils.h:19
MoveDataRet::added_curves
std::vector< std::string > added_curves
Definition: utils.h:46
MoveData
MoveDataRet MoveData(PlotDataMapRef &source, PlotDataMapRef &destination, bool remove_older)
Definition: utils.cpp:10
MonitoredValue
Definition: utils.h:15
MonitoredValue::set
void set(double newValue)
Definition: utils.h:23
MonitoredValue::_value
double _value
Definition: utils.h:41
source
const char * source
Definition: lz4.h:767
plotdata.h
PJ
Definition: dataloader_base.h:16
PJ::PlotDataMapRef
Definition: plotdata.h:34
MonitoredValue::get
double get() const
Definition: utils.h:33


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:48