{
std::string s = k;
std::cout << "========= Borrando " << s << " =================\n";
- DelKeyR (new BTreeLeafData (k.Clone ()), 0, 0);
+ BTreeData *b = new BTreeLeafData (k.Clone ());
+ DelKeyR (b, 0, 0);
+ delete b;
}
void BTree::DelKeyR (BTreeData *k, uint node_num, uint padre)
std::cout << "Eliminar de Nodo con hijos : " << left << " y " << right << std::endl;
DelKeyFromNode (k->getClave (), node_num, padre, left, right);
}
+ DeleteKeys (node_keys);
+ delete [] node;
return;
}
ReadNodoHeader (node, &node_header);
node_keys = ReadKeys (node, node_header);
- data = new BTreeLeafData (k);
+ data = new BTreeLeafData (k->Clone ());
std::list<BTreeData *>::iterator it;
it = node_keys.begin ();
}
JoinNodes (join1, join2, padre, tipoh);
+
+ DeleteKeys (node_keys);
+ delete [] node;
return;
}
BTreeData *data;
if (node_header.level == 0)
- data = new BTreeLeafData ((Clave *)k);
+ data = new BTreeLeafData (k->Clone ());
else
- data = new BTreeData ((Clave *)k, 0);
+ data = new BTreeData (k->Clone (), 0);
while (it != node_keys.end ()) {
if ((*data) == (*(*it))) {
it++;
}
+ /* Si llego aca y estoy en nivel 0 (una hoja) quiere
+ * decir que no lo encontré
+ */
+ if (node_header.level == 0) {
+ delete data;
+ return NULL;
+ }
+
/* TODO: Aca faltaria liberar memoria */
if (it == posterior)
return FindKeyR (k, lchild->getChild ());