OERange¶
class OERange
The OERange class is used to represent numerical intervals that may be bounded or unbounded.
Constructors¶
OERange()
The default constructor initializes an empty (and invalid) range object.
OERange(const OERange &rhs)
Copy constructor.
OERange(double low, double high, const std::string &inclusivity="[]")
Constructs a range between low and high, with the provided inclusivity.
- low
The low value of the range. For an unbounded interval, -std::numeric_limits<double>::infinity() can be specified.
- high
The high value of the range. For an unbounded interval, std::numeric_limits<double>::infinity() can be specified.
- inclusivity
Represents the inclusivity of low and high in the range. Allowed values are
inclusivity
Range value
“[]”
[low, high] or low <= x <= high
“(]”
(low, high] or low < x <= high
“[)”
[low, high) or low <= x < high
“()”
(low, high) or low < x < high
operator==¶
bool operator==(const OERange &rhs) const
Returns true if the lower, upper, and inclusivity values are all equal between the two OERange values.
GetLow¶
double GetLow() const
Returns the lower value of the range. This will return -std::numeric_limits<double>::infinity() if the range is unbounded at the low end.
GetHigh¶
double GetHigh() const
Returns the upper value of the range. This will return std::numeric_limits<double>::infinity() if the range is unbounded at the high end.
GetInclusivityString¶
std::string GetInclusivityString() const
Returns one of the four strings, “[]”, “(]”, “[)”, or “()” representing the inclusivity of the range.
IsUnboundedLow¶
bool IsUnboundedLow() const
Returns true if this OERange object has -infinity as a lower value.
IsUnboundedHigh¶
bool IsUnboundedHigh() const
Returns true if this OERange object has infinity as an upper value.