From: Ricardo Markiewicz Date: Sat, 24 Sep 2005 22:38:06 +0000 (+0000) Subject: Agrego operador == X-Git-Tag: 1_0-pre1~109 X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/commitdiff_plain/bb83fdaa6e234bff23810b22fca3a098e2afb975?ds=inline Agrego operador == --- diff --git a/src/btree_data.cpp b/src/btree_data.cpp index 1203d6c..7ba3448 100644 --- a/src/btree_data.cpp +++ b/src/btree_data.cpp @@ -48,6 +48,12 @@ bool BTreeData::operator < (const BTreeData &data) const return (*clave) < (*(data.clave)); } +bool BTreeData::operator == (const BTreeData &data) const +{ + if (!data.clave) return false; + + return (*clave) == (*(data.clave)); +} BTreeLeafData::~BTreeLeafData () { diff --git a/src/btree_data.h b/src/btree_data.h index f7106df..db8ecc1 100644 --- a/src/btree_data.h +++ b/src/btree_data.h @@ -23,6 +23,7 @@ class BTreeData { 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; diff --git a/src/clave.h b/src/clave.h index 18afab7..81e24db 100644 --- a/src/clave.h +++ b/src/clave.h @@ -15,6 +15,7 @@ class Clave { virtual Clave *Clone () const = 0; virtual bool operator < (const Clave &k) const = 0; + virtual bool operator == (const Clave &k) const = 0; virtual operator std::string () const = 0; }; diff --git a/src/clave_fija.cpp b/src/clave_fija.cpp index 5a547eb..155e0e6 100644 --- a/src/clave_fija.cpp +++ b/src/clave_fija.cpp @@ -36,3 +36,7 @@ bool ClaveFija::operator < (const Clave &c) const return data < ((ClaveFija&)c).data; } +bool ClaveFija::operator == (const Clave &c) const +{ + return data == ((ClaveFija&)c).data; +} diff --git a/src/clave_fija.h b/src/clave_fija.h index 5997931..7b715a9 100644 --- a/src/clave_fija.h +++ b/src/clave_fija.h @@ -17,6 +17,7 @@ class ClaveFija : public Clave { Clave *Clone () const; virtual bool operator < (const Clave &c) const; + virtual bool operator == (const Clave &c) const; virtual operator std::string () const { std::string out; std::stringstream ss;