Added RLCSA index option
[SXSI/TextCollection.git] / incbwt / rlcsa_builder.h
index 0b0b6b2..8290404 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef RLCSA_BUILDER_H
 #define RLCSA_BUILDER_H
 
-#include <cstdlib>
 #include "rlcsa.h"
 
 
@@ -12,11 +11,14 @@ namespace CSA
 class RLCSABuilder
 {
   public:
-    RLCSABuilder(usint _block_size, usint _sample_rate, usint _buffer_size);
+    RLCSABuilder(usint _block_size, usint _sample_rate, usint _buffer_size, usint _threads = 1);
     ~RLCSABuilder();
 
     void insertSequence(char* sequence, usint length, bool delete_sequence);
 
+    // Use this if you have already built an index for the file.
+    void insertFromFile(const std::string& base_name);
+
     // User must free the index. Builder no longer contains it.
     RLCSA* getRLCSA();
 
@@ -28,6 +30,7 @@ class RLCSABuilder
     // These times are not reset with the rest of the builder.
     double getBuildTime();
     double getSearchTime();
+    double getSortTime();
     double getMergeTime();
 
   private:
@@ -37,18 +40,26 @@ class RLCSABuilder
     usint sample_rate;
     usint buffer_size;
 
+    usint threads;
+
     uchar* buffer;
     usint chars;
 
     bool ok;
 
-    clock_t build_time;
-    clock_t search_time;
-    clock_t merge_time;
+    double build_time;
+    double search_time;
+    double sort_time;
+    double merge_time;
 
     void flush();
     void addRLCSA(RLCSA* increment, uchar* sequence, usint length, bool delete_sequence);
     void reset();
+
+    // These are not allowed.
+    RLCSABuilder();
+    RLCSABuilder(const RLCSABuilder&);
+    RLCSABuilder& operator = (const RLCSABuilder&);
 };