Split debugging and profiling mode.
[SXSI/XMLTree.git] / XMLTree.h
index 1cab2aa..74a71e6 100644 (file)
--- a/XMLTree.h
+++ b/XMLTree.h
@@ -32,6 +32,7 @@
 #undef Wminusone
 
 #include <bp/bp.h>
+#include <bp/bp-darray.h>
 #include <libcds/includes/basics.h>
 #include <libcds/includes/static_bitsequence.h>
 #include <libcds/includes/alphabet_mapper.h>
@@ -94,6 +95,7 @@ typedef TagIdMap::const_iterator TagIdMapIT;
 
 // returns NULLT if the test is true
 #define NULLT_IF(x)  do { if (x) return NULLT; } while (0)
+#define IS_NIL(x) ((x) < 0)
 
 // Direct calls to sarray library
 
@@ -218,7 +220,7 @@ class XMLTree {
            std::vector<std::string> * const TN,
            TagIdMap * const tim, uint *empty_texts_bmp,
            TagType *tags,
-           TextCollection * const TC, bool dis_tc,
+           TextCollectionBuilder * const TCB, bool dis_tc,
            TextCollectionBuilder::index_type_t _index_type );
 
 public:
@@ -292,10 +294,15 @@ public:
    bool IsChild(treeNode x, treeNode y);
 
    /** IsFirstChild(x): returns whether node x is the first child of its parent. */
-   /* OCAML */
+   /* SLOW 
    bool IsFirstChild(treeNode x) {
           return ((x != NULLT)&&(x==Root() || bp_prev_sibling(Par,x) == (treeNode)-1));
    };
+   */
+
+   bool IsFirstChild(treeNode x) {
+     return (x <= Root()) || (bp_inspect(Par,x-1) == OP);
+   }
 
    /** NumChildren(x): number of children of node x. Constant time with the
     * data structure of Sadakane. */