#include <stdlib.h>\r
#include <cstring>\r
\r
+//KIM : OJO\r
//clash between TextCollection/Tools.h and libcds/includes/basics.h\r
#undef W\r
#undef WW\r
} range;\r
\r
\r
+//KIM : OJO\r
+// I know this class implements the working draft that we have but the logics seem flawed here...\r
+// We should have two classes. One XMLTreeBuilder and one XMLTree.\r
+// XMLTreeBuilder would have OpenDocument, NewOpenTag,... and CloseDocument would return an XMLTree\r
+// XMLTree would have only an initialized structure. If find it really ugly to check (!finished) or (!initialized)\r
+// in every function (FirstChild....).\r
+\r
class XMLTree {\r
/** Balanced parentheses representation of the tree */\r
bp *Par;\r
int parArraySize;\r
int ntagnames;\r
unsigned int *empty_texts_aux;\r
+\r
+ // KIM : OJO\r
+ // I added those two. The TagName array should always contains two special tags\r
+ // <@> for attributes and <$> for PCDATA.\r
+ // <$> can never be in a document (since we handle the text differently)\r
+ // but <@> can be returned by the parser. This boolean is needed for the construction\r
+ // of the Tag bitmap to know if <@> must be taken into account or not\r
bool found_attributes;\r
+\r
+ // KIM : OJO\r
+ // Allows to disable the TextCollection for benchmarkin purposes\r
bool disable_tc;\r
\r
public:\r
* (i.e. everything is considered an empty text *)\r
* Returns a non-zero value upon success, NULLT in case of \r
* error. */\r
+\r
int OpenDocument(bool empty_texts, int sample_rate_text, bool dtc);\r
\r
/** CloseDocument(): finishes the construction of the data structure for \r
unsigned char *GetTagName(TagType tagid);\r
\r
\r
+ // OJO\r
+ /** GetTagName(tagid): returns the tag name of a given tag identifier. \r
+ * The result is just a reference and should not be freed by the caller.\r
+ */\r
+ const unsigned char *GetTagNameByRef(TagType tagid);\r
+\r
+ //OJO\r
+ /** RegisterTag adds a new tag to the tag collection this is needed\r
+ * if the query contains a tag which is not in the document, we need\r
+ * to give this new tag a fresh id and store it somewhere. A logical\r
+ * choice is here.\r
+ * We might want to use a hashtable instead of an array though.\r
+ */\r
TagType RegisterTag(unsigned char *tagname);\r
\r
bool EmptyText(DocID i) {\r