Added RLCSA index option
[SXSI/TextCollection.git] / incbwt / misc / utils.cpp
index ae49883..cfd2799 100644 (file)
@@ -1,9 +1,28 @@
 #include "utils.h"
 
+#ifdef MULTITHREAD_SUPPORT
+#include <omp.h>
+#else
+#include <cstdlib>
+#endif
+
 
 namespace CSA
 {
 
+//--------------------------------------------------------------------------
+
+Triple::Triple() :
+  first(0), second(0), third(0)
+{
+}
+
+Triple::Triple(usint a, usint b, usint c) :
+  first(a), second(b), third(c)
+{
+}
+
+//--------------------------------------------------------------------------
 
 std::streamoff
 fileSize(std::ifstream& file)
@@ -40,7 +59,7 @@ operator<<(std::ostream& stream, pair_type data)
 }
 
 void
-readRows(std::ifstream& file, std::list<std::string>& rows, bool skipEmptyRows)
+readRows(std::ifstream& file, std::vector<std::string>& rows, bool skipEmptyRows)
 {
   while(file)
   {
@@ -51,5 +70,15 @@ readRows(std::ifstream& file, std::list<std::string>& rows, bool skipEmptyRows)
   }
 }
 
+double
+readTimer()
+{
+  #ifdef MULTITHREAD_SUPPORT
+  return omp_get_wtime();
+  #else
+  return clock() / (double)CLOCKS_PER_SEC;
+  #endif
+}
+
 
 } // namespace CSA