#ifndef _TCImplementation_H_
#define _TCImplementation_H_
+
+#include "incbwt/bits/deltavector.h"
+
#include "BitRank.h"
#include "TextCollection.h"
#include "BlockArray.h"
# define W 32
#endif
#undef bitset
+#undef bitget
+
#include "TextStorage.h"
+#include "ArrayDoc.h"
#include <set>
+#include <string>
namespace SXSI
{
*/
class TCImplementation : public SXSI::TextCollection {
public:
- TCImplementation(uchar *, ulong, unsigned, unsigned, ulong, ulong);
+ TCImplementation(uchar *, ulong, unsigned, unsigned, ulong, ulong,
+ CSA::DeltaVector &, const std::string &, 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.
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;
// 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);
ulong maxTextLength;
// Array of document id's in the order of end-markers in BWT
- static_sequence *Doc;
+// static_sequence *Doc;
+ ArrayDoc *Doc;
// Text storage for fast extraction
TextStorage * textStorage;
// Following methods are not part of the public API
uchar * BWT(uchar *);
void makewavelet(uchar *);
- void maketables(ulong);
+ void maketables(ulong, char, CSA::DeltaVector &, const string &);
DocId DocIdAtTextPos(BlockArray*, TextPosition) const;
ulong Search(uchar const *, TextPosition, TextPosition *, TextPosition *) const;
ulong Search(uchar const *, TextPosition, TextPosition *, TextPosition *, DocId, DocId) const;