36 #ifndef OPM_PARAMETER_HEADER
37 #define OPM_PARAMETER_HEADER
42 #include <opm/core/utility/parameters/ParameterMapItem.hpp>
43 #include <opm/core/utility/parameters/ParameterStrings.hpp>
56 virtual std::string
getTag()
const {
return ID_xmltag__param;}
60 Parameter(
const std::string& value,
const std::string& type)
61 : value_(value), type_(type) {}
69 std::string
getType()
const {
return type_;}
79 std::string correct_parameter_tag(
const ParameterMapItem& item);
80 std::string correct_type(
const Parameter& parameter,
81 const std::string& type);
91 std::string& conversion_error,
94 conversion_error = correct_parameter_tag(item);
95 if (conversion_error !=
"") {
99 conversion_error = correct_type(parameter, ID_param_type__int);
100 if (conversion_error !=
"") {
103 std::stringstream stream;
108 conversion_error =
"Conversion to '" +
110 "' failed. Data was '" +
116 static std::string type() {
return ID_param_type__int;}
127 std::string& conversion_error,
130 conversion_error = correct_parameter_tag(item);
131 if (conversion_error !=
"") {
135 conversion_error = correct_type(parameter, ID_param_type__float);
136 if (conversion_error !=
"") {
139 std::stringstream stream;
144 conversion_error =
"Conversion to '" +
145 ID_param_type__float +
146 "' failed. Data was '" +
152 static std::string type() {
return ID_param_type__float;}
163 std::string& conversion_error,
166 conversion_error = correct_parameter_tag(item);
167 if (conversion_error !=
"") {
171 conversion_error = correct_type(parameter, ID_param_type__bool);
172 if (conversion_error !=
"") {
175 if (parameter.
getValue() == ID_true) {
177 }
else if (parameter.
getValue() == ID_false) {
180 conversion_error =
"Conversion failed. Data was '" +
182 "', but should be one of '" +
183 ID_true +
"' or '" + ID_false +
"'.\n";
187 static std::string type() {
return ID_param_type__bool;}
198 std::string& conversion_error,
201 conversion_error = correct_parameter_tag(item);
202 if (conversion_error !=
"") {
206 conversion_error = correct_type(parameter, ID_param_type__string);
207 if (conversion_error !=
"") {
212 static std::string type() {
return ID_param_type__string;}
215 #endif // OPM_PARAMETER_HPP
std::string getValue() const
Definition: Parameter.hpp:65
virtual ~Parameter()
Definition: Parameter.hpp:52
Definition: ParameterMapItem.hpp:64
std::string getType() const
Definition: Parameter.hpp:69
The parameter handlig system is structured as a tree, where each node inhertis from ParameterMapItem...
Definition: ParameterMapItem.hpp:47
virtual std::string getTag() const
Definition: Parameter.hpp:56
Definition: Parameter.hpp:48
Parameter(const std::string &value, const std::string &type)
Definition: Parameter.hpp:60