#include <DetectorDataArchive.h>
cvac::DetectorDataArchive::DetectorDataArchive |
( |
| ) |
|
Construct a DetectorDataArchive class
TODO:
The DetectorDataArchive implementation should be changed as follows.
Only one minor interface modification would result: DDA client would
need to make the distinction between keys that are references to files
and keys that are other properties.
Changes: use a std::map instead of two parallel vectors of keys and values. Make the key comparison operator perform a case-insensitive string comparison. Don't distinguish between a property and file in DDA; always use "=" as separator. Instead, provide a function that returns a full file path for a given key which a DDA client can call: getFSPathForProperty( const std::string& key ) Do not require the space before and after the = Chop the keys and values (remove leading and trailing whitespace) Write a unit test for DDA.
bool cvac::DetectorDataArchive::addFile |
( |
const std::string & |
identifier, |
|
|
const std::string & |
filename |
|
) |
| |
Add a file to the archive. A file has two parts. An identifier string that tells what this file is and the name of the file itself. This assumes that it might not be possible to determine the purpose of the file just by given its name.
- Parameters
-
identifier | - the identifier string for the file |
filename | - the file name. |
- Returns
- - returns true if the file exists and no other file in the archive has this identifier else it returns false.
void cvac::DetectorDataArchive::createArchive |
( |
const std::string & |
relDirectory | ) |
|
Archive the detector data using relDirectory. This throws an exception if the archive cannot be created.
const std::string cvac::DetectorDataArchive::getFile |
( |
const std::string & |
identifier | ) |
const |
Get a file name in the archive based on its identifier
- Parameters
-
identifier | - the identifier string for the file |
- Returns
- - the filename in the archive that matches the identifier. The return string is empty if there is no match.
const std::vector< std::string > cvac::DetectorDataArchive::getFileIds |
( |
| ) |
|
Get the list of file identifiers in a archive.
- Returns
- a vector of file identifiers contained in the archive.
vector< string > cvac::DetectorDataArchive::getProperties |
( |
| ) |
|
Get the list of properties currently defined. These can be set from an archive file or from the user or both.
string cvac::DetectorDataArchive::getProperty |
( |
const std::string & |
name | ) |
const |
Get a value of a trainer property value defined by name.
bool cvac::DetectorDataArchive::removeFile |
( |
const std::string & |
identifier | ) |
|
Remove the file that maps to this identifier from the archive
- Parameters
-
identifier | - the file identifier and file to remove |
- Returns
- - returns true if the identifier was removed false if the identifier was not in the archive.
void cvac::DetectorDataArchive::setArchiveFilename |
( |
std::string & |
filename | ) |
|
Set the archive filename. This should be the complete path and filename.
void cvac::DetectorDataArchive::setProperty |
( |
const std::string & |
name, |
|
|
const std::string & |
value |
|
) |
| |
Save a property which is a name, value pair. When the trainer data is archived these attributes are written out to the archive.
void cvac::DetectorDataArchive::unarchive |
( |
const std::string & |
archiveFile, |
|
|
const std::string & |
dir |
|
) |
| |
Unarchive the passed in archive file into dir. This throws an exception of the file cannot be found or compressed. If any trainer.property file existed in the archive then this DetectorDataArchive's properties are set to the contents of that file.
- Parameters
-
archiveFile | the file to unarchive. |
dir | Write all unarchived files into this directory. |
std::string cvac::DetectorDataArchive::mArchiveName |
|
private |
std::vector<std::string> cvac::DetectorDataArchive::mFileIds |
|
private |
std::vector<std::string> cvac::DetectorDataArchive::mFileNames |
|
private |
std::vector<std::string> cvac::DetectorDataArchive::mPropNames |
|
private |
std::vector<std::string> cvac::DetectorDataArchive::mPropValues |
|
private |
The documentation for this class was generated from the following files: