From e642d903800bc569707379b4a7f48293077d3c99 Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Wed, 14 Sep 2005 04:34:35 +0000 Subject: [PATCH] Funcion de debug para ver el contenido de un nodo --- src/btree.cpp | 20 ++++++++++++++++++++ src/btree.h | 4 ++++ 2 files changed, 24 insertions(+) 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 -- 2.43.0