VHISTlib  1.84.0.3018
Public Slots | Signals | Public Member Functions
vhist::ExtractionQueue Class Reference

A queue datastructure which extracts embedded files from a VHIST file to the harddisk. More...

#include <extractionqueue.h>

Inheritance diagram for vhist::ExtractionQueue:
vhist::LogSource

List of all members.

Public Slots

void cancelExtraction ()
 Cancels the extraction currently running and clears the queue.

Signals

void fileProcessed (int id, bool valid)
 This signal is emitted each time a file has been completely processed.
void percentFinishedChanged (int percent, const QString filename)
 This signal is emitted after each call to process and informs all connected slots about the percentage of work finished, yet.

Public Member Functions

 ExtractionQueue (VhistParser *parser=NULL)
 Creates a new ExtractionQueue object.
virtual ~ExtractionQueue ()
 Destroys an ExtractionQueue object.
void reset (VhistParser *parser)
 Resets the ExtractionQueue object and associates the queue with another VhistParser object.
void addExtractees (QHash< int, QString > files)
 Adds a list of files, which should be extracted, to the ExtractionQueue.
bool process ()
 Continues extraction of the current file to disk.

Detailed Description

A queue datastructure which extracts embedded files from a VHIST file to the harddisk.

Files can be enqueued at the end of the queue and the files are extracted in the order in which they are inserted into the queue.

Each call to the process() method extracts only a limited amount of data. This way, the application is still responsive in case that large files are extracted.

Information about the progress of the extraction is published via the signals of the class.

Todo:
More error checking

Constructor & Destructor Documentation

ExtractionQueue::ExtractionQueue ( VhistParser parser = NULL)

Creates a new ExtractionQueue object.

The object is identified with a VhistParser object. All embedded files are taken from this parser.

Parameters:
[in]parserThe parser associated with the ExtractionQueue. The parser must not be NULL.

Member Function Documentation

void ExtractionQueue::addExtractees ( QHash< int, QString >  filesToExtract)

Adds a list of files, which should be extracted, to the ExtractionQueue.

Parameters:
[in]filesToExtractA hashtable with file ids as keys and the filenames of the files on disk as values.
Note:
Due to the nature of hashtables, the order in which the files are inserted into the queue is probably not the same order in which they have been inserted into the hashtable.
void ExtractionQueue::cancelExtraction ( ) [slot]

Cancels the extraction currently running and clears the queue.

If the current file has not been extracted completely, the incomplete file will still be in the filesystem.

void ExtractionQueue::fileProcessed ( int  id,
bool  valid 
) [signal]

This signal is emitted each time a file has been completely processed.

Parameters:
[in]idThe id of the processed file.
[in]validtrue if the file was valid and extraction succeeded.
void ExtractionQueue::percentFinishedChanged ( int  percent,
const QString  filename 
) [signal]

This signal is emitted after each call to process and informs all connected slots about the percentage of work finished, yet.

It also states the name of the file currently processed.

Parameters:
[in]percentThe percentage of work already done.
[in]filenameThe name of the file which is currently extracted.
bool ExtractionQueue::process ( )

Continues extraction of the current file to disk.

The method will only process a limited amount of data before it returns. This way, the application stays responsive, even when large files are extracted. This is especially important for applications with graphical userinterfaces.

Returns:
false if the last file has been extracted and the queue is empty, now. Otherwise true.
void ExtractionQueue::reset ( VhistParser parser)

Resets the ExtractionQueue object and associates the queue with another VhistParser object.

Parameters:
[in]parserThe new VhistParser object. Must not be NULL.

The documentation for this class was generated from the following files:

VHISTlib 1.84.0.3018 of Jun 28 2013, generated by doxygen.