changed: remove embedded 'parameters' namespace in ParamGroup

inconsistent and unnecessary.

this is purely a cosmetic change, the only exception was a function with
the generic name 'split', which was renamed to splitParam to avoid confusion.
This commit is contained in:
Arne Morten Kvarving 2017-04-28 15:32:52 +02:00
parent 3a54a224cf
commit 8f637064c4
11 changed files with 11 additions and 34 deletions

View File

@ -40,7 +40,6 @@
#include <opm/core/utility/parameters/Parameter.hpp>
namespace Opm {
namespace parameter {
std::string
correct_parameter_tag(const ParameterMapItem& item)
{
@ -70,5 +69,4 @@ namespace Opm {
return "";
}
}
} // namespace parameter
} // namespace Opm

View File

@ -43,8 +43,6 @@
#include <opm/core/utility/parameters/ParameterStrings.hpp>
namespace Opm {
/// See ParameterGroup.hpp for how to use the parameter system
namespace parameter {
/// @brief
/// @todo Doc me!
class Parameter : public ParameterMapItem {
@ -213,6 +211,5 @@ namespace Opm {
}
static std::string type() {return ID_param_type__string;}
};
} // namespace parameter
} // namespace Opm
#endif // OPM_PARAMETER_HPP

View File

@ -49,8 +49,6 @@
#include <opm/core/utility/parameters/ParameterTools.hpp>
namespace Opm {
namespace parameter {
ParameterGroup::ParameterGroup()
: path_(ID_path_root), parent_(0), output_is_enabled_(true)
{
@ -69,7 +67,7 @@ namespace Opm {
bool ParameterGroup::has(const std::string& name) const
{
std::pair<std::string, std::string> name_path = split(name);
std::pair<std::string, std::string> name_path = splitParam(name);
map_type::const_iterator it = map_.find(name_path.first);
if (it == map_.end()) {
return false;
@ -170,7 +168,7 @@ namespace Opm {
void ParameterGroup::insert(const std::string& name,
const std::shared_ptr<ParameterMapItem>& data)
{
std::pair<std::string, std::string> name_path = split(name);
std::pair<std::string, std::string> name_path = splitParam(name);
map_type::const_iterator it = map_.find(name_path.first);
assert(name_path.second == "");
if (it == map_.end()) {
@ -202,9 +200,9 @@ namespace Opm {
void ParameterGroup::insertParameter(const std::string& name,
const std::string& value)
{
std::pair<std::string, std::string> name_path = split(name);
std::pair<std::string, std::string> name_path = splitParam(name);
while (name_path.first == "") {
name_path = split(name_path.second);
name_path = splitParam(name_path.second);
}
map_type::const_iterator it = map_.find(name_path.first);
if (it == map_.end()) {
@ -330,5 +328,4 @@ namespace Opm {
return unhandled_arguments_;
}
} // namespace parameter
} // namespace Opm

View File

@ -45,7 +45,6 @@
#include <opm/core/utility/parameters/ParameterRequirement.hpp>
namespace Opm {
namespace parameter {
/// ParameterGroup is a class that is used to provide run-time parameters.
/// The standard use of the class is to call create it with the
/// (int argc, char** argv) constructor (where the arguments are those
@ -266,7 +265,6 @@ namespace Opm {
static std::pair<std::string, std::string>
filename_split(const std::string& filename);
};
} // namespace parameter
} // namespace Opm
#include <opm/core/utility/parameters/ParameterGroup_impl.hpp>

View File

@ -48,8 +48,6 @@
#include <opm/common/OpmLog/OpmLog.hpp>
namespace Opm {
namespace parameter {
template<>
struct ParameterMapItemTrait<ParameterGroup> {
static ParameterGroup
@ -179,7 +177,7 @@ namespace Opm {
const Requirement& r) const
{
setUsed();
std::pair<std::string, std::string> name_path = split(name);
std::pair<std::string, std::string> name_path = splitParam(name);
map_type::const_iterator it = map_.find(name_path.first);
if (it == map_.end()) {
if (parent_ != 0) {
@ -225,7 +223,7 @@ namespace Opm {
const Requirement& r) const
{
setUsed();
std::pair<std::string, std::string> name_path = split(name);
std::pair<std::string, std::string> name_path = splitParam(name);
map_type::const_iterator it = map_.find(name_path.first);
if (it == map_.end()) {
if (parent_ != 0) {
@ -308,7 +306,6 @@ namespace Opm {
}
return value;
}
} // namespace parameter
} // namespace Opm
#endif // OPM_PARAMETERGROUP_IMPL_HEADER

View File

@ -39,7 +39,6 @@
#include <string>
namespace Opm {
namespace parameter {
/// The parameter handlig system is structured as a tree,
/// where each node inhertis from ParameterMapItem.
///
@ -67,7 +66,6 @@ namespace Opm {
std::string& conversion_error);
static std::string type();
};
} // namespace parameter
} // namespace Opm
#endif // OPM_PARAMETERMAPITEM_HEADER

View File

@ -43,7 +43,6 @@
#include <vector>
namespace Opm {
namespace parameter {
/// @brief
/// @todo Doc me!
/// @tparam
@ -237,7 +236,6 @@ namespace Opm {
private:
const std::vector<std::string> elements_;
};
} // namespace parameter
} // namespace Opm
#endif // OPM_PARAMETERREQUIREMENT_HEADER

View File

@ -39,7 +39,6 @@
#include <string>
namespace Opm {
namespace parameter {
const std::string ID_true = "true";
const std::string ID_false = "false";
@ -59,7 +58,6 @@ namespace Opm {
const std::string ID_delimiter_path = "/";
const std::string ID_comment = "//";
const std::string ID_delimiter_assignment = "=";
} // namespace parameter
} // namespace Opm
#endif // OPM_PARAMETERSTRINGS_HEADER

View File

@ -40,8 +40,7 @@
#include <opm/core/utility/parameters/ParameterStrings.hpp>
namespace Opm {
namespace parameter {
std::pair<std::string, std::string> split(const std::string& name)
std::pair<std::string, std::string> splitParam(const std::string& name)
{
int pos = name.find(ID_delimiter_path);
if (pos == int(std::string::npos)) {
@ -51,5 +50,4 @@ namespace Opm {
name.substr(pos + ID_delimiter_path.size()));
}
}
} // namespace parameter
} // namespace Opm

View File

@ -40,9 +40,7 @@
#include <utility>
namespace Opm {
namespace parameter {
std::pair<std::string, std::string> split(const std::string& name);
} // namespace parameter
std::pair<std::string, std::string> splitParam(const std::string& name);
} // namespace Opm
#endif // OPM_PARAMETERTOOLS_HEADER

View File

@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(commandline_syntax_init)
"/group/item=overridingstring",
0 };
const std::size_t argc = argv.size() - 1;
parameter::ParameterGroup p(argc, argv.data());
ParameterGroup p(argc, argv.data());
BOOST_CHECK(p.get<std::string>("topitem") == "somestring");
std::ostringstream os;
p.writeParamToStream(os);
@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(xml_syntax_init)
"unhandledargument",
0};
const std::size_t argc = argv.size() - 1;
parameter::ParameterGroup p(argc, argv.data(), false);
ParameterGroup p(argc, argv.data(), false);
BOOST_CHECK(p.get<std::string>("topitem") == "somestring");
std::ostringstream os;
p.writeParamToStream(os);
@ -120,5 +120,5 @@ BOOST_AUTO_TEST_CASE(failing_strict_xml_syntax_init)
"unhandledargument",
0 };
const std::size_t argc = argv.size() - 1;
BOOST_CHECK_THROW(parameter::ParameterGroup p(argc, argv.data()), std::runtime_error);
BOOST_CHECK_THROW(ParameterGroup p(argc, argv.data()), std::runtime_error);
}