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 ();
29 else std::cout << "No tengo clave\n";
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
57 std::cout << "BTreeLeafData::Size : No tengo clave!" << std::endl;
60 return clave->Size ();
63 uchar* BTreeLeafData::ToArray () const
65 return clave->ToArray ();
68 BTreeChildData::BTreeChildData (uchar *node)
70 memcpy (&hijo, node, sizeof (uint));
73 BTreeChildData::~BTreeChildData ()
77 uint BTreeChildData::Size () const
82 uchar* BTreeChildData::ToArray () const
84 uchar *out = new uchar[Size()];
85 memcpy (out, &hijo, sizeof (uint));