aboutsummaryrefslogtreecommitdiff
path: root/src/hash.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-01-06 23:40:32 +0000
committerMike Buland <eichlan@xagasoft.com>2011-01-06 23:40:32 +0000
commit9f3d53ebab425f49a554d8be8b8896bd11465447 (patch)
tree3a43f4cb2d21784af2fcc96b6197ccdbde023793 /src/hash.h
parent2545d1f2a82bc7c23abc0034958b169f9fffe613 (diff)
downloadlibbu++-9f3d53ebab425f49a554d8be8b8896bd11465447.tar.gz
libbu++-9f3d53ebab425f49a554d8be8b8896bd11465447.tar.bz2
libbu++-9f3d53ebab425f49a554d8be8b8896bd11465447.tar.xz
libbu++-9f3d53ebab425f49a554d8be8b8896bd11465447.zip
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.
Diffstat (limited to '')
-rw-r--r--src/hash.h41
1 files changed, 41 insertions, 0 deletions
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
1148 return lValues; 1148 return lValues;
1149 } 1149 }
1150 1150
1151 bool operator==( const MyType &rhs ) const
1152 {
1153 if( this == &rhs )
1154 return true;
1155 if( core == rhs.core )
1156 return true;
1157 if( core == NULL || rhs.core == NULL )
1158 return false;
1159 if( getSize() != rhs.getSize() )
1160 return false;
1161
1162 for( uint32_t j = 0; j < core->nCapacity; j++ )
1163 {
1164 if( core->isFilled( j ) )
1165 {
1166 if( !core->isDeleted( j ) )
1167 {
1168 // Check to see if this key is in the other hash
1169 if( rhs.has( core->aKeys[j] ) )
1170 {
1171 if( !(core->aValues[j] == rhs.get( core->aKeys[j]) ) )
1172 {
1173 return false;
1174 }
1175 }
1176 else
1177 {
1178 return false;
1179 }
1180 }
1181 }
1182 }
1183
1184 return true;
1185 }
1186
1187 bool operator!=( const MyType &rhs ) const
1188 {
1189 return !(*this == rhs);
1190 }
1191
1151 protected: 1192 protected:
1152 virtual Core *_copyCore( Core *src ) 1193 virtual Core *_copyCore( Core *src )
1153 { 1194 {