32 const scalarRange::testType
type,
67 else if (
equal(minVal, maxVal))
69 type_ = scalarRange::EQ;
105 return scalarRange(scalarRange::LE, -GREAT, maxVal);
111 return scalarRange(scalarRange::LT, -GREAT, maxVal);
128 type_ = scalarRange::NONE;
134 return type_ == scalarRange::NONE;
140 return type_ != scalarRange::NONE;
146 return type_ == scalarRange::EQ;
154 case scalarRange::EQ:
155 case scalarRange::GE:
156 case scalarRange::GT:
159 case scalarRange::LE:
160 case scalarRange::LT:
163 case scalarRange::GE_LE:
165 return (0.5 * min_) + (0.5 * max_);
177 case scalarRange::EQ:
return equal(val, min_);
178 case scalarRange::GE:
return (val >= min_);
179 case scalarRange::GT:
return (val > min_);
180 case scalarRange::LE:
return (val <= max_);
181 case scalarRange::LT:
return (val < max_);
182 case scalarRange::GE_LE:
return (val >= min_ && val <= max_);
183 case scalarRange::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.
bool good() const noexcept
True if range is non-empty.
void clear() noexcept
Reset to an empty (inverse, NONE) range.
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.