This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GfMultiInterval Class Reference

GfMultiInterval represents a subset of the real number line as an ordered set of non-intersecting GfIntervals. More...

#include <multiInterval.h>

Public Types

typedef std::set< GfIntervalSet
 
typedef Set::const_iterator const_iterator
 
typedef Set::const_iterator iterator
 

Public Member Functions

GF_API bool operator== (const GfMultiInterval &that) const
 
GF_API bool operator!= (const GfMultiInterval &that) const
 
GF_API bool operator< (const GfMultiInterval &that) const
 
GF_API bool operator>= (const GfMultiInterval &that) const
 
GF_API bool operator> (const GfMultiInterval &that) const
 
GF_API bool operator<= (const GfMultiInterval &that) const
 
GF_API size_t Hash () const
 Hash value.
 
void swap (GfMultiInterval &other)
 Swap two multi-intervals.
 
Constructors

Constructs an empty multi-interval.

 GfMultiInterval ()=default
 
GF_API GfMultiInterval (const GfInterval &i)
 Constructs an multi-interval with the single given interval.
 
GF_API GfMultiInterval (const std::vector< GfInterval > &intervals)
 Constructs an multi-interval containing the given input intervals.
 
Accessors
GF_API bool IsEmpty () const
 Returns true if the multi-interval is empty.
 
GF_API size_t GetSize () const
 Returns the number of intervals in the set.
 
GF_API GfInterval GetBounds () const
 Returns an interval bounding the entire multi-interval.
 
GF_API bool Contains (double d) const
 Returns true if the multi-interval contains the given value.
 
GF_API bool Contains (const GfInterval &i) const
 Returns true if the multi-interval contains the given interval.
 
GF_API bool Contains (const GfMultiInterval &s) const
 Returns true if the multi-interval contains all the intervals in the given multi-interval.
 
Mutation
GF_API void Clear ()
 Clear the multi-interval.
 
GF_API void Add (const GfInterval &i)
 Add the given interval to the multi-interval.
 
GF_API void Add (const GfMultiInterval &s)
 Add the given multi-interval to the multi-interval.
 
GF_API void ArithmeticAdd (const GfInterval &i)
 Uses the given interval to extend the multi-interval in the interval arithmetic sense.
 
GF_API void Remove (const GfInterval &i)
 Remove the given interval from this multi-interval.
 
GF_API void Remove (const GfMultiInterval &s)
 Remove the given multi-interval from this multi-interval.
 
GF_API void Intersect (const GfInterval &i)
 
GF_API void Intersect (const GfMultiInterval &s)
 
GF_API GfMultiInterval GetComplement () const
 Return the complement of this set.
 
Iteration

Only const iterators are returned.

To maintain the invariants of the multi-interval, changes must be made via the public mutation API.

GF_API const_iterator begin () const
 
GF_API const_iterator end () const
 
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 upper_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 (lowest) interval whose minimum value is > x.
 
GF_API const_iterator GetPriorNonContainingInterval (double x) const
 Returns an iterator identifying the last (highest) interval whose maximum value is < x.
 
GF_API const_iterator GetContainingInterval (double x) const
 Returns an iterator identifying the interval that contains x.
 

Static Public Member Functions

static GfMultiInterval GetFullInterval ()
 Returns the full interval (-inf, inf).
 

Friends

size_t hash_value (const GfMultiInterval &mi)
 

Detailed Description

GfMultiInterval represents a subset of the real number line as an ordered set of non-intersecting GfIntervals.

Definition at line 29 of file multiInterval.h.

Member Typedef Documentation

◆ const_iterator

typedef Set::const_iterator const_iterator

Definition at line 33 of file multiInterval.h.

◆ iterator

typedef Set::const_iterator iterator

Definition at line 34 of file multiInterval.h.

◆ Set

typedef std::set<GfInterval> Set

Definition at line 32 of file multiInterval.h.

Constructor & Destructor Documentation

◆ GfMultiInterval() [1/2]

GF_API GfMultiInterval ( const GfInterval i)
explicit

Constructs an multi-interval with the single given interval.

◆ GfMultiInterval() [2/2]

GF_API GfMultiInterval ( const std::vector< GfInterval > &  intervals)
explicit

Constructs an multi-interval containing the given input intervals.

Member Function Documentation

◆ Add() [1/2]

GF_API void Add ( const GfInterval i)

Add the given interval to the multi-interval.

◆ Add() [2/2]

