Bug fixes for RLCSA wrapper
authornvalimak <nvalimak@3cdefd35-fc62-479d-8e8d-bae585ffb9ca>
Mon, 8 Nov 2010 12:56:23 +0000 (12:56 +0000)
committernvalimak <nvalimak@3cdefd35-fc62-479d-8e8d-bae585ffb9ca>
Mon, 8 Nov 2010 12:56:23 +0000 (12:56 +0000)
git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/TextCollection@934 3cdefd35-fc62-479d-8e8d-bae585ffb9ca

RLCSAWrapper.h

index 44f7268..c92bdb9 100644 (file)
@@ -167,7 +167,7 @@ public:
                 goto exact_pattern_matching; // Invalid format
 
             IndelQuery iq(this);
-            //std::cerr << "Pattern: " << tmp+1 << ", k = " << k << std::endl;
+//            std::cerr << "RLCSAWrapper::Contains(): Pattern: " << tmp+1 << ", k = " << k << std::endl;
             return iq.align(tmp+1, k);
         }
 
@@ -226,7 +226,10 @@ public:
     // Index from/to disk
     RLCSAWrapper(FILE *file, char const *filename)
         : rlcsa(new CSA::RLCSA(std::string(filename)))
-    { /* NOP */ }
+    { 
+        // Init the edit distance look-up tables
+        MyersEditDistanceIncremental::initMyersFourRussians();
+    }
 
     void Save(FILE *file, char const *filename) const
     {
@@ -234,6 +237,7 @@ public:
         // Saving type info:
         if (std::fwrite(&type, 1, 1, file) != 1)
             throw std::runtime_error("RLCSAWrapper::Save(): file write error (type flag).");
+        fflush(file);
         
         this->rlcsa->writeTo(std::string(filename));
     }