mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-08-03 04:00:16 -05:00
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:
@@ -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"},
|
||||
|
||||
Reference in New Issue
Block a user