HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GfMultiInterval Class Reference

#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
 
void swap (GfMultiInterval &other)
 Swap two multi-intervals. More...
 
Constructors

Constructs an empty multi-interval.

 GfMultiInterval ()=default
 Constructs an multi-interval with the single given interval. More...
 
GF_API GfMultiInterval (const GfInterval &i)
 Constructs an multi-interval with the single given interval. More...
 
GF_API GfMultiInterval (const std::vector< GfInterval > &intervals)
 Constructs an multi-interval containing the given input intervals. More...
 
Accessors
GF_API bool IsEmpty () const
 Returns true if the multi-interval is empty. More...
 
GF_API size_t GetSize () const
 Returns the number of intervals in the set. More...
 
GF_API GfInterval GetBounds () const
 
GF_API bool Contains (double d) const
 Returns true if the multi-interval contains the given value. More...
 
GF_API bool Contains (const GfInterval &i) const
 Returns true if the multi-interval contains the given interval. More...
 
GF_API bool Contains (const GfMultiInterval &s) const
 
Mutation
GF_API void Clear ()
 Clear the multi-interval. More...
 
GF_API void Add (const GfInterval &i)
 Add the given interval to the multi-interval. More...
 
GF_API void Add (const GfMultiInterval &s)
 
GF_API void ArithmeticAdd (const GfInterval &i)
 
GF_API void Remove (const GfInterval &i)
 Remove the given interval from this multi-interval. More...
 
GF_API void Remove (const GfMultiInterval &s)
 Remove the given multi-interval from this multi-interval. More...
 
GF_API void Intersect (const GfInterval &i)
 Clear the multi-interval. More...
 
GF_API void Intersect (const GfMultiInterval &s)
 Clear the multi-interval. More...
 
GF_API GfMultiInterval GetComplement () const
 Return the complement of this set. More...
 
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
 
GF_API const_iterator upper_bound (double x) const
 
GF_API const_iterator GetNextNonContainingInterval (double x) const
 
GF_API const_iterator GetPriorNonContainingInterval (double x) const
 
GF_API const_iterator GetContainingInterval (double x) const
 

Static Public Member Functions

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

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 46 of file multiInterval.h.

Member Typedef Documentation

typedef Set::const_iterator GfMultiInterval::const_iterator

Definition at line 50 of file multiInterval.h.

typedef Set::const_iterator GfMultiInterval::iterator

Definition at line 51 of file multiInterval.h.

typedef std::set<GfInterval> GfMultiInterval::Set

Definition at line 49 of file multiInterval.h.

Constructor & Destructor Documentation

GfMultiInterval::GfMultiInterval ( )
default

Constructs an multi-interval with the single given interval.

GF_API GfMultiInterval::GfMultiInterval ( const GfInterval i)
explicit

Constructs an multi-interval with the single given interval.

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

Constructs an multi-interval containing the given input intervals.

Member Function Documentation

GF_API void GfMultiInterval::Add ( const GfInterval i)

Add the given interval to the multi-interval.

GF_API void GfMultiInterval::Add ( const GfMultiInterval s)

Add the given multi-interval to the multi-interval. Sets this object to the union of the two sets.

GF_API void GfMultiInterval::ArithmeticAdd ( const GfInterval i)

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

GF_API const_iterator GfMultiInterval::begin ( void  ) const
inline

Returns an iterator identifying the first (lowest) interval whose minimum value is >= x. If no such interval exists, returns end().

Definition at line 138 of file multiInterval.h.

GF_API void GfMultiInterval::Clear ( )
inline

Clear the multi-interval.

Definition at line 108 of file multiInterval.h.

GF_API bool GfMultiInterval::Contains ( double  d) const

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

GF_API bool GfMultiInterval::Contains ( const GfInterval i) const

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

GF_API bool GfMultiInterval::Contains ( const GfMultiInterval s) const

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

GF_API const_iterator GfMultiInterval::end ( void  ) const
inline

Returns an iterator identifying the first (lowest) interval whose minimum value is >= x. If no such interval exists, returns end().

Definition at line 139 of file multiInterval.h.

GF_API GfInterval GfMultiInterval::GetBounds ( ) const

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

GF_API GfMultiInterval GfMultiInterval::GetComplement ( ) const

Return the complement of this set.

GF_API const_iterator GfMultiInterval::GetContainingInterval ( double  x) const

Returns an iterator identifying the interval that contains x. If no interval contains x, then it returns end()

static GfMultiInterval GfMultiInterval::GetFullInterval ( )
inlinestatic

Returns the full interval (-inf, inf).

Definition at line 164 of file multiInterval.h.

GF_API const_iterator GfMultiInterval::GetNextNonContainingInterval ( double  x) const

Returns an iterator identifying the first (lowest) interval whose minimum value is > x. If no such interval exists, returns end().

GF_API const_iterator GfMultiInterval::GetPriorNonContainingInterval ( double  x) const

Returns an iterator identifying the last (highest) interval whose maximum value is < x. If no such interval exists, returns end().

GF_API size_t GfMultiInterval::GetSize ( ) const
inline

Returns the number of intervals in the set.

Definition at line 86 of file multiInterval.h.

GF_API size_t GfMultiInterval::Hash ( ) const

Hash value. Just a basic hash function, not particularly high quality.

GF_API void GfMultiInterval::Intersect ( const GfInterval i)

Clear the multi-interval.

GF_API void GfMultiInterval::Intersect ( const GfMultiInterval s)

Clear the multi-interval.

GF_API bool GfMultiInterval::IsEmpty ( ) const
inline

Returns true if the multi-interval is empty.

Definition at line 83 of file multiInterval.h.

GF_API const_iterator GfMultiInterval::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().

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

Definition at line 64 of file multiInterval.h.

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

Definition at line 65 of file multiInterval.h.

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

Definition at line 68 of file multiInterval.h.

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

Definition at line 63 of file multiInterval.h.

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

Definition at line 67 of file multiInterval.h.

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

Definition at line 66 of file multiInterval.h.

GF_API void GfMultiInterval::Remove ( const GfInterval i)

Remove the given interval from this multi-interval.

GF_API void GfMultiInterval::Remove ( const GfMultiInterval s)

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

void GfMultiInterval::swap ( GfMultiInterval other)
inline

Swap two multi-intervals.

Definition at line 169 of file multiInterval.h.

GF_API const_iterator GfMultiInterval::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

size_t hash_value ( const GfMultiInterval mi)
friend

Definition at line 75 of file multiInterval.h.


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