20#ifndef ACTION_RESULT_HPP
21#define ACTION_RESULT_HPP
28namespace Opm::Action {
86 using RandIt =
typename std::vector<T>::const_iterator;
102 , isSorted_ { isSorted }
106 auto begin()
const {
return this->first_; }
109 auto end()
const {
return this->last_; }
115 auto size()
const {
return std::distance(this->
begin(), this->
end()); }
122 return { this->
begin(), this->
end() };
132 return this->isSorted_
133 ? this->hasElementSorted(elem)
134 : this->hasElementUnsorted(elem);
145 bool isSorted_{
false};
152 bool hasElementSorted(
const T& elem)
const
154 return std::binary_search(this->
begin(), this->
end(), elem);
162 bool hasElementUnsorted(
const T& elem)
const
164 return std::find(this->
begin(), this->
end(), elem)
223 bool hasWell(
const std::string& well)
const;
241 std::unique_ptr<Impl> pImpl_;
249 void addWell(
const std::string& well);
257 void addWells(
const std::vector<std::string>&
wells);
288 explicit Result(
bool result_arg);
385 std::unique_ptr<Impl> pImpl_;
Implementation of Action::Result.
Definition ActionResult.cpp:571
Implementation of Result::MatchingEntities.
Definition ActionResult.cpp:354
Container of matching entities.
Definition ActionResult.hpp:174
bool operator==(const MatchingEntities &that) const
Equality predicate.
Definition ActionResult.cpp:536
MatchingEntities()
Default constructor.
Definition ActionResult.cpp:496
bool hasWell(const std::string &well) const
Whether or not named well is in the list of matching entities.
Definition ActionResult.cpp:531
ValueRange< std::string > wells() const
Assignment operator.
Definition ActionResult.cpp:526
~MatchingEntities()
Destructor.
Random access range of values.
Definition ActionResult.hpp:80
typename std::vector< T >::const_iterator RandIt
Random access iterator.
Definition ActionResult.hpp:86
auto begin() const
Beginning of value range's elements.
Definition ActionResult.hpp:106
bool hasElement(const T &elem) const
Element existence predicate.
Definition ActionResult.hpp:130
auto empty() const
Predicate for an empty value range.
Definition ActionResult.hpp:112
ValueRange(RandIt first, RandIt last, bool isSorted=false)
Constructor.
Definition ActionResult.hpp:99
auto size() const
Number of elements in the value range.
Definition ActionResult.hpp:115
std::vector< T > asVector() const
Convert value range to a std::vector.
Definition ActionResult.hpp:120
auto end() const
End of value range's elements.
Definition ActionResult.hpp:109
Result & wells(const std::vector< std::string > &w)
Assignment operator.
Definition ActionResult.cpp:695
bool operator==(const Result &that) const
Equality predicate.
Definition ActionResult.cpp:726
Result & makeSetUnion(const Result &rhs)
Incorporate another result set into the current set as if by set union.
Definition ActionResult.cpp:707
Result(bool result_arg)
Constructor.
Definition ActionResult.cpp:666
const MatchingEntities & matches() const
Retrieve set of matching entities.
Definition ActionResult.cpp:721
Result & makeSetIntersection(const Result &rhs)
Incorporate another result set into the current set as if by set intersection.
Definition ActionResult.cpp:714
bool conditionSatisfied() const
Predicate for whether or not the result set represents a 'true' value.
Definition ActionResult.cpp:701