Adding support for building wavelet trees using uchar arrays
[SXSI/XMLTree.git] / libcds / src / static_sequence / static_sequence_wvtree.cpp
index ea6a813..aa6a885 100644 (file)
@@ -33,6 +33,18 @@ static_sequence_wvtree::static_sequence_wvtree(uint * symbols, uint n, wt_coder
     symbols[i] = am->unmap(symbols[i]);  
 }
 
+static_sequence_wvtree::static_sequence_wvtree(uchar * symbols, uint n, wt_coder * c, static_bitsequence_builder * bmb, alphabet_mapper * am) {
+  for(uint i=0;i<n;i++) 
+    symbols[i] = (uchar)am->map((uint)symbols[i]);
+  this->am = am;
+       am->use();
+  this->c=c;
+       c->use();
+       root = new wt_node_internal(symbols, n, 0, c, bmb);
+  for(uint i=0;i<n;i++) 
+    symbols[i] = (uchar)am->unmap((uint)symbols[i]);  
+}
+
 static_sequence_wvtree::static_sequence_wvtree() {}
 
 static_sequence_wvtree::~static_sequence_wvtree() {