BagReader.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_BAG_READER_H
20 #define RQT_MULTIPLOT_BAG_READER_H
21 
22 #include <QMap>
23 #include <QMutex>
24 #include <QString>
25 #include <QStringList>
26 #include <QThread>
27 
28 #include <rqt_multiplot/BagQuery.h>
30 
31 namespace rqt_multiplot {
32  class BagReader :
33  public MessageBroker {
34  Q_OBJECT
35  public:
36  BagReader(QObject* parent = 0);
37  virtual ~BagReader();
38 
39  QString getFileName() const;
40  QString getError() const;
41  bool isReading() const;
42 
43  void read(const QString& fileName);
44  void wait();
45 
46  bool subscribe(const QString& topic, QObject* receiver,
47  const char* method, const PropertyMap& properties = PropertyMap(),
48  Qt::ConnectionType type = Qt::AutoConnection);
49  bool unsubscribe(const QString& topic, QObject* receiver,
50  const char* method = 0);
51 
52  bool event(QEvent* event);
53 
54  signals:
55  void readingStarted();
56  void messageRead(const QString& topic, const Message& message);
57  void readingProgressChanged(double progress);
58  void readingFinished();
59  void readingFailed(const QString& error);
60 
61  private:
62  class Impl :
63  public QThread {
64  public:
65  Impl(QObject* parent = 0);
66  virtual ~Impl();
67 
68  void run();
69 
70  QMutex mutex_;
71  QString fileName_;
72  QString error_;
73 
74  QMap<QString, BagQuery*> queries_;
75  };
76 
78 
79  private slots:
80  void threadStarted();
81  void threadFinished();
82 
84  };
85 };
86 
87 #endif
void read(const QString &fileName)
Definition: BagReader.cpp:77
void readingFailed(const QString &error)
bool unsubscribe(const QString &topic, QObject *receiver, const char *method=0)
Definition: BagReader.cpp:107
QMap< int, QVariant > PropertyMap
Definition: MessageBroker.h:33
bool subscribe(const QString &topic, QObject *receiver, const char *method, const PropertyMap &properties=PropertyMap(), Qt::ConnectionType type=Qt::AutoConnection)
Definition: BagReader.cpp:90
QString getFileName() const
Definition: BagReader.cpp:61
bool event(QEvent *event)
Definition: BagReader.cpp:121
bool isReading() const
Definition: BagReader.cpp:69
void readingProgressChanged(double progress)
BagReader(QObject *parent=0)
Definition: BagReader.cpp:36
QString getError() const
Definition: BagReader.cpp:65
Impl(QObject *parent=0)
Definition: BagReader.cpp:48
QMap< QString, BagQuery * > queries_
Definition: BagReader.h:74
void messageRead(const QString &topic, const Message &message)


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