forked from migumar2/libCSD
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathStringDictionaryHASHRPDACBlocks.h
53 lines (45 loc) · 2.02 KB
/
StringDictionaryHASHRPDACBlocks.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef _STRINGDICTIONARY_HASHRPDACBLOCKS_H
#define _STRINGDICTIONARY_HASHRPDACBLOCKS_H
#include "StringDictionary.h"
#include "StringDictionaryHASHRPDAC.h"
#include "iterators/IteratorDictStringPlain.h"
#include <string>
#include <vector>
constexpr unsigned long DEFAULT_CUT_SIZE = 1 << 27;
class StringDictionaryHASHRPDACBlocks : public StringDictionary {
public:
StringDictionaryHASHRPDACBlocks() = delete;
StringDictionaryHASHRPDACBlocks(IteratorDictStringPlain *it,
unsigned long len, int overhead);
StringDictionaryHASHRPDACBlocks(IteratorDictStringPlain *it,
unsigned long len, int overhead,
unsigned long cut_size);
StringDictionaryHASHRPDACBlocks(IteratorDictStringPlain *it,
unsigned long len, int overhead,
unsigned long cut_size, int thread_count);
StringDictionaryHASHRPDACBlocks(
unsigned long cut_size, unsigned long strings_qty, unsigned int maxlength,
std::vector<StringDictionary *> &&parts,
std::vector<std::string> &&cut_samples,
std::vector<unsigned long> &&starting_indexes);
unsigned long locate(uchar *str, uint str_length);
uchar *extract(size_t id, uint *strLen);
IteratorDictID *locatePrefix(uchar *str, uint strLen);
IteratorDictID *locateSubstr(uchar *str, uint strLen);
uint locateRank(uint rank);
IteratorDictString *extractPrefix(uchar *str, uint strLen);
IteratorDictString *extractSubstr(uchar *str, uint strLen);
uchar *extractRank(uint rank, uint *strLen);
IteratorDictString *extractTable();
size_t getSize();
void save(std::ostream &out);
static StringDictionary *load(std::istream &in, uint technique = HASHUFF);
~StringDictionaryHASHRPDACBlocks();
private:
unsigned long cut_size;
unsigned long strings_qty;
std::vector<StringDictionary *> parts;
std::vector<std::string> cut_samples;
std::vector<unsigned long> starting_indexes;
};
#endif /* _STRINGDICTIONARY_HASHRPDACBLOCKS_H */