MessageSubscriber.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_MESSAGE_SUBSCRIBER_H
20 #define RQT_MULTIPLOT_MESSAGE_SUBSCRIBER_H
21 
22 #include <QMap>
23 #include <QObject>
24 #include <QString>
25 #include <QMetaMethod>
26 
27 #include <ros/node_handle.h>
28 
29 #include <variant_topic_tools/Subscriber.h>
30 
31 #include <rqt_multiplot/Message.h>
32 
33 namespace rqt_multiplot {
35  public QObject {
36  Q_OBJECT
37  public:
38  enum Property {
40  };
41 
42  MessageSubscriber(QObject* parent = 0, const ros::NodeHandle&
43  nodeHandle = ros::NodeHandle("~"));
45 
46  const ros::NodeHandle& getNodeHandle() const;
47  void setTopic(const QString& topic);
48  const QString& getTopic() const;
49  void setQueueSize(size_t queueSize);
50  size_t getQueueSize() const;
51  size_t getNumPublishers() const;
52  bool isValid() const;
53 
54  bool event(QEvent* event);
55 
56  signals:
57  void subscribed(const QString& topic);
58  void messageReceived(const QString& topic, const Message& message);
59  void unsubscribed(const QString& topic);
60  void aboutToBeDestroyed();
61 
62  private:
64 
65  QString topic_;
66  size_t queueSize_;
67 
68  variant_topic_tools::Subscriber subscriber_;
69 
70  void subscribe();
71  void unsubscribe();
72 
73  void callback(const variant_topic_tools::MessageVariant& variant,
74  const ros::Time& receiptTime);
75 
76 #if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
77  void connectNotify(const QMetaMethod& signal);
78  void disconnectNotify(const QMetaMethod& signal);
79 #else
80  void connectNotify(const char* signal);
81  void disconnectNotify(const char* signal);
82 #endif
83  };
84 };
85 
86 #endif
void callback(const variant_topic_tools::MessageVariant &variant, const ros::Time &receiptTime)
void subscribed(const QString &topic)
MessageSubscriber(QObject *parent=0, const ros::NodeHandle &nodeHandle=ros::NodeHandle("~"))
variant_topic_tools::Subscriber subscriber_
void connectNotify(const QMetaMethod &signal)
void disconnectNotify(const QMetaMethod &signal)
void setTopic(const QString &topic)
void setQueueSize(size_t queueSize)
const QString & getTopic() const
const ros::NodeHandle & getNodeHandle() const
void messageReceived(const QString &topic, const Message &message)
void unsubscribed(const QString &topic)


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