- Added an option to disable the TextCollection.
[SXSI/XMLTree.git] / XMLTree.h
index ba01941..c054b01 100644 (file)
--- a/XMLTree.h
+++ b/XMLTree.h
@@ -37,6 +37,8 @@ using SXSI::TextCollection;
 \r
 #define NULLT -1\r
 \r
+#define PERM_SAMPLE 10\r
+\r
         // sets bit p in e\r
 #define bitset(e,p) ((e)[(p)/W] |= (1<<((p)%W)))\r
         // cleans bit p in e\r
@@ -67,7 +69,7 @@ class XMLTree {
    static_bitsequence_rrr02 *EBVector;  \r
                      \r
    /** Tag sequence represented with a data structure for rank and select */\r
-   static_sequence_wvtree *Tags;\r
+   static_sequence *Tags;\r
 \r
    /** The texts in the XML document */\r
    TextCollection *Text;\r
@@ -85,8 +87,11 @@ class XMLTree {
    pb *par_aux;\r
    TagType *tags_aux;\r
    int npar;\r
+   int parArraySize;\r
    int ntagnames;\r
    unsigned int *empty_texts_aux;\r
+   bool found_attributes;\r
+   bool disable_tc;\r
    \r
 public:\r
 \r
@@ -206,14 +211,16 @@ public:
    /** ParentNode(d): returns the parent node of document identifier d. */\r
    treeNode ParentNode(DocID d);\r
 \r
-   /** OpenDocument(empty_texts,sample_rate_text): initilizes the construction\r
+   /** OpenDocument(empty_texts,sample_rate_text,dtc): initilizes the construction\r
     * of the data structure for the XML document. Parameter empty_texts \r
     * indicates whether we index empty texts in document or not. Parameter \r
     * sample_rate_text indicates the sampling rate for the text searching data\r
     * structures (small values get faster searching but a bigger space \r
-    * requirement). Returns a non-zero value upon success, NULLT in case of \r
+    * requirement). dtc disable the use of the TextCollection\r
+    * (i.e. everything is considered an empty text *)\r
+    * Returns a non-zero value upon success, NULLT in case of \r
     * error. */\r
-   int OpenDocument(bool empty_texts, int sample_rate_text);\r
+   int OpenDocument(bool empty_texts, int sample_rate_text, bool dtc);\r
 \r
    /** CloseDocument(): finishes the construction of the data structure for \r
     * the XML document. Tree and tags are represented in the final form, \r
@@ -251,6 +258,12 @@ public:
     * Returns NULL in case that the tag identifier is not valid.*/\r
    unsigned char *GetTagName(TagType tagid);\r
 \r
+\r
+   TagType RegisterTag(unsigned char *tagname);\r
+\r
+   bool EmptyText(DocID i) {\r
+      return Text->EmptyText(i);\r
+   }\r
    /** Prefix(s): search for texts prefixed by string s. */\r
    TextCollection::document_result Prefix(uchar const *s) {\r
       return Text->Prefix(s);\r
@@ -336,6 +349,9 @@ public:
       return Text->GetText(d);\r
    }\r
    \r
+   TextCollection *getTextCollection() {\r
+      return Text;\r
+   }\r
    /** Save: saves XML tree data structure to file. */\r
    void Save(unsigned char *filename);\r
       \r