From: Ricardo Markiewicz Date: Wed, 14 Sep 2005 04:33:53 +0000 (+0000) Subject: Agrego operadores a BTreeData X-Git-Tag: 1_0-pre1~133 X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/commitdiff_plain/a86378ad0949572fd260f105f3e02f2c3e1370a0?ds=inline Agrego operadores a BTreeData --- diff --git a/src/btree_data.cpp b/src/btree_data.cpp index 27825d7..dd6f709 100644 --- a/src/btree_data.cpp +++ b/src/btree_data.cpp @@ -32,6 +32,12 @@ uchar* BTreeData::ToArray () return out; } +bool BTreeData::operator < (const BTreeData &data) const +{ + return (*clave) < (*(data.clave)); +} + + BTreeLeafData::~BTreeLeafData () { } @@ -45,3 +51,4 @@ uchar* BTreeLeafData::ToArray () { return clave->ToArray (); } + diff --git a/src/btree_data.h b/src/btree_data.h index b590040..c1d4261 100644 --- a/src/btree_data.h +++ b/src/btree_data.h @@ -10,12 +10,21 @@ /** Dato a guardar en los nodos */ class BTreeData { public: - BTreeData () {} + BTreeData () { clave = NULL; } BTreeData (uchar *node); virtual ~BTreeData (); virtual uint Size (); virtual uchar *ToArray (); + + + bool operator < (const BTreeData &data) const; + virtual operator std::string () const { + if (clave) { + return (*clave); + } + return "NoKey"; + } protected: Clave *clave; uint hijo;