From 6eca7410b5a4c3c5225d852dd1d1ce9b74a7f4cd Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Wed, 21 Sep 2005 03:57:40 +0000 Subject: [PATCH] Fixes. Con esto que esta hasta ahora, hice un add de 1900 y no peto (falta revisar si es correcto el arbol armado :) --- src/btree_data.cpp | 2 ++ src/btree_data.h | 2 +- src/main.cpp | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/btree_data.cpp b/src/btree_data.cpp index 46917d6..1203d6c 100644 --- a/src/btree_data.cpp +++ b/src/btree_data.cpp @@ -43,6 +43,8 @@ uchar* BTreeData::ToArray () const bool BTreeData::operator < (const BTreeData &data) const { + if (!data.clave) return false; + return (*clave) < (*(data.clave)); } diff --git a/src/btree_data.h b/src/btree_data.h index d53b85f..5bbfc27 100644 --- a/src/btree_data.h +++ b/src/btree_data.h @@ -54,7 +54,7 @@ class BTreeLeafData:public BTreeData { class BTreeChildData:public BTreeData { public: - BTreeChildData (uint child):BTreeData () { hijo = child; } + BTreeChildData (uint child):BTreeData () { hijo = child; clave = NULL; } BTreeChildData (uchar *node); virtual ~BTreeChildData (); diff --git a/src/main.cpp b/src/main.cpp index 3c30c4a..c367a4c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,8 +6,13 @@ int main (int argc, char *argv[]) { BTree tree ("test.idx", 64); + + if (argc != 2) { + printf ("Falta parametro cantidad de elementos a agregar\n"); + return 1; + } - for (int i=0; i<=13; i++) { + for (int i=0; i<=atoi(argv[1]); i++) { ClaveFija c(i); std::cout << "Agregando " << i << std::endl; -- 2.43.0