X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=incbwt%2Fbits%2Fdeltavector.h;fp=incbwt%2Fbits%2Fdeltavector.h;h=e0692d6767cab9eef375554e9d8ef234931653fb;hb=40ddf9aca842bdc081b6350a4ebfe36b066c94c9;hp=0000000000000000000000000000000000000000;hpb=af8938dbee21244687184dd0502a84ce1af70c50;p=SXSI%2FTextCollection.git diff --git a/incbwt/bits/deltavector.h b/incbwt/bits/deltavector.h new file mode 100644 index 0000000..e0692d6 --- /dev/null +++ b/incbwt/bits/deltavector.h @@ -0,0 +1,62 @@ +#ifndef DELTAVECTOR_H +#define DELTAVECTOR_H + +#include + +#include "bitvector.h" + + +namespace CSA +{ + + +/* + This class is used to construct a DeltaVector. +*/ + +class DeltaEncoder : public VectorEncoder +{ + public: + DeltaEncoder(usint block_bytes, usint superblock_size = VectorEncoder::SUPERBLOCK_SIZE); + ~DeltaEncoder(); + + void setBit(usint value); +}; + + +/* + This is a gap-encoded bit vector using delta coding. +*/ + +class DeltaVector : public BitVector +{ + public: + DeltaVector(std::ifstream& file); + DeltaVector(DeltaEncoder& encoder, usint universe_size); + ~DeltaVector(); + +//-------------------------------------------------------------------------- + + usint rank(usint value, bool at_least = false); + + usint select(usint index); + usint selectNext(); + + pair_type valueAfter(usint value); + pair_type nextValue(); + + pair_type selectRun(usint index, usint max_length); + pair_type selectNextRun(usint max_length); + + bool isSet(usint value); + +//-------------------------------------------------------------------------- + + usint reportSize(); +}; + + +} // namespace CSA + + +#endif // DELTAVECTOR_H