From 9f3d53ebab425f49a554d8be8b8896bd11465447 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 6 Jan 2011 23:40:32 +0000 Subject: This may be about it for updates to core, I can't think of anything else I need to do right now. This commit contains minor fixes to the cache stores so they don't generate any warnings, and the hashtable includes == and != operators now. --- src/hash.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/hash.h') diff --git a/src/hash.h b/src/hash.h index d251c46..354569e 100644 --- a/src/hash.h +++ b/src/hash.h @@ -1148,6 +1148,47 @@ namespace Bu return lValues; } + bool operator==( const MyType &rhs ) const + { + if( this == &rhs ) + return true; + if( core == rhs.core ) + return true; + if( core == NULL || rhs.core == NULL ) + return false; + if( getSize() != rhs.getSize() ) + return false; + + for( uint32_t j = 0; j < core->nCapacity; j++ ) + { + if( core->isFilled( j ) ) + { + if( !core->isDeleted( j ) ) + { + // Check to see if this key is in the other hash + if( rhs.has( core->aKeys[j] ) ) + { + if( !(core->aValues[j] == rhs.get( core->aKeys[j]) ) ) + { + return false; + } + } + else + { + return false; + } + } + } + } + + return true; + } + + bool operator!=( const MyType &rhs ) const + { + return !(*this == rhs); + } + protected: virtual Core *_copyCore( Core *src ) { -- cgit v1.2.3