From 3a9e92af5fe004d068e161c66e308e4401dfc21b Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Mon, 12 Sep 2005 20:11:41 +0000 Subject: [PATCH] Agrego WriteKeys --- src/btree.cpp | 15 +++++++++++++++ src/btree.h | 1 + 2 files changed, 16 insertions(+) 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; -- 2.43.0