Implementation of LZ-index for extracting text
[SXSI/TextCollection.git] / lzindex / nodemap.h
1
2
3 // Implements the Node and RNode data structures, 
4 // which map block ids to LZTrie nodes and
5 // block ids to RevTrie nodes, respectively
6
7 #ifndef NODEMAPINCLUDED
8 #define NODEMAPINCLUDED
9
10 #include "basics.h"
11 //#include "lztrie.h"
12
13 typedef struct snodemap
14  { 
15     uint nbits;        // bits per cell
16     uint *map;         // mapping
17     uint n;            // number of elements in the mapping
18  } *nodemap;
19
20  
21         // creates a nodemap structure from a mapping array, not owning it
22         // n is number of blocks
23         // max is the number of trie nodes
24 nodemap createNodemap(uint *map, uint n, uint max);
25         // frees revtrie structure, including the owned data
26 void destroyNodemap(nodemap M);
27         // mapping
28 trieNode mapto(nodemap M, uint id);
29
30 void saveNodemap(FILE *f, nodemap M);
31
32 nodemap loadNodemap(FILE *f);
33
34 uint sizeofNodemap(nodemap M);
35 #endif