the class used for scanning local directories and file servers for samples More...
#include <ScanDir.h>
Public Member Functions | |
ScanDir () | |
standard constructor | |
const ScanDir & | scan (SampleHandler &sh, const std::string &dir) const |
scan the given directory and put the created samples into the sample handler | |
const ScanDir & | scanEOS (SampleHandler &sh, const std::string &eosDir) const |
scan the given directory in EOS and put the created samples into the sample handler | |
const ScanDir & | scan (SampleHandler &sh, DiskList &list) const |
ScanDir & | sampleDepth (int val_sampleDepth) |
the index of the file hierarchy at which we gather the sample name. | |
ScanDir & | absSampleDepth (int val_absSampleDepth) |
the index of the file hierarchy at which we gather the sample name. | |
ScanDir & | sampleName (const std::string &val_sampleName) |
a single sample name into which all found files should be placed. if set, this overrides all other naming methods. | |
ScanDir & | minDepth (std::size_t val_minDepth) |
the minimum depth for files to make it into the sample | |
ScanDir & | maxDepth (std::size_t val_maxDepth) |
the maximum depth for files to make it into the sample | |
ScanDir & | filePattern (const std::string &val_filePattern) |
the pattern for files to be accepted | |
ScanDir & | fileRegex (const std::string &val_fileRegex) |
the regular expression for files to be accepted | |
ScanDir & | samplePattern (const std::string &val_samplePattern) |
the pattern for samples to be accepted | |
ScanDir & | samplePostfix (const std::string &val_samplePostfix) |
the pattern for the postfix to be stripped from the sampleName | |
ScanDir & | sampleRename (const std::string &pattern, const std::string &name) |
rename any sample matching pattern to name | |
ScanDir & | extraNameComponent (int val_relSampleDepth) |
attach an extra name component to the sample based on a second component of the path |
the class used for scanning local directories and file servers for samples
Originally these was a series of stand-alone function calls, but people kept asking for more and more options, making it unwieldy to call and to maintain. Instead we now have a single class containing all the possible parameters, which makes it easier to configure and extend.
The member functions all return *this, so that usage like this is possible:
ScanDir() .filePattern ("*.root*") .scan (sh, "/data");
SH::ScanDir::ScanDir | ( | ) |
standard constructor
ScanDir & SH::ScanDir::absSampleDepth | ( | int | val_absSampleDepth | ) |
the index of the file hierarchy at which we gather the sample name.
this differs from sampleDepth in that negative numbers count up in the directory hierarchy from the top of where we scan, while sampleDepth starts counting from the back if the number is negative.
ScanDir & SH::ScanDir::extraNameComponent | ( | int | val_relSampleDepth | ) |
attach an extra name component to the sample based on a second component of the path
ScanDir & SH::ScanDir::filePattern | ( | const std::string & | val_filePattern | ) |
the pattern for files to be accepted
ScanDir & SH::ScanDir::fileRegex | ( | const std::string & | val_fileRegex | ) |
the regular expression for files to be accepted
ScanDir & SH::ScanDir::sampleDepth | ( | int | val_sampleDepth | ) |
the index of the file hierarchy at which we gather the sample name.
this is positive when it starts counting from the top, and negative when it starts from the back, i.e. -1 uses the file name, 0 denotes the directory inside the top level directory
const ScanDir & SH::ScanDir::scan | ( | SampleHandler & | sh, | |
DiskList & | list | |||
) | const |
scan the given directory and put the created samples into the sample handler
const ScanDir & SH::ScanDir::scan | ( | SampleHandler & | sh, | |
const std::string & | dir | |||
) | const |
scan the given directory and put the created samples into the sample handler
const ScanDir & SH::ScanDir::scanEOS | ( | SampleHandler & | sh, | |
const std::string & | eosDir | |||
) | const |
scan the given directory in EOS and put the created samples into the sample handler