3#ifndef poplar_Interval_hpp
4#define poplar_Interval_hpp
8#include <poplar/exceptions.hpp>
32 "," + std::to_string(end) +
")");
35 const T &begin()
const {
return begin_; }
36 const T &end()
const {
return end_; }
42 const T &
lower()
const {
return begin_; }
48 const T &
upper()
const {
return end_; }
54 T
size()
const {
return T(end_ - begin_); }
58inline bool operator==(
const GenericInterval<T> &a,
59 const GenericInterval<T> &b) {
60 return std::tie(a.begin(), a.end()) == std::tie(b.begin(), b.end());
64inline bool operator<(
const GenericInterval<T> &a,
65 const GenericInterval<T> &b) {
66 return std::tie(a.begin(), a.end()) < std::tie(b.begin(), b.end());
70inline bool operator!=(
const GenericInterval<T> &a,
71 const GenericInterval<T> &b) {
76inline bool operator>=(
const GenericInterval<T> &a,
77 const GenericInterval<T> &b) {
82inline bool operator>(
const GenericInterval<T> &a,
83 const GenericInterval<T> &b) {
88inline bool operator<=(
const GenericInterval<T> &a,
89 const GenericInterval<T> &b) {
94inline std::ostream &
operator<<(std::ostream &os,
const GenericInterval<T> &b) {
95 os <<
"[" << b.begin() <<
":" << b.end() <<
")";
99typedef GenericInterval<std::size_t> Interval;
Poplar classes and functions.
Definition: ArrayRef.hpp:14
std::ostream & operator<<(std::ostream &os, const DebugNameAndId &dnai)
Display the path name of the DebugNameAndId.
This class represents an interval that is closed at its lower bound and open at its upper bound.
Definition: Interval.hpp:18
T size() const
Get the size of the interval.
Definition: Interval.hpp:54
const T & upper() const
Get the upper bound of the half open interval.
Definition: Interval.hpp:48
GenericInterval()=default
Initialise with begin and end set to their default value of 0.
const T & lower() const
Get the lower bound of the half open interval.
Definition: Interval.hpp:42
This exception is thrown if the index of a subscript is out of the bounds of the field it is accessin...
Definition: exceptions.hpp:111