From: Ricardo Markiewicz Date: Wed, 14 Sep 2005 04:34:35 +0000 (+0000) Subject: Funcion de debug para ver el contenido de un nodo X-Git-Tag: 1_0-pre1~132 X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/commitdiff_plain/e642d903800bc569707379b4a7f48293077d3c99?ds=sidebyside Funcion de debug para ver el contenido de un nodo --- diff --git a/src/btree.cpp b/src/btree.cpp index dd0551d..ef48fef 100644 --- a/src/btree.cpp +++ b/src/btree.cpp @@ -152,3 +152,23 @@ void BTree::WriteKeys (uchar *node, BTreeNodeHeader &node_header, std::list node_keys = ReadKeys (node, node_header); + std::list::iterator it = node_keys.begin (); + + std::cout << "Nodo : " << num << std::endl; + std::cout << "Items : " << node_header.item_count << std::endl; + std::cout << "Free : " << node_header.free_space << " (" << (header.block_size - sizeof (BTreeNodeHeader)) << ")" << std::endl; + while (it != node_keys.end ()) { + std::string s = (*it); + std::cout << "(" << s << ") "; + } + std::cout << std::endl; +} + diff --git a/src/btree.h b/src/btree.h index 467ed6f..06a6941 100644 --- a/src/btree.h +++ b/src/btree.h @@ -114,6 +114,10 @@ class BTree { * \TODO Ver si vale la pena */ FILE *fp; + + + /* DEBUG */ + void PrintNode (uint num); }; #endif // _B_TREE_H