RangeSet< TBoundary > Class Template Reference

A set containing a union of [start,end) ranges that are automatically sorted and merged when possible. More...

Collaboration diagram for RangeSet< TBoundary >:
[legend]

List of all members.

Public Types

typedef TBoundary Boundary
typedef TBoundary Boundary

Public Member Functions

void Init ()
 Creates an empty set of ranges.
void Init ()
 Creates an empty set of ranges.
const Range & operator[] (index_t i) const
 Gets a constant range element.
const Range & operator[] (index_t i) const
 Gets a constant range element.
const ArrayList< Range > & ranges () const
const ArrayList< Range > & ranges () const
void Reset ()
 Reinitializes to an empty set of ranges.
void Reset ()
 Reinitializes to an empty set of ranges.
index_t size () const
 Gets the number of discrete ranges.
index_t size () const
 Gets the number of discrete ranges.
void Union (const Boundary &begin, const Boundary &end)
 Unions this with a particular range.
void Union (const Boundary &begin, const Boundary &end)
 Unions this with a particular range.

Detailed Description

template<typename TBoundary>
class RangeSet< TBoundary >

A set containing a union of [start,end) ranges that are automatically sorted and merged when possible.

The copy constructor and inequality operators must be defined of the template class.

This is O(N) insertion, so not efficient for large sets.

Definition at line 54 of file rangeset.h.


Member Function Documentation

template<typename TBoundary >
void RangeSet< TBoundary >::Init (  )  [inline]

Creates an empty set of ranges.

Definition at line 80 of file rangeset.h.

References ArrayList< TElem >::Init().

template<typename TBoundary >
void RangeSet< TBoundary >::Init (  )  [inline]

Creates an empty set of ranges.

Definition at line 80 of file rangeset.h.

References ArrayList< TElem >::Init().

template<typename TBoundary >
const Range& RangeSet< TBoundary >::operator[] ( index_t  i  )  const [inline]

Gets a constant range element.

Definition at line 105 of file rangeset.h.

template<typename TBoundary >
const Range& RangeSet< TBoundary >::operator[] ( index_t  i  )  const [inline]

Gets a constant range element.

Definition at line 105 of file rangeset.h.

template<typename TBoundary >
void RangeSet< TBoundary >::Reset (  )  [inline]

Reinitializes to an empty set of ranges.

Definition at line 87 of file rangeset.h.

References ArrayList< TElem >::Clear().

template<typename TBoundary >
void RangeSet< TBoundary >::Reset (  )  [inline]

Reinitializes to an empty set of ranges.

Definition at line 87 of file rangeset.h.

References ArrayList< TElem >::Clear().

template<typename TBoundary >
index_t RangeSet< TBoundary >::size (  )  const [inline]

Gets the number of discrete ranges.

Definition at line 112 of file rangeset.h.

References ArrayList< TElem >::size().

template<typename TBoundary >
index_t RangeSet< TBoundary >::size (  )  const [inline]

Gets the number of discrete ranges.

Definition at line 112 of file rangeset.h.

References ArrayList< TElem >::size().

template<typename TBoundary >
void RangeSet< TBoundary >::Union ( const Boundary &  begin,
const Boundary &  end 
)

Unions this with a particular range.

This will automatically merge with any surrounding ranges.

template<typename TBoundary >
void RangeSet< TBoundary >::Union ( const Boundary &  begin,
const Boundary &  end 
) [inline]

Unions this with a particular range.

This will automatically merge with any surrounding ranges.

Definition at line 119 of file rangeset.h.

References ArrayList< TElem >::begin(), ArrayList< TElem >::end(), ArrayList< TElem >::Init(), ArrayList< TElem >::PushBackCopy(), ArrayList< TElem >::PushBackRaw(), ArrayList< TElem >::size(), and ArrayList< TElem >::Swap().


The documentation for this class was generated from the following files:
Generated on Mon Jan 24 12:04:40 2011 for FASTlib by  doxygen 1.6.3