-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfmstr.h
33 lines (27 loc) · 930 Bytes
/
fmstr.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
#ifndef FMSTR_H_INCLUDED
#define FMSTR_H_INCLUDED
#include "general.h"
#include "str.h"
#include "suffixarray.h"
#include "checkpoint.h"
#include <vector>
#include <iostream>
immutable_class FMStr : public Str {
private:
bool isPacked = false; // is run-length encoded or in raw format
SuffixArray sufArr; // corresponding suffix array
Checkpoint checkpoint; // corresponding checkpoint tables
public:
// constructed in factory due to preprocessing, here only assigned
FMStr(const Str& str, const SuffixArray& sufArr, const Checkpoint& checkpoint);
~FMStr();
std::vector<unsigned> allPos(const Str& str) const;
Str inverse() const;
void pack();
void unpack();
void info(std::ostream& os) const;
private:
unsigned originalPos(unsigned index) const; // position of F(index) in the original index
friend class Checkpoint;
};
#endif // FMSTR_H_INCLUDED