X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=libcds%2Fsrc%2Fstatic_sequence%2Fstatic_sequence_wvtree.cpp;h=5030fb185655bcd138366fabc78dddb070efcf63;hb=244e05181398ecc7f70dbadb7a4467727354d8c6;hp=ceeb7329ca4997e8004f701f0d1a2151a13bb867;hpb=69d191f9549b65e692b38bfceecc86fbcde474ad;p=SXSI%2FXMLTree.git diff --git a/libcds/src/static_sequence/static_sequence_wvtree.cpp b/libcds/src/static_sequence/static_sequence_wvtree.cpp index ceeb732..5030fb1 100644 --- a/libcds/src/static_sequence/static_sequence_wvtree.cpp +++ b/libcds/src/static_sequence/static_sequence_wvtree.cpp @@ -22,6 +22,7 @@ #include static_sequence_wvtree::static_sequence_wvtree(uint * symbols, uint n, wt_coder * c, static_bitsequence_builder * bmb, alphabet_mapper * am) { + this->n = n; for(uint i=0;imap(symbols[i]); this->am = am; @@ -34,6 +35,7 @@ static_sequence_wvtree::static_sequence_wvtree(uint * symbols, uint n, wt_coder } static_sequence_wvtree::static_sequence_wvtree(uchar * symbols, uint n, wt_coder * c, static_bitsequence_builder * bmb, alphabet_mapper * am) { + this->n = n; for(uint i=0;imap((uint)symbols[i]); this->am = am; @@ -66,7 +68,7 @@ uint static_sequence_wvtree::rank(uint symbol, uint pos) { uint static_sequence_wvtree::rankLessThan(uint &symbol, uint pos) { uint s = am->map(symbol); // std::cout << "lessthan..." << std::endl; - uint r = root->rankLessThan(s, pos, 0, c); + uint r = root->rankLessThan(s, pos); symbol = am->unmap(s); return r; } @@ -124,12 +126,17 @@ uint static_sequence_wvtree::size() { uint static_sequence_wvtree::save(FILE * fp) { uint wr = WVTREE_HDR; wr = fwrite(&wr,sizeof(uint),1,fp); + fflush(fp); if(wr!=1) return 1; wr = fwrite(&n,sizeof(uint),1,fp); + fflush(fp); if(wr!=1) return 1; if(c->save(fp)) return 1; + fflush(fp); if(am->save(fp)) return 1; + fflush(fp); if(root->save(fp)) return 1; + fflush(fp); return 0; }