BagReader.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  * Copyright (C) 2015 by Ralf Kaestner                                        *
00003  * ralf.kaestner@gmail.com                                                    *
00004  *                                                                            *
00005  * This program is free software; you can redistribute it and/or modify       *
00006  * it under the terms of the Lesser GNU General Public License as published by*
00007  * the Free Software Foundation; either version 3 of the License, or          *
00008  * (at your option) any later version.                                        *
00009  *                                                                            *
00010  * This program is distributed in the hope that it will be useful,            *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the               *
00013  * Lesser GNU General Public License for more details.                        *
00014  *                                                                            *
00015  * You should have received a copy of the Lesser GNU General Public License   *
00016  * along with this program. If not, see <http://www.gnu.org/licenses/>.       *
00017  ******************************************************************************/
00018 
00019 #ifndef RQT_MULTIPLOT_BAG_READER_H
00020 #define RQT_MULTIPLOT_BAG_READER_H
00021 
00022 #include <QMap>
00023 #include <QMutex>
00024 #include <QString>
00025 #include <QStringList>
00026 #include <QThread>
00027 
00028 #include <rqt_multiplot/BagQuery.h>
00029 #include <rqt_multiplot/MessageBroker.h>
00030 
00031 namespace rqt_multiplot {
00032   class BagReader :
00033     public MessageBroker {
00034   Q_OBJECT
00035   public:
00036     BagReader(QObject* parent = 0);
00037     virtual ~BagReader();
00038     
00039     QString getFileName() const;
00040     QString getError() const;
00041     bool isReading() const;
00042     
00043     void read(const QString& fileName);
00044     void wait();
00045     
00046     bool subscribe(const QString& topic, QObject* receiver,
00047       const char* method, const PropertyMap& properties = PropertyMap(),
00048       Qt::ConnectionType type = Qt::AutoConnection);
00049     bool unsubscribe(const QString& topic, QObject* receiver,
00050       const char* method = 0);
00051     
00052     bool event(QEvent* event);
00053     
00054   signals:
00055     void readingStarted();
00056     void messageRead(const QString& topic, const Message& message);
00057     void readingProgressChanged(double progress);
00058     void readingFinished();
00059     void readingFailed(const QString& error);
00060     
00061   private:
00062     class Impl :
00063       public QThread {
00064     public:
00065       Impl(QObject* parent = 0);
00066       virtual ~Impl();
00067       
00068       void run();
00069       
00070       QMutex mutex_;
00071       QString fileName_;
00072       QString error_;
00073       
00074       QMap<QString, BagQuery*> queries_;
00075     };
00076     
00077     Impl impl_;
00078     
00079   private slots:
00080     void threadStarted();
00081     void threadFinished();
00082 
00083     void queryAboutToBeDestroyed();
00084   };
00085 };
00086 
00087 #endif


rqt_multiplot
Author(s): Ralf Kaestner
autogenerated on Tue May 9 2017 02:16:02