EventAnalysis  1.3.0
CommandLineParameters.h
Go to the documentation of this file.
1 /*
2  * CommandLineParameters.h
3  *
4  * Created on: 12 Sep 2017
5  * Author: Nicola Mori
6  */
7 
10 #ifndef COMMANDLINEPARAMETERS_H_
11 #define COMMANDLINEPARAMETERS_H_
12 
13 #include "core/Exception.h"
14 
15 #include <string>
16 #include <unordered_map>
17 #include <vector>
18 
19 namespace EA {
20 
32 public:
44  bool AddDataSource(const std::string &dataProviderName, const std::string &dataSource);
45 
57  bool AddOutput(const std::string &persistenceName, const std::string &output);
58 
71  bool AddParameter(const std::string &algoName, const std::string &paramName, const std::string &parameter);
72 
79  const std::string &GetDataSource(const std::string &dataProviderName) const;
80 
85  std::vector<std::string> GetProviders() const;
86 
93  const std::string &GetOutput(const std::string &persistenceName) const;
94 
99  std::vector<std::string> GetPersistences() const;
100 
118  const std::string &GetParameter(const std::string &algoName, const std::string &parName) const;
119 
127  std::vector<std::pair<std::string, std::vector<std::string>>> GetAlgorithmParameters() const;
128 
136  std::vector<std::string> GetAlgorithmParameters(const std::string &algoName) const;
137 
138  // Exception classes
140  using Exception::Exception;
141  };
142 
143 private:
144  typedef std::unordered_map<std::string, std::string> StringMap;
146 
147  typedef std::unordered_map<std::string, StringMap> StringMapMap;
148  StringMapMap _parameterMap;
149 
150  static const std::string _nullString;
151 };
152 
153 } // namespace EA
154 
155 #endif /* COMMANDLINEPARAMETERS_H_ */
StringMap _outputMap
Definition: CommandLineParameters.h:145
bool AddDataSource(const std::string &dataProviderName, const std::string &dataSource)
Adds a output configuration string for a given persistence service.
Definition: CommandLineParameters.cpp:18
StringMap _dataSourceMap
Definition: CommandLineParameters.h:145
std::unordered_map< std::string, StringMap > StringMapMap
Definition: CommandLineParameters.h:147
const std::string & GetOutput(const std::string &persistenceName) const
Gets the output string for the given persistence service.
Definition: CommandLineParameters.cpp:49
Exception(std::string msg="")
Definition: Exception.h:31
IncludeFileExc.h IncludeFileExc class declaration.
Definition: Algorithm.h:21
Definition: CommandLineParameters.h:139
A class to store parameters passed from command line.
Definition: CommandLineParameters.h:31
bool AddParameter(const std::string &algoName, const std::string &paramName, const std::string &parameter)
Adds a parameter setting string for a given algorithm.
Definition: CommandLineParameters.cpp:26
std::unordered_map< std::string, std::string > StringMap
Definition: CommandLineParameters.h:144
bool AddOutput(const std::string &persistenceName, const std::string &output)
Adds an output configuration string for a given persistence service.
Definition: CommandLineParameters.cpp:22
static const std::string _nullString
Definition: CommandLineParameters.h:150
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.
Definition: CommandLineParameters.cpp:115
const std::string & GetDataSource(const std::string &dataProviderName) const
Gets the output string for the given data provider.
Definition: CommandLineParameters.cpp:31
std::vector< std::string > GetProviders() const
Get a list of providers whose data source has been specified on the command line. ...
Definition: CommandLineParameters.cpp:40
Definition: Exception.h:24
std::vector< std::string > GetPersistences() const
Get a list of persistence services whose output has been specified on the command line...
Definition: CommandLineParameters.cpp:58
const std::string & GetParameter(const std::string &algoName, const std::string &parName) const
Gets the value of the given parameter for the given algorithm.
Definition: CommandLineParameters.cpp:67
StringMapMap _parameterMap
Definition: CommandLineParameters.h:148