X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/blobdiff_plain/2f18bb22e1573898bb70f0a46897fbd032ef2734..477697002803b11be48f7a9317c6c0f82e646cb9:/src/btree.cpp?ds=sidebyside diff --git a/src/btree.cpp b/src/btree.cpp index 77967bf..fc62f5b 100644 --- a/src/btree.cpp +++ b/src/btree.cpp @@ -19,6 +19,7 @@ BTree::BTree (const std::string &name, unsigned int block_size, int tt, int kt, header.block_size = block_size; header.tree_type = tt; header.key_type = kt; + header.block_data_counter = 0; WriteFileHeader (); /* Creo el primer bloque vacio */ @@ -100,8 +101,7 @@ void BTree::AddKey (const Clave &k) Clave *kout, *in; in = k.Clone (); - /* TODO : Hacer un contador con recuperacion */ - in->SetBlockData (0); + in->SetBlockData ( GetNextBlockData () ); try { kout = AddKeyR (in->Clone (), 0, left, right); @@ -1298,3 +1298,10 @@ int BTree::type () const { return header.key_type; } + +uint BTree::GetNextBlockData () +{ + /* TODO : Implementar recuperacion */ + return header.block_data_counter++; +} +