-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParseParameters.h
63 lines (54 loc) · 1.77 KB
/
ParseParameters.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef PARSEPARAMETERS_H
#define PARSEPARAMETERS_H
#include <map>
#include <fstream>
#include <string>
/// Parse and accumulate initial values for parameters.
/// New values for the parameters came in the form name=value or name:value
///
/// @author Mario Valle - Swiss National Supercomputing Centre (CSCS)
/// @date 2012-02-21 (initial version)
/// @version 1.1
///
class ParseParameters {
public:
/// Return a pointer to the singleton instance
///
/// @return The pointer to the instance
///
static ParseParameters *getInstance(void);
/// Change value to a given parameter.
/// The argument is a string: name=value or name:value where the name is in
/// (w0, k, p0, p1, w2) and the value is a double numerical value
///
/// @param[in] aParamValuePair The string to be parsed for name and value
///
/// @exception FastCodeMLFatal For invalid or malformed string
///
void addParameter(const char *aParamValuePair);
/// Get the value associated to the given name
///
/// @param[in] aParamName The name of the parameter to be retrieved
///
/// @exception FastCodeMLFatal For not existent parameter name
///
double getParameter(const char *aParamName) const;
/// Print the parameter list as: cout << r;
///
/// @param[in] aOut Output stream
/// @param[in] aParamsList Pointer to the instance to be printed
///
/// @return The output stream
///
friend std::ostream &operator<<(std::ostream &aOut,
const ParseParameters *aParamsList);
protected:
/// Protected constructor
///
ParseParameters();
private:
static ParseParameters *mInstance; ///< Pointer to the singleton instance
std::map<std::string, double>
mDictionary; ///< Dictionary holding the pairs (parameter name, value)
};
#endif