-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.h
30 lines (22 loc) · 817 Bytes
/
index.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
#ifndef INDEX_H
#define INDEX_H
#include <fstream>
// There are only 98 possible characters in the record files
#define BLOCKELEMENTS 98
#define BLOCKSIZE (BLOCKELEMENTS * sizeof(unsigned int))
// Manages the index used to speed up the search
class Index {
private:
unsigned int cTable[BLOCKELEMENTS+1];
unsigned char charMap[128];
void initializeCharMap();
public:
const char* indexFile;
unsigned int occ(unsigned char, unsigned int, std::istream&, std::istream&);
unsigned int getC(unsigned char);
unsigned int createOccIndex(std::istream&);
void writeBlockToIndex(unsigned int[BLOCKELEMENTS], std::ofstream&);
void generateCTable(unsigned int, std::istream&, std::istream&);
Index(const char*, const char*);
};
#endif