EventAnalysis  1.4.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 
120  const std::string &GetParameter(const std::string &confObjName, const std::string &parName) const;
121 
133  std::vector<std::pair<std::string, std::vector<std::string>>> GetParameters() const;
134 
145  std::vector<std::string> GetParameters(const std::string &confObjName) const;
146 
147  // Exception classes
149  using Exception::Exception;
150  };
151 
152 private:
153  typedef std::unordered_map<std::string, std::string> StringMap;
155 
156  typedef std::unordered_map<std::string, StringMap> StringMapMap;
157  StringMapMap _parameterMap;
158 
159  static const std::string _nullString;
160 };
161 
162 } // namespace EA
163 
164 #endif /* COMMANDLINEPARAMETERS_H_ */
StringMap _outputMap
Definition: CommandLineParameters.h:154
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:154
std::unordered_map< std::string, StringMap > StringMapMap
Definition: CommandLineParameters.h:156
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
std::vector< std::pair< std::string, std::vector< std::string > > > GetParameters() const
Get a list of parameters for configurable objects that has been specified on the command line...
Definition: CommandLineParameters.cpp:115
IncludeFileExc.h IncludeFileExc class declaration.
Definition: Algorithm.h:21
Definition: CommandLineParameters.h:148
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 configurable object.
Definition: CommandLineParameters.cpp:26
std::unordered_map< std::string, std::string > StringMap
Definition: CommandLineParameters.h:153
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:159
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
const std::string & GetParameter(const std::string &confObjName, const std::string &parName) const
Gets the value of the given parameter for the given configurable object.
Definition: CommandLineParameters.cpp:67
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
StringMapMap _parameterMap
Definition: CommandLineParameters.h:157