From: Ricardo Markiewicz Date: Mon, 12 Sep 2005 20:11:41 +0000 (+0000) Subject: Agrego WriteKeys X-Git-Tag: 1_0-pre1~148 X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/commitdiff_plain/3a9e92af5fe004d068e161c66e308e4401dfc21b?ds=sidebyside Agrego WriteKeys --- diff --git a/src/btree.cpp b/src/btree.cpp index d1fbab3..9591ec8 100644 --- a/src/btree.cpp +++ b/src/btree.cpp @@ -109,3 +109,18 @@ std::list BTree::ReadKeys (uchar *node, BTreeNodeHeader &node_header) return keys; } +void BTree::WriteKeys (uchar *node, BTreeNodeHeader &node_header, std::list &keys) +{ + std::list::iterator it = keys.begin (); + + node += sizeof (BTreeNodeHeader); + + while (it != keys.end ()) { + Clave *c = (*it); + memcpy (node, c->ToArray(), c->Size ()); + node += c->Size (); + it++; + } + + /* TODO : incrementar node_header.item_count aca o fuera de este metodo? */ +} diff --git a/src/btree.h b/src/btree.h index 95180b0..9dbfc54 100644 --- a/src/btree.h +++ b/src/btree.h @@ -101,6 +101,7 @@ class BTree { void WriteNodoHeader (uchar *node, BTreeNodeHeader *header); std::list ReadKeys (uchar *node, BTreeNodeHeader &node_header); + void WriteKeys (uchar *node, BTreeNodeHeader &node_header, std::list &keys); std::string filename; BTreeFileHeader header;