class ov::Interval¶
Overview¶
#include <interval.hpp>
class Interval
{
public:
// typedefs
typedef std::int64_t value_type;
typedef std::uint64_t size_type;
// fields
static constexpr value_type s_max {std::numeric_limits<value_type>::max()};
// construction
Interval();
Interval();
Interval(, );
Interval();
// methods
Interval&const Interval& operator = ();
size_type size() const;
bool empty() const;
value_type get_min_val() const;
voidvalue_type set_min_val();
value_type get_max_val() const;
voidvalue_type set_max_val();
bool has_upper_bound() const;
boolconst Interval& operator == () const;
boolconst Interval& operator != () const;
Intervalconst Interval& operator + () const;
Interval&const Interval& operator += ();
Intervalconst Interval& operator - () const;
Interval&const Interval& operator -= ();
Intervalconst Interval& operator\* () const;
Interval&const Interval& operator\*= ();
Intervalconst Interval& operator & () const;
Interval&const Interval& operator &= ();
boolvalue_type contains() const;
boolconst Interval& contains() const;
};
Detailed Documentation¶
Interval arithmetic.
An interval is the set of integers from m_min_val through m_max_val. The value s_max acts like infinity. The addition, subtraction, or multiplication of intervals is the smallest interval containing the sums, differences, or products of elements of the two intervals. An empty interval is canonicalized to [s_max, s_max].
Fields¶
static constexpr value_type s_max {std::numeric_limits<value_type>::max()}
The value used for no upper bound.
Construction¶
Interval()
Interval of everything.
Interval()
Copy constructor.
Interval(, )
Closed interval {x|min_val <= x <= max_val}.
Interval()
Single-valued interval; just contains val.
Methods¶
size_type size() const
The number of elements in the interval. Zero if max < min.
bool empty() const
Returns true if the interval has no elements.
value_type get_min_val() const
the inclusive lower bound of the interval
voidvalue_type set_min_val()
Set the inclusive lower bound of the interval.
value_type get_max_val() const
the inclusive upper bound of the interval
voidvalue_type set_max_val()
Set the inclusive upper bound of the interval.
bool has_upper_bound() const
True if the upper bound is finite.
boolconst Interval& operator == () const
True if min and max bounds match.
Intervalconst Interval& operator + () const
The interval whose elements are a sum of an element from each interval.
Interval&const Interval& operator += ()
Extend this interval to sums of elements in this interval and interval.
Intervalconst Interval& operator - () const
The interval whose elements are a difference of an element from each interval.
Interval&const Interval& operator -= ()
Extend this interval to differences of elements in this interval and interval.
Intervalconst Interval& operator\* () const
The smallest interval whose elements are a product of an element from each interval.
Interval&const Interval& operator\*= ()
Extend this interval to products of elements in this interval and interval.
Intervalconst Interval& operator & () const
The interval that is the intersection of this interval and interval.
Interval&const Interval& operator &= ()
Change this interval to only include elements also in interval.
boolvalue_type contains() const
True if this interval includes value.
boolconst Interval& contains() const
True if this interval includes all the values in interval.