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/cachestorefiles.h | 2 +- src/cachestoremyriad.h | 2 +- src/hash.h | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/cachestorefiles.h b/src/cachestorefiles.h index 1906b13..c2cf091 100644 --- a/src/cachestorefiles.h +++ b/src/cachestorefiles.h @@ -83,7 +83,7 @@ namespace Bu } } - virtual void unload( obtype *pObj, const keytype &key ) + virtual void unload( obtype *pObj, const keytype & ) { delete pObj; } diff --git a/src/cachestoremyriad.h b/src/cachestoremyriad.h index b90793d..21c84e6 100644 --- a/src/cachestoremyriad.h +++ b/src/cachestoremyriad.h @@ -85,7 +85,7 @@ namespace Bu return pOb; } - virtual void unload( obtype *pObj, const keytype &key ) + virtual void unload( obtype *pObj, const keytype & ) { delete pObj; } 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