7 #include "bits/deltavector.h"
8 #include "bits/rlevector.h"
9 #include "bits/nibblevector.h"
11 #include "bits/array.h"
12 #include "misc/utils.h"
22 const static usint INDEX_BLOCK_SIZE = 16;
23 const static usint VALUE_BLOCK_SIZE = 32;
25 LCPSamples(std::ifstream& sample_file);
27 // Input pairs are of form (i, LCP[i]).
28 LCPSamples(pair_type* input, usint _size, usint _items, bool report = false, bool free_input = false);
30 LCPSamples(DeltaEncoder& index_encoder, ArrayEncoder& value_encoder, usint _size);
34 void writeTo(std::ofstream& sample_file) const;
36 // Returns the value of the ith sample in suffix array order.
37 // If the index is invalid, returns this->size.
38 inline usint getSample(usint i) const
40 Array::Iterator iter(*(this->values));
41 usint tmp = iter.getItem(i);
42 if(tmp == 0) { return this->size; }
46 // Returns (ind, sample number) where ind >= index or (size, ???).
47 inline pair_type getFirstSampleAfter(usint index) const
49 DeltaVector::Iterator iter(*(this->indexes));
50 return iter.valueAfter(index);
53 // Behavior is undefined if there is no sample at index.
54 inline usint getSampleAtPosition(usint index) const
56 DeltaVector::Iterator index_iter(*(this->indexes));
57 Array::Iterator value_iter(*(this->values));
58 return value_iter.getItem(index_iter.rank(index) - 1) - 1;
61 inline usint getNumberOfSamples() const { return this->items; }
63 usint reportSize() const;
71 // These are not allowed.
73 LCPSamples(const LCPSamples&);
74 LCPSamples& operator = (const LCPSamples&);
81 #endif // LCPSAMPLES_H