add Parameters::Parameter struct

this holds a key-value pair for a parameter with some utility functions
for comparison and printing.

use this to move Parameters::getLists to the translation unit
This commit is contained in:
Arne Morten Kvarving
2024-09-05 10:07:40 +02:00
parent ae8dd62fe3
commit 410039206d
4 changed files with 63 additions and 59 deletions
+1 -30
View File
@@ -41,35 +41,6 @@ struct SimpleParamBoolN2
namespace {
class Setting
{
public:
Setting(const std::string& k, const std::string& v)
: key(k), value(v)
{}
friend std::ostream& operator<<(std::ostream& os, const Setting& setting)
{
os << setting.key << "=" << setting.value << '\n';
return os;
}
bool operator==(const Setting& setting) const
{
return setting.key == key
&& setting.value == value;
}
bool operator !=(const Setting& setting) const
{
return !(*this == setting);
}
private:
std::string key;
std::string value;
};
struct Fixture
{
Fixture()
@@ -117,7 +88,7 @@ BOOST_FIXTURE_TEST_CASE(GetLists, Fixture)
BOOST_CHECK_EQUAL(Opm::Parameters::IsSet<Opm::Parameters::SimpleParamDouble>(), false);
BOOST_CHECK_EQUAL(Opm::Parameters::IsSet<Opm::Parameters::SimpleParamInt>(), false);
using SettingMap = std::vector<Setting>;
using SettingMap = std::vector<Opm::Parameters::Parameter>;
const SettingMap set_ref = {
{"SimpleParamBool", "true"},