BTreeData::~BTreeData ()
{
+ if (clave) {
+ delete clave;
+ clave = NULL;
+ }
}
uint BTreeData::Size () const
{
uchar *out = new uchar[Size()];
if (clave) {
- memcpy (out, clave->ToArray (), clave->Size ());
+ uchar *n = clave->ToArray ();
+ memcpy (out, n, clave->Size ());
memcpy (out+clave->Size (), &hijo, sizeof (uint));
+ delete [] n;
} else
memcpy (out, &hijo, sizeof (uint));
return out;
return (*clave) == (*(data.clave));
}
+bool BTreeData::Abrev (BTreeData *anterior)
+{
+ if (anterior == NULL) return false;
+
+ ClaveVariable *c = (ClaveVariable *)clave;
+ return c->Abrev (dynamic_cast<ClaveVariable *>(anterior->GetKey ()));
+}
+
+bool BTreeData::DesAbrev (BTreeData *anterior)
+{
+ if (anterior == NULL) return false;
+
+ ClaveVariable *c = (ClaveVariable *)clave;
+ return c->DesAbrev (dynamic_cast<ClaveVariable *>(anterior->GetKey ()));
+}
+
BTreeLeafData::BTreeLeafData (uchar *node, int key_type)
{
+ hijo = 0;
if (key_type == BTree::KEY_FIXED)
clave = new ClaveFija (node);
else
BTreeLeafData::~BTreeLeafData ()
{
+ if (clave) {
+ delete clave;
+ clave = NULL;
+ }
}
uint BTreeLeafData::Size () const
BTreeChildData::BTreeChildData (uchar *node)
{
memcpy (&hijo, node, sizeof (uint));
+ clave = NULL;
}
BTreeChildData::~BTreeChildData ()
return out;
}
+bool BTreeChildData::operator < (const BTreeData &data) const
+{
+ return false;
+}