Added TextStorage class
[SXSI/TextCollection.git] / TCImplementation.h
index 5430f21..0439978 100644 (file)
@@ -40,6 +40,9 @@
 #endif
 #undef bitset
 
+#include "TextStorage.h"
+
+
 namespace SXSI 
 {
 
@@ -54,11 +57,32 @@ public:
     ~TCImplementation();
 
     bool EmptyText(DocId) const;
-    uchar* GetText(DocId) const;
+
+    /**
+     * Returns a pointer to the original text.
+     *
+     * Do *not* try to free the array. 
+     * (However, this implementation is suspect to change.)
+     *
+     * See TextStorage.h for details.
+     */
+    uchar * GetText(DocId) const;
+
     /**
-     * Next method is not supported:
-     * Supporting GetText for some substring [i,j]
-     * would require more space.
+     * Returns a pointer to the beginning of texts i, i+1, ..., j.
+     * Texts are separated by a '\0' byte.
+     *
+     * Do *not* try to free the array. 
+     * (However, this implementation is suspect to change.)
+     *
+     * See TextStorage.h for details.
+     */
+    uchar * GetText(DocId i, DocId j) const;
+
+    /**
+     * Returns a substring of given text ID.
+     * 
+     * FIXME This may be reimplemented via TextStorage.
      */
 //    uchar* GetText(DocId, TextPosition, TextPosition) const;
 
@@ -117,7 +141,7 @@ private:
     static_sequence * alphabetrank;
 
     // Sample structures for texts longer than samplerate
-    static_bitsequence * sampled;  // FIXME Replace with RRR02
+    static_bitsequence * sampled;
     BlockArray *suffixes;
     BlockArray *suffixDocId;
 
@@ -129,7 +153,10 @@ private:
     // Array of document id's in the order of end-markers in BWT
     static_sequence *Doc;
 
-    // Following are not part of the public API
+    // Text storage for fast extraction
+    TextStorage * textStorage;
+
+    // Following methods are not part of the public API
     uchar * BWT(uchar *);
     void makewavelet(uchar *);
     void maketables();