CurveDataSequencer.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (C) 2015 by Ralf Kaestner *
3  * ralf.kaestner@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the Lesser GNU General Public License as published by*
7  * the Free Software Foundation; either version 3 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * Lesser GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the Lesser GNU General Public License *
16  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17  ******************************************************************************/
18 
19 #ifndef RQT_MULTIPLOT_CURVE_DATA_SEQUENCER_H
20 #define RQT_MULTIPLOT_CURVE_DATA_SEQUENCER_H
21 
22 #include <QLinkedList>
23 #include <QMap>
24 #include <QObject>
25 #include <QPointF>
26 #include <QVector>
27 
28 #include <ros/time.h>
29 
32 
33 namespace rqt_multiplot {
35  public QObject {
36  Q_OBJECT
37  public:
38  CurveDataSequencer(QObject* parent = 0);
39  virtual ~CurveDataSequencer();
40 
42  CurveConfig* getConfig() const;
43  void setBroker(MessageBroker* broker);
44  MessageBroker* getBroker() const;
45  bool isSubscribed() const;
46 
47  void subscribe();
48  void unsubscribe();
49 
50  signals:
51  void subscribed();
52  void pointReceived(const QPointF& point);
53  void unsubscribed();
54 
55  private:
56  class TimeValue {
57  public:
58  inline TimeValue(const ros::Time& time = ros::Time(),
59  double value = 0.0) :
60  time_(time),
61  value_(value) {
62  };
63 
64  inline TimeValue(const TimeValue& src) :
65  time_(src.time_),
66  value_(src.value_) {
67  };
68 
69  inline bool operator==(const TimeValue& timeValue) const {
70  return (time_ == timeValue.time_);
71  };
72 
73  inline bool operator>(const TimeValue& timeValue) const {
74  return (time_ > timeValue.time_);
75  };
76 
77  inline bool operator<(const TimeValue& timeValue) const {
78  return (time_ < timeValue.time_);
79  };
80 
82  double value_;
83  };
84 
85  typedef QLinkedList<TimeValue> TimeValueList;
86 
88 
90 
91  QMap<CurveConfig::Axis, QString> subscribedTopics_;
92  QMap<CurveConfig::Axis, QString> timeFields_;
93  QMap<CurveConfig::Axis, TimeValueList> timeValues_;
94 
95  void processMessage(const Message& message);
96  void processMessage(CurveConfig::Axis axis, const Message& message);
97  void interpolate();
98 
99  private slots:
101  void configSubscriberQueueSizeChanged(size_t queueSize);
102 
103  void subscriberMessageReceived(const QString& topic, const
104  Message& message);
105  void subscriberXAxisMessageReceived(const QString& topic, const
106  Message& message);
107  void subscriberYAxisMessageReceived(const QString& topic, const
108  Message& message);
109  };
110 };
111 
112 #endif
TimeValue(const ros::Time &time=ros::Time(), double value=0.0)
void pointReceived(const QPointF &point)
MessageBroker * getBroker() const
void configSubscriberQueueSizeChanged(size_t queueSize)
void subscriberMessageReceived(const QString &topic, const Message &message)
config
QMap< CurveConfig::Axis, QString > timeFields_
void subscriberXAxisMessageReceived(const QString &topic, const Message &message)
void subscriberYAxisMessageReceived(const QString &topic, const Message &message)
bool operator<(const TimeValue &timeValue) const
void setConfig(CurveConfig *config)
bool operator>(const TimeValue &timeValue) const
void processMessage(const Message &message)
QMap< CurveConfig::Axis, QString > subscribedTopics_
bool operator==(const TimeValue &timeValue) const
QMap< CurveConfig::Axis, TimeValueList > timeValues_
void setBroker(MessageBroker *broker)
QLinkedList< TimeValue > TimeValueList


rqt_multiplot
Author(s): Ralf Kaestner
autogenerated on Wed Jul 10 2019 03:49:44