X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=TCImplementation.h;h=75f1d40366f35191de41642cd984c5480705074b;hb=7cdaf25b1e5f1890e359b3ad37ab7ec2c9e30d5a;hp=65bf22c030b350333b429feaf8cc1feab63a90f9;hpb=e59bd57d53c2d9e5db4c22f2501a9789f62f46c1;p=SXSI%2FTextCollection.git diff --git a/TCImplementation.h b/TCImplementation.h index 65bf22c..75f1d40 100644 --- a/TCImplementation.h +++ b/TCImplementation.h @@ -39,6 +39,7 @@ # define W 32 #endif #undef bitset +#undef bitget #include "TextStorage.h" #include @@ -53,31 +54,30 @@ namespace SXSI */ class TCImplementation : public SXSI::TextCollection { public: - TCImplementation(uchar *, ulong, unsigned, unsigned, ulong, ulong); + TCImplementation(uchar *, ulong, unsigned, unsigned, ulong, ulong, char); ~TCImplementation(); bool EmptyText(DocId) const; /** - * Returns a pointer to the original text. + * Extracting one text. * - * Do *not* try to free the array. - * (However, this implementation is suspect to change.) - * - * See TextStorage.h for details. + * Call DeleteText() for each pointer returned by GetText() + * to avoid possible memory leaks. */ uchar * GetText(DocId) const; + void DeleteText(uchar *text) const + { textStorage->DeleteText(text); } /** * 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. + * Call DeleteText() for each pointer returned by GetText() + * to avoid possible memory leaks. */ - uchar * GetText(DocId i, DocId j) const; + uchar * GetText(DocId i, DocId j) const + { return textStorage->GetText(i, j); } /** * Returns a substring of given text ID. @@ -117,8 +117,8 @@ public: document_result Equal(uchar const *) const; document_result Contains(uchar const *) const; document_result LessThan(uchar const *) const; - document_result Kmismaches(uchar const *, unsigned) const; - document_result Kerrors(uchar const *, unsigned) const; + document_result KMismaches(uchar const *, unsigned) const; + document_result KErrors(uchar const *, unsigned) const; document_result Prefix(uchar const *, DocId, DocId) const; document_result Suffix(uchar const *, DocId, DocId) const; @@ -129,8 +129,8 @@ public: // Definition of full_result is inherited from SXSI::TextCollection. full_result FullContains(uchar const *) const; full_result FullContains(uchar const *, DocId, DocId) const; - full_result FullKmismatches(uchar const *, unsigned) const; - full_result FullKerrors(uchar const *, unsigned) const; + full_result FullKMismatches(uchar const *, unsigned) const; + full_result FullKErrors(uchar const *, unsigned) const; // Index from/to disk TCImplementation(FILE *, unsigned); @@ -165,7 +165,7 @@ private: // Following methods are not part of the public API uchar * BWT(uchar *); void makewavelet(uchar *); - void maketables(ulong); + void maketables(ulong, char); DocId DocIdAtTextPos(BlockArray*, TextPosition) const; ulong Search(uchar const *, TextPosition, TextPosition *, TextPosition *) const; ulong Search(uchar const *, TextPosition, TextPosition *, TextPosition *, DocId, DocId) const;