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::ranges::binary_search(*
this, elem);
162 bool hasElementUnsorted(
const T& elem)
const
164 return std::ranges::find(*
this, elem) != this->
end();
222 bool hasWell(
const std::string& well)
const;
240 std::unique_ptr<Impl> pImpl_;
248 void addWell(
const std::string& well);
256 void addWells(
const std::vector<std::string>&
wells);
287 explicit Result(
bool result_arg);
384 std::unique_ptr<Impl> pImpl_;
Implementation of Action::Result.
Definition ActionResult.cpp:566
Implementation of Result::MatchingEntities.
Definition ActionResult.cpp:349
Container of matching entities.
Definition ActionResult.hpp:173
bool operator==(const MatchingEntities &that) const
Equality predicate.
Definition ActionResult.cpp:531
MatchingEntities()
Default constructor.
Definition ActionResult.cpp:491
bool hasWell(const std::string &well) const
Whether or not named well is in the list of matching entities.
Definition ActionResult.cpp:526
ValueRange< std::string > wells() const
Assignment operator.
Definition ActionResult.cpp:521
~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:690
bool operator==(const Result &that) const
Equality predicate.
Definition ActionResult.cpp:721
Result & makeSetUnion(const Result &rhs)
Incorporate another result set into the current set as if by set union.
Definition ActionResult.cpp:702
Result(bool result_arg)
Constructor.
Definition ActionResult.cpp:661
const MatchingEntities & matches() const
Retrieve set of matching entities.
Definition ActionResult.cpp:716
Result & makeSetIntersection(const Result &rhs)
Incorporate another result set into the current set as if by set intersection.
Definition ActionResult.cpp:709
bool conditionSatisfied() const
Predicate for whether or not the result set represents a 'true' value.
Definition ActionResult.cpp:696