X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=TextCollection.h;h=98272c1a4d572124286b2dcb0c46b2049704cc3b;hb=18a3c1f1b87744c78fde76f96c3e9cf43e137b36;hp=dbc79822fe5bb33f7752fe65be84fc2d056b3f6c;hpb=4bae924993abf1aa9107fe916dd9eb2ee2fea956;p=SXSI%2FTextCollection.git diff --git a/TextCollection.h b/TextCollection.h index dbc7982..98272c1 100644 --- a/TextCollection.h +++ b/TextCollection.h @@ -42,23 +42,31 @@ namespace SXSI // Type for text position (FIXME ulong or long?) typedef ulong TextPosition; + // mode flag: Default includes both the index and "naive" text + enum index_mode_t { index_mode_default, index_mode_text_only }; // index_mode_index_only + /** * Load from a file * + * The second parameter is a prefix to be used for multiple + * files. (SWCSAWrapper uses multiple save files!) + * * New samplerate can be given, otherwise will use the one specified in the save file! - * Note: This is not a static method; call InitTextCollection() first to get the object handle. * * Throws an exception if std::fread() fails. * */ - static TextCollection* Load(FILE *, unsigned samplerate = 0); + static TextCollection* Load(FILE *, char const *, index_mode_t = index_mode_default, unsigned samplerate = 0); /** * Save data structure into a file - * + * + * The second parameter is a prefix to be used for multiple + * files. (SWCSAWrapper uses multiple save files!) + * * Throws an exception if std::fwrite() fails. */ - virtual void Save(FILE *) const = 0; + virtual void Save(FILE *, char const *) const = 0; /** * Virtual destructor @@ -193,10 +201,42 @@ namespace SXSI virtual full_result FullKMismatches(uchar const *, unsigned) const = 0; virtual full_result FullKErrors(uchar const *, unsigned) const = 0; + + virtual TextPosition getLength() const + { + std::cerr << "TextCollection::getLength() is unsupported! Use RLCSA instead." << std::endl; + std::exit(2); + return 0; + } + + virtual TextPosition LF(uchar c, TextPosition i) const + { + std::cerr << "TextCollection::LF() is unsupported! Use RLCSA instead." << std::endl; + std::exit(2); + return 0; + } + + virtual uchar* getSuffix(TextPosition pos, unsigned l) const + { + std::cerr << "TextCollection::getSuffix() is unsupported! Use RLCSA instead." << std::endl; + std::exit(2); + return 0; + } + + virtual DocId getDoc(TextPosition i) const + { + std::cerr << "TextCollection::getDoc() is unsupported! Use RLCSA instead." << std::endl; + std::exit(2); + return 0; + } + + protected: // Protected constructor; use TextCollectionBuilder TextCollection() { }; +// index_mode_t indexMode; + // No copy constructor or assignment TextCollection(TextCollection const&); TextCollection& operator = (TextCollection const&);