X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/blobdiff_plain/4582a22e254c682b0e91750725401d018c9e93f2..2ab8041933e77875de62bc73e76febc528af258e:/src/btree_data.h diff --git a/src/btree_data.h b/src/btree_data.h index cfe6ef8..ca2cd4d 100644 --- a/src/btree_data.h +++ b/src/btree_data.h @@ -6,12 +6,13 @@ #include #include "clave.h" #include "clave_fija.h" +#include "clave_variable.h" /** Dato a guardar en los nodos */ class BTreeData { public: BTreeData () {} - BTreeData (uchar *node); + BTreeData (uchar *node, int tree_type); BTreeData (Clave *k, uint child); virtual ~BTreeData (); @@ -19,13 +20,16 @@ class BTreeData { virtual uchar *ToArray () const; Clave* getClave () { return clave; } + uint getChild () { return hijo; } + void setChild (uint c) { hijo = c; } bool operator < (const BTreeData &data) const; + bool operator == (const BTreeData &data) const; virtual operator std::string () const { std::string out = (*clave); std::stringstream ss; - ss << out << " "; - ss << hijo; + ss << "(" << out ; + ss << ")" << "[" << hijo << "]"; ss >> out; return out; } @@ -38,7 +42,7 @@ class BTreeData { class BTreeLeafData:public BTreeData { public: BTreeLeafData (Clave *k) { clave = k; } - BTreeLeafData (uchar *node) { clave = new ClaveFija (node); } + BTreeLeafData (uchar *node, int key_type); virtual ~BTreeLeafData (); virtual uint Size () const; @@ -53,7 +57,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 (); @@ -62,7 +66,7 @@ class BTreeChildData:public BTreeData { virtual operator std::string () const { std::string out; std::stringstream ss; - ss << hijo; + ss << "|" << hijo << "|"; ss >> out; return out; }