LevelS C++ support library  3.83
Public Member Functions | Static Public Member Functions | List of all members
crangeset< T > Class Template Reference

#include <crangeset.h>

Public Member Functions

tdiff iiv (const T &val) const
 
void clear ()
 
void append (const T &v1, const T &v2)
 
void append (const T &v)
 
void append (const crangeset &other)
 
nval () const
 
bool operator== (const crangeset &other) const
 
bool contains (T a, T b) const
 
bool contains (T v) const
 
bool contains (const crangeset &other) const
 
bool overlaps (T a, T b) const
 
bool overlaps (const crangeset &other) const
 

Static Public Member Functions

static int strategy (tsize sza, tsize szb)
 

Detailed Description

template<typename T>
class crangeset< T >

Class for storing sets of ranges of integer numbers T must be a signed integer type, but all numbers entered into the range set must be nonnegative!

Definition at line 76 of file crangeset.h.

Member Function Documentation

◆ iiv()

template<typename T>
tdiff crangeset< T >::iiv ( const T &  val) const
inline

Returns the index of the last number in r whose absolute value is <= val If val is smaller than all absolute values in r, returns -1.

Definition at line 214 of file crangeset.h.

◆ strategy()

template<typename T>
static int crangeset< T >::strategy ( tsize  sza,
tsize  szb 
)
inlinestatic

Estimate a good strategy for set operations involving two rangesets.

Definition at line 221 of file crangeset.h.

◆ clear()

template<typename T>
void crangeset< T >::clear ( )
inline

Removes all rangeset entries.

Definition at line 380 of file crangeset.h.

◆ append() [1/3]

template<typename T>
void crangeset< 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 398 of file crangeset.h.

◆ append() [2/3]

template<typename T>
void crangeset< 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 434 of file crangeset.h.

◆ append() [3/3]

template<typename T>
void crangeset< T >::append ( const crangeset< 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 439 of file crangeset.h.

◆ nval()

template<typename T>
T crangeset< T >::nval ( ) const
inline

Returns the total number of elements in the rangeset.

Definition at line 449 of file crangeset.h.

◆ operator==()

template<typename T>
bool crangeset< T >::operator== ( const crangeset< T > &  other) const
inline

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

Definition at line 469 of file crangeset.h.

◆ contains() [1/3]

template<typename T>
bool crangeset< T >::contains ( a,
b 
) const
inline

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

Definition at line 474 of file crangeset.h.

◆ contains() [2/3]

template<typename T>
bool crangeset< T >::contains ( v) const
inline

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

Definition at line 491 of file crangeset.h.

◆ contains() [3/3]

template<typename T>
bool crangeset< T >::contains ( const crangeset< T > &  other) const
inline

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

Definition at line 507 of file crangeset.h.

◆ overlaps() [1/2]

template<typename T>
bool crangeset< 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 512 of file crangeset.h.

◆ overlaps() [2/2]

template<typename T>
bool crangeset< T >::overlaps ( const crangeset< T > &  other) const
inline

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

Definition at line 532 of file crangeset.h.


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

Generated on Wed Nov 13 2024 12:18:16 for LevelS C++ support library