X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/blobdiff_plain/b192ca855bf9015796ec8f9093d8c872fffbcd5c..98e331147474997778f92d14b794a94f1dc3bedb:/src/btree_data.h?ds=sidebyside diff --git a/src/btree_data.h b/src/btree_data.h index 573de74..b7f457a 100644 --- a/src/btree_data.h +++ b/src/btree_data.h @@ -46,21 +46,25 @@ class BTreeData { virtual uchar *ToArray () const; /** Retorna la clave manejada */ - Clave* getClave () { return clave; } + Clave* GetKey () { return clave; } + void SetKey (Clave *k) { clave = k; } /** Retorna el hijo apuntado */ - uint getChild () { return hijo; } + uint GetChild () { return hijo; } /** Setea el hijo apuntado */ - void setChild (uint c) { hijo = c; } + void SetChild (uint c) { hijo = c; } + + bool Abrev (BTreeData *anterior); + bool DesAbrev (BTreeData *anterior); 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 << "("; + ss << out; ss << ")" << "[" << hijo << "]"; - ss >> out; - return out; + return ss.str (); } protected: Clave *clave; @@ -70,7 +74,7 @@ class BTreeData { /** Dato a guardar en las hojas */ class BTreeLeafData:public BTreeData { public: - BTreeLeafData (Clave *k) { clave = k; } + BTreeLeafData (Clave *k) { clave = k; hijo = 0; } BTreeLeafData (uchar *node, int key_type); virtual ~BTreeLeafData (); @@ -92,6 +96,7 @@ class BTreeChildData:public BTreeData { virtual uint Size () const; virtual uchar *ToArray () const; + bool operator < (const BTreeData &data) const; virtual operator std::string () const { std::string out; std::stringstream ss;