VHISTlib  1.84.0.3018
/daten/ahuesgen/projects/vhist/code/vhistlib/include/unvhistlib/extractionqueue.h
00001 /* $HEADERS
00002  $Id: extractionqueue.h 2791 2013-05-06 11:24:28Z michael $
00003  */
00004 
00005 #ifndef EXTRACTIONQUEUE_INCLUDED
00006 #define EXTRACTIONQUEUE_INCLUDED
00007 
00008 #include "../shared/misc_defines.h"
00009 
00010 #include <QObject>
00011 #include <QString>
00012 #include <QQueue>
00013 #include <QFile>
00014 #include <QHash>
00015 
00016 #include "inflater.h"
00017 #include "../shared/stopwatch.h"
00018 #include "../shared/logsource.h"
00019 
00020 namespace vhist
00021 {
00022 
00023 class VhistParser;
00024 struct FileTag;
00025 
00026 struct VHIST_EXTERN Extractee
00027 {
00028     int id;
00029     int start;
00030     int numBytes;
00031     QString md5;
00032     QString cmd5;
00033     QString fullpath;
00034 };
00035 
00036 
00051 class VHIST_EXTERN ExtractionQueue : public LogSource
00052 {
00053     Q_OBJECT
00054     public: // construction, destruction, assignment
00055         ExtractionQueue(VhistParser* parser = NULL);
00056         virtual ~ExtractionQueue();
00057         void reset(VhistParser* parser);
00058         void addExtractees(QHash<int, QString> files);
00059     
00060     public slots:
00061         void cancelExtraction();
00062     
00063     public:
00064         bool process();
00065     
00066     signals:
00067         void fileProcessed(int id, bool valid);
00068         void percentFinishedChanged(int percent, const QString filename);
00069     
00070     private:
00071         void reinit(VhistParser* parser);
00072         void nextEntry();
00073         Extractee extracteeFromFile(const FileTag& tag);
00074         bool handleError(const QString& error, const Extractee& e);
00075     
00076     private: // member variables
00077         VhistParser* m_parser;
00078         Inflater m_inflater;
00079         StopWatch m_stopwatch;
00080         QQueue<Extractee> m_extractees;
00081         QFile m_currentFile;
00082         // the number of processed bytes of the current extractee
00083         int m_bytesHandled;
00084         // the total number of bytes to handle since the last reset
00085         qint64 m_totalBytes;
00086         // the total number of bytes handled since the last reset
00087         qint64 m_totalHandled;
00088 };
00089 
00090 
00091 } // namespace
00092 
00093 #endif // EXTRACTIONQUEUE_INCLUDED
00094 

VHISTlib 1.84.0.3018 of Jun 28 2013, generated by doxygen.