LogCompressor.h 1.69 KB
Newer Older
pixhawk's avatar
pixhawk committed
1 2 3 4 5 6 7
#ifndef LOGCOMPRESSOR_H
#define LOGCOMPRESSOR_H

#include <QThread>

class LogCompressor : public QThread
{
8
    Q_OBJECT
pixhawk's avatar
pixhawk committed
9
public:
10
    /** @brief Create the log compressor. It will only get active upon calling startCompression() */
11
    LogCompressor(QString logFileName, QString outFileName="", QString delimiter="\t");
12 13
    /** @brief Start the compression of a raw, line-based logfile into a CSV file */
    void startCompression(bool holeFilling=false);
14 15
    bool isFinished();
    int getCurrentLine();
16

pixhawk's avatar
pixhawk committed
17
protected:
18 19 20 21 22 23 24
    void run();                     ///< This function actually performs the compression. It's an overloaded function from QThread
    QString logFileName;            ///< The input file name.
    QString outFileName;            ///< The output file name. If blank defaults to logFileName
    bool running;                   ///< True when the startCompression() function is operating.
    int currentDataLine;            ///< The current line of data that is being processed. Only relevant when running==true
    QString delimiter;              ///< Delimiter between fields in the output file. Defaults to tab ('\t')
    bool holeFillingEnabled;        ///< Enables the filling of holes in the dataset with the previous value (or NaN if none exists)
25 26

signals:
27 28 29 30 31
    /** @brief This signal is emitted when there is a change in the status of the parsing algorithm. For instance if an error is encountered.
     * @param status A status message
     */
    void logProcessingStatusChanged(QString status);

32
    /** @brief This signal is emitted once a logfile has been finished writing
33
     * @param fileName The name of the output (CSV) file
34 35
     */
    void finishedFile(QString fileName);
pixhawk's avatar
pixhawk committed
36 37
};

38
#endif // LOGCOMPRESSOR_H