X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/blobdiff_plain/c03f170abe6adaa72ff04318cb178cdcfb635f19..dba24fb6aa7fe829dc3e96039e7f717b0ef9668e:/src/btree.cpp?ds=sidebyside diff --git a/src/btree.cpp b/src/btree.cpp index 8803d20..c7d3b4b 100644 --- a/src/btree.cpp +++ b/src/btree.cpp @@ -17,7 +17,7 @@ BTree::BTree (const std::string &name, unsigned int block_size, bool create_new_ /* Inicializo el header */ header.block_size = block_size; - write_tree_header (); + WriteFileHeader (); /* Creo el primer bloque vacio */ node = new uchar[block_size]; @@ -26,7 +26,7 @@ BTree::BTree (const std::string &name, unsigned int block_size, bool create_new_ nh.free_space = block_size - sizeof (BTreeNodeHeader); nh.item_count = 0; WriteNodoHeader (node, &nh); - write_block (node, 0); + WriteBlock (node, 0); delete [] node; } @@ -36,13 +36,13 @@ BTree::~BTree () fclose (fp); } -void BTree::write_tree_header () +void BTree::WriteFileHeader () { fseek (fp, 0L, SEEK_SET); fwrite (&header, 1, sizeof (BTreeFileHeader), fp); } -void BTree::write_block (uchar *block, uint num) +void BTree::WriteBlock (uchar *block, uint num) { fseek (fp, num*header.block_size + sizeof (BTreeFileHeader), SEEK_SET); fwrite (block, 1, header.block_size, fp); @@ -69,7 +69,7 @@ void BTree::AddKey (const Clave &k) WriteKeys (root, root_header, node_keys); WriteNodoHeader (root, &root_header); - write_block (root, 0); + WriteBlock (root, 0); delete [] root; }