KrisLibrary
1.0.0
|
A set of 2d indices within a range. Operates in two modes, set or bit matrix mode. In bit-matrix mode, allows O(1) membership testing (but the range is fixed). Set mode is just like a regular set. More...
#include <RangeSet2D.h>
Public Types | |
typedef set< IntPair >::iterator | iterator |
typedef set< IntPair >::const_iterator | const_iterator |
Public Member Functions | |
void | clear () |
bool | empty () |
void | setRange (const IntPair &indexmin, const IntPair &indexmax) |
void | expandRange (const IntPair &index) |
void | insert (const IntPair &index) |
template<class It > | |
void | insert (It first, It last) |
void | erase (iterator it) |
void | erase (const IntPair &item) |
template<class It > | |
void | erase (It first, It last) |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
size_t | size () const |
int | count (const IntPair &item) |
iterator | find (const IntPair &item) |
const_iterator | find (const IntPair &item) const |
bool | isRangeEmpty () const |
const IntPair & | minimum () const |
const IntPair & | maximum () const |
bool | inRange (const IntPair &item) const |
bool | cacheGet (const IntPair &item) const |
void | cacheSet (const IntPair &item, bool value) |
void | BuildCache () |
void | ClearCache () |
bool | IsCacheBuilt () const |
A set of 2d indices within a range. Operates in two modes, set or bit matrix mode. In bit-matrix mode, allows O(1) membership testing (but the range is fixed). Set mode is just like a regular set.
If you need to do n membership tests, the best mode to use can be given by choosing the minimum cost: c(set mode) = n*log(n)*c(set query constant) c(vector mode) = n*c(vector query time) + c(malloc time for SIZE bits)