make WList constructible from variables

also make it default constructible, add accessors
and equality operator
This commit is contained in:
Arne Morten Kvarving
2019-12-12 11:21:56 +01:00
parent af477900b9
commit 12f87578d6
2 changed files with 19 additions and 0 deletions

View File

@@ -26,14 +26,20 @@ namespace Opm {
class WList {
public:
using storage = std::unordered_set<std::string>;
WList() = default;
WList(const storage& wlist);
std::size_t size() const;
void add(const std::string& well);
void del(const std::string& well);
bool has(const std::string& well) const;
std::vector<std::string> wells() const;
const storage& wellList() const;
storage::const_iterator begin() const;
storage::const_iterator end() const;
bool operator==(const WList& data) const;
private:
storage well_list;
};

View File

@@ -21,6 +21,11 @@
namespace Opm {
WList::WList(const storage& wlist) :
well_list(wlist)
{
}
std::size_t WList::size() const {
return this->well_list.size();
@@ -51,4 +56,12 @@ WList::storage::const_iterator WList::end() const {
return this->well_list.end();
}
const WList::storage& WList::wellList() const {
return this->well_list;
}
bool WList::operator==(const WList& data) const {
return this->wellList() == data.wellList();
}
}