32 const scalarRange::rangeTypes
type,
67 else if (
equal(minVal, maxVal))
69 type_ = rangeTypes::EQ;
105 return scalarRange(rangeTypes::LE, -GREAT, maxVal);
111 return scalarRange(rangeTypes::LT, -GREAT, maxVal);
128 type_ = rangeTypes::NONE;
134 return (type_ == rangeTypes::NONE);
140 return (type_ != rangeTypes::NONE);
146 return (type_ == rangeTypes::EQ);
163 case rangeTypes::GE_LE:
165 return (0.5 * min_) + (0.5 * max_);
177 case rangeTypes::EQ:
return equal(val, min_);
178 case rangeTypes::GE:
return (val >= min_);
179 case rangeTypes::GT:
return (val > min_);
180 case rangeTypes::LE:
return (val <= max_);
181 case rangeTypes::LT:
return (val < max_);
182 case rangeTypes::GE_LE:
return (val >= min_ && val <= max_);
183 case rangeTypes::ALWAYS:
return true;
184 default:
return false;
191 inline constexpr
bool 194 return (type_ == rhs.type_ && min_ == rhs.min_ && max_ == rhs.max_);
198 inline constexpr
bool 201 return !(*
this == rhs);
constexpr scalarRange() noexcept
Construct an empty (inverse, NONE) range - never matches.
bool equal(const T &a, const T &b)
Compare two values for equality.
static constexpr scalarRange gt0() noexcept
A greater-than zero bound.
bool contains(const scalar val) const
True if the value is matched by the condition.
void reset() noexcept
Reset to an empty (inverse, NONE) range.
bool good() const noexcept
True if range is non-empty.
static constexpr scalarRange zero_one() noexcept
A greater-equals 0, less-equals 1 bound.
static constexpr scalarRange ge(const scalar minVal) noexcept
A greater-equals bound.
static constexpr scalarRange ge0() noexcept
A greater-equals zero bound.
static constexpr scalarRange gt(const scalar minVal) noexcept
A greater-than bound.
constexpr bool operator!=(const scalarRange &rhs) const noexcept
bool empty() const noexcept
True if range is empty (eg, inverted, NONE)
static constexpr scalarRange le(const scalar maxVal) noexcept
A less-equals bound.
scalar value() const
A representative (average) value for the range.
constexpr bool operator==(const scalarRange &rhs) const noexcept
static constexpr scalarRange lt(const scalar maxVal) noexcept
A less-than bound.
bool single() const noexcept
True if the range bounds represent a single value.
Scalar bounds to be used as a unary predicate.