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

A queue datastructure, which validates parts of a VHIST file. More...

#include <validationqueue.h>

Inheritance diagram for vhist::ValidationQueue:
vhist::LogSource

List of all members.

Public Slots

void cancelValidation ()
 Stops the validation and removes all validatees from the queue.

Signals

void fileProcessed (int id, bool valid)
 This signal is emitted each time a file has been completely processed.
void savedFileProcessed (const QString filename, bool valid)
 This signal is emitted each time a file on the harddisk has been completely processed.
void sectionProcessed (int id, bool valid)
 This signal is emitted each time a file has been completely processed.
void percentFinishedChanged (int, const QString name)
 This signal is emitted each time the percentage of validated data in the queue changes.

Public Member Functions

 ValidationQueue (VhistParser *parser=NULL, int chunksize=100000)
 Creates a ValidationQueue object.
virtual ~ValidationQueue ()
 Destroys the ValidationQueue object.
void reset (VhistParser *parser)
 Clears and reinitializes the ValidationQueue.
void repopulate (VhistParser *parser)
 Resets the ValidationQueue and enqueues all files and sections from the given parser.
void addValidatees (QList< int > files, QList< int > sections)
 Adds a list of files and sections to the validation queue.
void addValidatees (QList< SavedFile > files)
 Adds a list of files in the filesystem to the validation queue.The files are characterized by their filenames, their filesize and the expected md5 sum.
bool process ()
 Continues processing entries in the queue.

Detailed Description

A queue datastructure, which validates parts of a VHIST file.

Sections and files can be enqueued at the end of the queue and are validated one after another. Entries in the queue are not validated in one single (blocking) step but continuously. Each call to the process method will validate a small fraction of data and inform whether all files and sections in the queue have already been validated. Progress information is published by a number of signals. Each instance of the class uses one vhist::VhistParser instance as the source for embedded files and sections.


Constructor & Destructor Documentation

ValidationQueue::ValidationQueue ( VhistParser parser = NULL,
int  chunksize = 100000 
)

Creates a ValidationQueue object.

Parameters:
[in]parserThe parser, who backs the validation queue. All files and sections are taken from this VhistParser object. Unless you only want to validate extracted files on your harddisk, parser should not be NULL.
[in]chunksizeThe maximum amount of data in bytes which is processed during one call of ValidationQueue::process().

Member Function Documentation

void ValidationQueue::addValidatees ( QList< int >  fileIDs,
QList< int >  sectionIDs 
)

Adds a list of files and sections to the validation queue.

The files and sections are taken from the VhistParser object associated with the queue.

Parameters:
[in]fileIDsA list of ids of embedded files in the associated VHIST file, which should be appended to the queue.
[in]sectionIDsA list of ids of sections in the associated VHIST file, which should be appended to the queue.
void ValidationQueue::addValidatees ( QList< SavedFile >  files)

Adds a list of files in the filesystem to the validation queue.The files are characterized by their filenames, their filesize and the expected md5 sum.

Parameters:
[in]filesThe list of files which should be added to the queue.
void ValidationQueue::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's checksum is correct.
void ValidationQueue::percentFinishedChanged ( int  percent,
const QString  filename 
) [signal]

This signal is emitted each time the percentage of validated data in the queue changes.

Parameters:
[in]percentThe percentage of data from the queue, which has already been validated.
[in]filenameThe name of the file which is processed at the moment.
bool ValidationQueue::process ( )

Continues processing entries in the queue.

The queue will only process a limited amount of data during one call. The size of each chunk can be specified in the constructor. Small sizes result in high responsiveness of

void ValidationQueue::repopulate ( VhistParser parser)

Resets the ValidationQueue and enqueues all files and sections from the given parser.

Parameters:
[in]parserThe parser which is used as datasource for this ValidationQueue.
void ValidationQueue::reset ( VhistParser parser)

Clears and reinitializes the ValidationQueue.

Parameters:
[in]parserThe parser which is used as datasource for this ValidationQueue.
void ValidationQueue::savedFileProcessed ( const QString  filename,
bool  valid 
) [signal]

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

Parameters:
[in]filenameThe name of the processed file.
[in]validtrue if the files's checksum is correct.
void ValidationQueue::sectionProcessed ( 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 section's checksum is correct.

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

VHISTlib 1.84.0.3018 of Jun 28 2013, generated by doxygen.