rangeset< T > Class Template Reference

#include <rangeset.h>

List of all members.

Public Member Functions

void clear ()
void reserve (tsize n)
tsize nranges () const
const rtype & data () const
const T & ivbegin (tdiff i) const
const T & ivend (tdiff i) const
ivlen (tdiff i) const
void append (const T &v1, const T &v2)
void append (const T &v)
void append (const rangeset &other)
void add (const T &v1, const T &v2)
void add (const T &v)
void remove (const T &v1, const T &v2)
void remove (const T &v)
void intersect (const T &a, const T &b)
nval () const
void toVector (std::vector< T > &res) const
std::vector< T > toVector () const
rangeset op_or (const rangeset &other) const
rangeset op_and (const rangeset &other) const
rangeset op_andnot (const rangeset &other) const
rangeset op_xor (const rangeset &other) const
tdiff findInterval (const T &v) const
bool operator== (const rangeset &other) const
bool contains (T a, T b) const
bool contains (T v) const
bool contains (const rangeset &other) const
bool overlaps (T a, T b) const
bool overlaps (const rangeset &other) const


Detailed Description

template<typename T>
class rangeset< T >

Class for storing sets of ranges of integer numbers

Definition at line 43 of file rangeset.h.


Member Function Documentation

template<typename T>
void rangeset< T >::clear (  )  [inline]

Removes all rangeset entries.

Definition at line 222 of file rangeset.h.

template<typename T>
void rangeset< T >::reserve ( tsize  n  )  [inline]

Reserves space for n ranges.

Definition at line 224 of file rangeset.h.

template<typename T>
tsize rangeset< T >::nranges (  )  const [inline]

Returns the current number of ranges.

Definition at line 226 of file rangeset.h.

template<typename T>
const rtype& rangeset< T >::data (  )  const [inline]

Returns the current vector of ranges.

Definition at line 230 of file rangeset.h.

template<typename T>
const T& rangeset< T >::ivbegin ( tdiff  i  )  const [inline]

Returns the first value of range i.

Definition at line 244 of file rangeset.h.

template<typename T>
const T& rangeset< T >::ivend ( tdiff  i  )  const [inline]

Returns the one-past-last value of range i.

Definition at line 246 of file rangeset.h.

template<typename T>
T rangeset< T >::ivlen ( tdiff  i  )  const [inline]

Returns the length of range i.

Definition at line 248 of file rangeset.h.

template<typename T>
void rangeset< T >::append ( const T &  v1,
const T &  v2 
) [inline]

Appends [v1;v2[ to the rangeset. v1 must be larger than the minimum of the last range in the rangeset.

Definition at line 252 of file rangeset.h.

template<typename T>
void rangeset< T >::append ( const T &  v  )  [inline]

Appends [v;v+1[ to the rangeset. v must be larger than the minimum of the last range in the rangeset.

Definition at line 265 of file rangeset.h.

template<typename T>
void rangeset< T >::append ( const rangeset< T > &  other  )  [inline]

Appends other to the rangeset. All values in other must be larger than the minimum of the last range in the rangeset.

Definition at line 270 of file rangeset.h.

template<typename T>
void rangeset< T >::add ( const T &  v1,
const T &  v2 
) [inline]

After this operation, the rangeset contains the union of itself with [v1;v2[.

Definition at line 278 of file rangeset.h.

template<typename T>
void rangeset< T >::add ( const T &  v  )  [inline]

After this operation, the rangeset contains the union of itself with [v;v+1[.

Definition at line 286 of file rangeset.h.

template<typename T>
void rangeset< T >::remove ( const T &  v1,
const T &  v2 
) [inline]

Removes all values within [v1;v2[ from the rangeset.

Definition at line 289 of file rangeset.h.

template<typename T>
void rangeset< T >::remove ( const T &  v  )  [inline]

Removes the value v from the rangeset.

Definition at line 298 of file rangeset.h.

template<typename T>
void rangeset< T >::intersect ( const T &  a,
const T &  b 
) [inline]

Removes all values not within [a;b[ from the rangeset.

Definition at line 301 of file rangeset.h.

template<typename T>
T rangeset< T >::nval (  )  const [inline]

Returns the total number of elements in the rangeset.

Definition at line 321 of file rangeset.h.

template<typename T>
void rangeset< T >::toVector ( std::vector< T > &  res  )  const [inline]

After this operation, res contains all elements of the rangeset in ascending order.

Definition at line 331 of file rangeset.h.

template<typename T>
std::vector<T> rangeset< T >::toVector (  )  const [inline]

Returns a vector containing all elements of the rangeset in ascending order.

Definition at line 342 of file rangeset.h.

template<typename T>
rangeset rangeset< T >::op_or ( const rangeset< T > &  other  )  const [inline]

Returns the union of this rangeset and other.

Definition at line 350 of file rangeset.h.

template<typename T>
rangeset rangeset< T >::op_and ( const rangeset< T > &  other  )  const [inline]

Returns the intersection of this rangeset and other.

Definition at line 357 of file rangeset.h.

template<typename T>
rangeset rangeset< T >::op_andnot ( const rangeset< T > &  other  )  const [inline]

Returns the part of this rangeset which is not in other.

Definition at line 364 of file rangeset.h.

template<typename T>
rangeset rangeset< T >::op_xor ( const rangeset< T > &  other  )  const [inline]

Returns the parts of this rangeset and other, which are not in both rangesets.

Definition at line 372 of file rangeset.h.

template<typename T>
tdiff rangeset< T >::findInterval ( const T &  v  )  const [inline]

Returns the index of the interval containing v; if no such interval exists, -1 is returned.

Definition at line 381 of file rangeset.h.

template<typename T>
bool rangeset< T >::operator== ( const rangeset< T > &  other  )  const [inline]

Returns true if the rangeset is identical to other, else false.

Definition at line 389 of file rangeset.h.

template<typename T>
bool rangeset< T >::contains ( a,
b 
) const [inline]

Returns true if the rangeset contains all values in the range [a;b[, else false.

Definition at line 394 of file rangeset.h.

template<typename T>
bool rangeset< T >::contains ( v  )  const [inline]

Returns true if the rangeset contains the value v, else false.

Definition at line 402 of file rangeset.h.

template<typename T>
bool rangeset< T >::contains ( const rangeset< T > &  other  )  const [inline]

Returns true if the rangeset contains all values stored in other, else false.

Definition at line 406 of file rangeset.h.

template<typename T>
bool rangeset< T >::overlaps ( a,
b 
) const [inline]

Returns true if any of the numbers [a;b[ are contained in the set, else false.

Definition at line 410 of file rangeset.h.

template<typename T>
bool rangeset< T >::overlaps ( const rangeset< T > &  other  )  const [inline]

Returns true if there is overlap between the set and "other", else false.

Definition at line 419 of file rangeset.h.


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

Generated on Thu Oct 8 14:48:51 2015 for LevelS C++ support library