EventAnalysis
1.3.0
|
A class to store parameters passed from command line. More...
#include <CommandLineParameters.h>
Classes | |
struct | MultipleDefinitionExc |
Public Member Functions | |
bool | AddDataSource (const std::string &dataProviderName, const std::string &dataSource) |
Adds a output configuration string for a given persistence service. More... | |
bool | AddOutput (const std::string &persistenceName, const std::string &output) |
Adds an output configuration string for a given persistence service. More... | |
bool | AddParameter (const std::string &algoName, const std::string ¶mName, const std::string ¶meter) |
Adds a parameter setting string for a given algorithm. More... | |
const std::string & | GetDataSource (const std::string &dataProviderName) const |
Gets the output string for the given data provider. More... | |
std::vector< std::string > | GetProviders () const |
Get a list of providers whose data source has been specified on the command line. More... | |
const std::string & | GetOutput (const std::string &persistenceName) const |
Gets the output string for the given persistence service. More... | |
std::vector< std::string > | GetPersistences () const |
Get a list of persistence services whose output has been specified on the command line. More... | |
const std::string & | GetParameter (const std::string &algoName, const std::string &parName) const |
Gets the value of the given parameter for the given algorithm. More... | |
std::vector< std::pair< std::string, std::vector< std::string > > > | GetAlgorithmParameters () const |
Get a list of algorithm parameters that has been specified on the command line. More... | |
std::vector< std::string > | GetAlgorithmParameters (const std::string &algoName) const |
Get a list of algorithm parameters that has been specified on the command line for a given algorithm. More... | |
Private Types | |
typedef std::unordered_map< std::string, std::string > | StringMap |
typedef std::unordered_map< std::string, StringMap > | StringMapMap |
Private Attributes | |
StringMap | _dataSourceMap |
StringMap | _outputMap |
StringMapMap | _parameterMap |
Static Private Attributes | |
static const std::string | _nullString = "" |
A class to store parameters passed from command line.
Configuring an analysis only with a configuration file might be awkward in some situations, e.g. when launching different jobs each one with different output or output. In this case it is impractical to produce one configuration file per job; a better solution is to specify these "variable parameters" on the command line. This class is a container for these command line parameters. Currently the class handles the definitions of: data sources for data providers, output for persistence services, parameter values for algorithms.
|
private |
|
private |
bool EA::CommandLineParameters::AddDataSource | ( | const std::string & | dataProviderName, |
const std::string & | dataSource | ||
) |
Adds a output configuration string for a given persistence service.
Sets the output string for the given provider. Note that this method actually doesn't configure the persistence service; it only stores the output string. The configuration of the provider must be done separately, by retrieving the output string with the GetDataSource method.
dataProviderName | The persistence service. |
dataSource | The output. |
bool EA::CommandLineParameters::AddOutput | ( | const std::string & | persistenceName, |
const std::string & | output | ||
) |
Adds an output configuration string for a given persistence service.
Sets the output string for the given persistence. Note that this method actually doesn't configure the persistence service; it only stores the output string. The configuration of the persistence must be done separately, by retrieving the output string with the GetOutput method.
persistenceName | The persistence service. |
output | The output. |
bool EA::CommandLineParameters::AddParameter | ( | const std::string & | algoName, |
const std::string & | paramName, | ||
const std::string & | parameter | ||
) |
Adds a parameter setting string for a given algorithm.
Sets the value string for the given algorithm and parameter. Note that this method actually doesn't configure the algorithm; it only stores the value string. The configuration of the algorithm must be done separately, by retrieving the value string with the GetParameter method.
algoName | The algorithm. |
paramName | The parameter name. |
param | The parameter value. |
std::vector< std::pair< std::string, std::vector< std::string > > > EA::CommandLineParameters::GetAlgorithmParameters | ( | ) | const |
Get a list of algorithm parameters that has been specified on the command line.
Each element of the returned vector is a pair, the first element being the name of the algorithm and the second one being the vector of the parameters defined for that algorithm
std::vector< std::string > EA::CommandLineParameters::GetAlgorithmParameters | ( | const std::string & | algoName | ) | const |
Get a list of algorithm parameters that has been specified on the command line for a given algorithm.
The returned vector contains the names of the parameters defined on the command line for the specified algorithm.
algoName | The name of the requested algorithm. |
const std::string & EA::CommandLineParameters::GetDataSource | ( | const std::string & | dataProviderName | ) | const |
Gets the output string for the given data provider.
dataProviderName | The data provider. |
const std::string & EA::CommandLineParameters::GetOutput | ( | const std::string & | persistenceName | ) | const |
Gets the output string for the given persistence service.
persistenceName | The persistence service. |
const std::string & EA::CommandLineParameters::GetParameter | ( | const std::string & | algoName, |
const std::string & | parName | ||
) | const |
Gets the value of the given parameter for the given algorithm.
The value is searched among those given on command line by matching both the algorithm name and the parameter name separately. On failure, eventual command line algorithm names given as glob expression are matched to algoName, and in case of success the parameter name is matched. If the desired parameter is defined by two or more matching glob algorithm names then an exception is thrown, e.g. the following two parameter definitions:
algo*,par,value algo?,par,value
will make GetParameter("algo1", "par") throw.
algoName | The algorithm. |
parName | The parameter. |
MultipleDefinitionExc | if more than one matching glob define a value for the same parameter. |
std::vector< std::string > EA::CommandLineParameters::GetPersistences | ( | ) | const |
Get a list of persistence services whose output has been specified on the command line.
std::vector< std::string > EA::CommandLineParameters::GetProviders | ( | ) | const |
Get a list of providers whose data source has been specified on the command line.
|
private |
|
staticprivate |
|
private |
|
private |