testing
[SXSI/XMLTree.git] / libcds / src / static_sequence / static_sequence_gmr_chunk.h
diff --git a/libcds/src/static_sequence/static_sequence_gmr_chunk.h b/libcds/src/static_sequence/static_sequence_gmr_chunk.h
new file mode 100644 (file)
index 0000000..a06b635
--- /dev/null
@@ -0,0 +1,48 @@
+
+#ifndef _STATIC_SEQUENCE_GMR_CHUNK_H
+#define _STATIC_SEQUENCE_GMR_CHUNK_H
+
+#include <basics.h>
+#include <static_bitsequence.h>
+#include <static_bitsequence_builder.h>
+#include <static_permutation.h>
+#include <cassert>
+#include <iostream>
+
+using namespace std;
+
+/** Implementation of the Chunk of Golynski et al's rank/select
+ * data structure [1].
+ *
+ * [1] A. Golynski and I. Munro and S. Rao. 
+ * Rank/select operations on large alphabets: a tool for text indexing.
+ * SODA 06.
+ *
+ * @author Francisco Claude
+ */
+class static_sequence_gmr_chunk: public static_sequence {
+  public:
+    /** Builds the structures needed for the chunk */
+    static_sequence_gmr_chunk(uint * sequence, uint chunk_length, static_bitsequence_builder *bmb, static_permutation_builder *pmb);
+
+    /** Destroy the chunk */
+    ~static_sequence_gmr_chunk();
+
+    virtual uint access(uint j);
+    virtual uint select(uint i, uint j);
+    virtual uint rank(uint i, uint j);
+    virtual uint size();
+    virtual uint save(FILE *fp);
+    static_sequence_gmr_chunk * load(FILE *fp);
+
+  protected:
+    /** Bitmap */
+    static_bitsequence * X;
+    /** Permutation */
+    static_permutation permutation;
+    /** Size of the alphabet */
+    uint sigma;
+    /** Length of the chunk */
+    uint chunk_length;
+};
+#endif