24 #ifndef PXR_BASE_GF_MULTI_INTERVAL_H 25 #define PXR_BASE_GF_MULTI_INTERVAL_H 32 #include "pxr/base/gf/api.h" 38 PXR_NAMESPACE_OPEN_SCOPE
49 typedef std::set<GfInterval> Set;
50 typedef Set::const_iterator const_iterator;
51 typedef Set::const_iterator iterator;
60 GF_API
explicit GfMultiInterval(
const std::vector<GfInterval> &intervals);
63 GF_API
bool operator==(
const GfMultiInterval &that)
const {
return _set == that._set; }
64 GF_API
bool operator!=(
const GfMultiInterval &that)
const {
return !(*
this == that); }
65 GF_API
bool operator<(
const GfMultiInterval &that)
const {
return _set < that._set; }
66 GF_API
bool operator>=(
const GfMultiInterval &that)
const {
return !(*
this < that); }
67 GF_API
bool operator>(
const GfMultiInterval &that)
const {
return (that < *
this); }
68 GF_API
bool operator<=(
const GfMultiInterval &that)
const {
return !(that < *
this); }
73 GF_API
size_t Hash()
const;
83 GF_API
bool IsEmpty()
const {
return _set.empty(); }
86 GF_API
size_t GetSize()
const {
return _set.size(); }
93 GF_API
bool Contains(
double d)
const;
108 GF_API
void Clear() { _set.clear(); }
125 GF_API
void Intersect(
const GfInterval & i );
138 GF_API const_iterator begin()
const {
return _set.begin(); }
139 GF_API const_iterator end()
const {
return _set.end(); }
143 GF_API const_iterator
lower_bound(
double x )
const;
147 GF_API const_iterator
upper_bound(
double x )
const;
172 void _AssertInvariants()
const;
181 PXR_NAMESPACE_CLOSE_SCOPE
183 #endif // PXR_BASE_GF_MULTI_INTERVAL_H void swap(GfMultiInterval &other)
Swap two multi-intervals.
GF_API const_iterator upper_bound(double x) const
Returns an iterator identifying the first (lowest) interval whose minimum value is > x.
GF_API void Remove(const GfInterval &i)
Remove the given interval from this multi-interval.
GF_API const_iterator GetPriorNonContainingInterval(double x) const
Returns an iterator identifying the last (highest) interval whose maximum value is < x.
GF_API void ArithmeticAdd(const GfInterval &i)
Uses the given interval to extend the multi-interval in the interval arithmetic sense.
GF_API size_t GetSize() const
Returns the number of intervals in the set.
GF_API void Add(const GfInterval &i)
Add the given interval to the multi-interval.
GF_API GfInterval GetBounds() const
Returns an interval bounding the entire multi-interval.
GF_API size_t Hash() const
Hash value.
static GfMultiInterval GetFullInterval()
Returns the full interval (-inf, inf).
A basic mathematical interval class.
static GfInterval GetFullInterval()
Returns the full interval (-inf, inf).
GF_API const_iterator lower_bound(double x) const
Returns an iterator identifying the first (lowest) interval whose minimum value is >= x.
GF_API const_iterator GetNextNonContainingInterval(double x) const
Returns an iterator identifying the first (loest) interval whose minimum value is > x.
GF_API bool Contains(double d) const
Returns true if the multi-interval contains the given value.
GfMultiInterval represents a subset of the real number line as an ordered set of non-intersecting GfI...
GF_API bool IsEmpty() const
Returns true if the multi-interval is empty.
GF_API void Clear()
Clear the multi-interval.
GF_API GfMultiInterval GetComplement() const
Return the complement of this set.
GF_API const_iterator GetContainingInterval(double x) const
Returns an iterator identifying the interval that contains x.
GF_API std::ostream & operator<<(std::ostream &out, const GfMultiInterval &s)
Output a GfMultiInterval.