GF_API void Add ( const GfMultiInterval s)

Add the given multi-interval to the multi-interval.

Sets this object to the union of the two sets.

◆ ArithmeticAdd()

GF_API void ArithmeticAdd ( const GfInterval i)

Uses the given interval to extend the multi-interval in the interval arithmetic sense.

◆ begin()

GF_API const_iterator begin ( ) const
inline

Definition at line 121 of file multiInterval.h.

◆ Clear()

GF_API void Clear ( )
inline

Clear the multi-interval.

Definition at line 91 of file multiInterval.h.

◆ Contains() [1/3]

GF_API bool Contains ( const GfInterval i) const

Returns true if the multi-interval contains the given interval.

◆ Contains() [2/3]

GF_API bool Contains ( const GfMultiInterval s) const

Returns true if the multi-interval contains all the intervals in the given multi-interval.

◆ Contains() [3/3]

GF_API bool Contains ( double  d) const

Returns true if the multi-interval contains the given value.

◆ end()

GF_API const_iterator end ( ) const
inline

Definition at line 122 of file multiInterval.h.

◆ GetBounds()

GF_API GfInterval GetBounds ( ) const

Returns an interval bounding the entire multi-interval.

Returns an empty interval if the multi-interval is empty.

◆ GetComplement()

GF_API GfMultiInterval GetComplement ( ) const

Return the complement of this set.

◆ GetContainingInterval()

GF_API const_iterator GetContainingInterval ( double  x) const

Returns an iterator identifying the interval that contains x.

If no interval contains x, then it returns end()

◆ GetFullInterval()

static GfMultiInterval GetFullInterval ( )
inlinestatic

Returns the full interval (-inf, inf).

Definition at line 147 of file multiInterval.h.

◆ GetNextNonContainingInterval()

GF_API const_iterator GetNextNonContainingInterval ( double  x) const

Returns an iterator identifying the first (lowest) interval whose minimum value is > x.

If no such interval exists, returns end().

◆ GetPriorNonContainingInterval()

GF_API const_iterator GetPriorNonContainingInterval ( double  x) const

Returns an iterator identifying the last (highest) interval whose maximum value is < x.

If no such interval exists, returns end().

◆ GetSize()

GF_API size_t GetSize ( ) const
inline

Returns the number of intervals in the set.

Definition at line 69 of file multiInterval.h.

◆ Hash()

GF_API size_t Hash ( ) const

Hash value.

Just a basic hash function, not particularly high quality.

◆ IsEmpty()

GF_API bool IsEmpty ( ) const
inline

Returns true if the multi-interval is empty.

Definition at line 66 of file multiInterval.h.

◆ lower_bound()

GF_API const_iterator lower_bound ( double  x) const

Returns an iterator identifying the first (lowest) interval whose minimum value is >= x.

If no such interval exists, returns end().

◆ operator!=()

GF_API bool operator!= ( const GfMultiInterval that) const
inline

Definition at line 47 of file multiInterval.h.

◆ operator<()

GF_API bool operator< ( const GfMultiInterval that) const
inline

Definition at line 48 of file multiInterval.h.

◆ operator<=()

GF_API bool operator<= ( const GfMultiInterval that) const
inline

Definition at line 51 of file multiInterval.h.

◆ operator==()

GF_API bool operator== ( const GfMultiInterval that) const
inline

Definition at line 46 of file multiInterval.h.

◆ operator>()

GF_API bool operator> ( const GfMultiInterval that) const
inline

Definition at line 50 of file multiInterval.h.

◆ operator>=()

GF_API bool operator>= ( const GfMultiInterval that) const
inline

Definition at line 49 of file multiInterval.h.

◆ Remove() [1/2]

GF_API void Remove ( const GfInterval i)

Remove the given interval from this multi-interval.

◆ Remove() [2/2]

GF_API void Remove ( const GfMultiInterval s)

Remove the given multi-interval from this multi-interval.

◆ swap()

void swap ( GfMultiInterval other)
inline

Swap two multi-intervals.

Definition at line 152 of file multiInterval.h.

◆ upper_bound()

GF_API const_iterator upper_bound ( double  x) const

Returns an iterator identifying the first (lowest) interval whose minimum value is > x.

If no such interval exists, returns end().

Friends And Related Function Documentation

◆ hash_value

size_t hash_value ( const GfMultiInterval mi)
friend

Definition at line 58 of file multiInterval.h.


The documentation for this class was generated from the following file: