X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/blobdiff_plain/b08d09c0c5ba065ea663371f3ad577a81948860d..aa158a0284c1bc32a979d50275aa1b24438d46ef:/src/btree_data.h diff --git a/src/btree_data.h b/src/btree_data.h index db40598..b7f457a 100644 --- a/src/btree_data.h +++ b/src/btree_data.h @@ -46,22 +46,25 @@ class BTreeData { virtual uchar *ToArray () const; /** Retorna la clave manejada */ - Clave* getClave () { return clave; } - void setClave (Clave *k) { clave = k; } + 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; @@ -71,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 (); @@ -93,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;