2 #include "btree_data.h"
4 BTreeData::BTreeData (uchar *node)
6 /* TODO : Aca deberia detectar el tipo de clave (necesito
9 clave = new ClaveFija (node);
10 node += clave->Size ();
12 memcpy (&hijo, node, sizeof (uint));
15 BTreeData::BTreeData (Clave *k, uint child)
21 BTreeData::~BTreeData ()
25 uint BTreeData::Size () const
27 uint s = sizeof (uint);
28 if (clave) s += clave->Size ();
33 uchar* BTreeData::ToArray () const
35 uchar *out = new uchar[Size()];
37 memcpy (out, clave->ToArray (), clave->Size ());
38 memcpy (out+clave->Size (), &hijo, sizeof (uint));
40 memcpy (out, &hijo, sizeof (uint));
44 bool BTreeData::operator < (const BTreeData &data) const
46 return (*clave) < (*(data.clave));
50 BTreeLeafData::~BTreeLeafData ()
54 uint BTreeLeafData::Size () const
56 std::cout << "BTreeLeafData::Size()" << std::endl;
58 std::cout << "BTreeLeafData::Size : No tengo clave!" << std::endl;
61 return clave->Size ();
64 uchar* BTreeLeafData::ToArray () const
66 return clave->ToArray ();
69 BTreeChildData::BTreeChildData (uchar *node)
71 memcpy (&hijo, node, sizeof (uint));
74 BTreeChildData::~BTreeChildData ()
78 uint BTreeChildData::Size () const
80 std::cout << "BTreeChildData::Size()" << std::endl;
84 uchar* BTreeChildData::ToArray () const
86 uchar *out = new uchar[Size()];
87 memcpy (out, &hijo, sizeof (uint));