diff options
author | Mike Buland <eichlan@xagasoft.com> | 2010-05-01 19:20:21 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2010-05-01 19:20:21 +0000 |
commit | b4f8ebcb496ca231fa737307a0f9757d01e37c7b (patch) | |
tree | 57c99b2982b78148fa8b5412280d478a7d3be28e /src/cache.h | |
parent | aeb8bee786a9495c78ed94e2a8485ed790714635 (diff) | |
download | libbu++-b4f8ebcb496ca231fa737307a0f9757d01e37c7b.tar.gz libbu++-b4f8ebcb496ca231fa737307a0f9757d01e37c7b.tar.bz2 libbu++-b4f8ebcb496ca231fa737307a0f9757d01e37c7b.tar.xz libbu++-b4f8ebcb496ca231fa737307a0f9757d01e37c7b.zip |
Cache fixes.
Diffstat (limited to 'src/cache.h')
-rw-r--r-- | src/cache.h | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/cache.h b/src/cache.h index 1753407..896aa71 100644 --- a/src/cache.h +++ b/src/cache.h | |||
@@ -112,11 +112,6 @@ namespace Bu | |||
112 | return pData != NULL; | 112 | return pData != NULL; |
113 | } | 113 | } |
114 | 114 | ||
115 | operator bool() const | ||
116 | { | ||
117 | return isBound() && isValid(); | ||
118 | } | ||
119 | |||
120 | const keytype &getKey() const | 115 | const keytype &getKey() const |
121 | { | 116 | { |
122 | return kId; | 117 | return kId; |
@@ -297,7 +292,7 @@ namespace Bu | |||
297 | try { | 292 | try { |
298 | if( hEnt.get( cId ).iRefs > 0 ) | 293 | if( hEnt.get( cId ).iRefs > 0 ) |
299 | { | 294 | { |
300 | printf("Shouldn't delete, references still exist!\n"); | 295 | printf("Shouldn't unload, references still exist!\n"); |
301 | return; | 296 | return; |
302 | } | 297 | } |
303 | } | 298 | } |
@@ -317,24 +312,22 @@ namespace Bu | |||
317 | void erase( const keytype &cId ) | 312 | void erase( const keytype &cId ) |
318 | { | 313 | { |
319 | TRACE( cId ); | 314 | TRACE( cId ); |
320 | if( hEnt.has( cId ) ) | 315 | try { |
321 | { | 316 | if( hEnt.get( cId ).iRefs > 0 ) |
322 | try { | 317 | { |
323 | if( hEnt.get( cId ).iRefs > 0 ) | 318 | printf("Shouldn't erase, references still exist!\n"); |
324 | { | 319 | return; |
325 | printf("Shouldn't delete, references still exist!\n"); | ||
326 | return; | ||
327 | } | ||
328 | } | ||
329 | catch( Bu::HashException &e ) { | ||
330 | get( cId ); | ||
331 | } | 320 | } |
332 | 321 | } | |
333 | pCalc->onUnload( hEnt.get( cId ).pData, cId ); | 322 | catch( Bu::HashException &e ) { |
334 | pStore->destroy( hEnt.get( cId ).pData, cId ); | 323 | get( cId ); |
335 | } | 324 | } |
336 | 325 | ||
326 | obtype *pObj = hEnt.get( cId ).pData; | ||
327 | pCalc->onDestroy( pObj, cId ); | ||
337 | hEnt.erase( cId ); | 328 | hEnt.erase( cId ); |
329 | |||
330 | pStore->destroy( pObj, cId ); | ||
338 | } | 331 | } |
339 | 332 | ||
340 | typedef Bu::List<keytype> KeyList; | 333 | typedef Bu::List<keytype> KeyList; |