From 0861fdb652408dcdbd2e7b60513f3fa24696e610 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 25 Jan 2010 16:42:40 +0000 Subject: The order of key, object in all of the cache related systems has beed fixed, key just belongs first, that's all there is to it. --- src/cache.h | 16 ++++++++-------- src/cachecalc.h | 8 ++++---- src/cachestore.h | 2 +- src/cachestorenids.h | 24 ++++++++++++------------ src/tests/cache.cpp | 6 +++--- 5 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/cache.h b/src/cache.h index 87037f7..c738d28 100644 --- a/src/cache.h +++ b/src/cache.h @@ -18,10 +18,10 @@ namespace Bu { -// template +// template // keytype __cacheGetKey( obtype *&pObj ); - template + template class Cache { public: @@ -32,9 +32,9 @@ namespace Bu */ class Ptr { - friend class Bu::Cache; + friend class Bu::Cache; private: - Ptr( Cache *pCache, obtype *pData, + Ptr( Cache *pCache, obtype *pData, const keytype &kId ) : pCache( pCache ), pData( pData ), @@ -44,7 +44,7 @@ namespace Bu pCache->incRef( kId ); } - Ptr( Cache *pCache, const keytype &kId ) : + Ptr( Cache *pCache, const keytype &kId ) : pCache( pCache ), pData( NULL ), kId( kId ) @@ -168,15 +168,15 @@ namespace Bu } private: - Bu::Cache *pCache; + Bu::Cache *pCache; mutable obtype *pData; mutable keytype kId; }; private: - typedef Bu::CacheStore Store; + typedef Bu::CacheStore Store; typedef Bu::List StoreList; - typedef Bu::CacheCalc Calc; + typedef Bu::CacheCalc Calc; typedef struct CacheEntry { diff --git a/src/cachecalc.h b/src/cachecalc.h index dd6add1..27680b9 100644 --- a/src/cachecalc.h +++ b/src/cachecalc.h @@ -14,14 +14,14 @@ namespace Bu { - template class Cache; + template class Cache; - template + template class CacheCalc { - friend class Cache; + friend class Cache; private: - typedef Cache MyCache; + typedef Cache MyCache; public: CacheCalc() : pCache( (MyCache *)0 ) diff --git a/src/cachestore.h b/src/cachestore.h index 6ce42b8..d44326d 100644 --- a/src/cachestore.h +++ b/src/cachestore.h @@ -16,7 +16,7 @@ namespace Bu * Handles I/O for data in the cache. This also assigns ID's to the newly * created objects that are requested through this system. */ - template + template class CacheStore { public: diff --git a/src/cachestorenids.h b/src/cachestorenids.h index ae2b9a2..0d104cf 100644 --- a/src/cachestorenids.h +++ b/src/cachestorenids.h @@ -19,16 +19,16 @@ namespace Bu { - template + template keytype __cacheGetKey( const obtype *pObj ); - template + template obtype *__cacheStoreNidsAlloc( const keytype &key ) { return new obtype(); } - template + template void __cacheStoreNidsStore( Bu::Stream &s, obtype &rObj, const keytype & ) { @@ -36,17 +36,17 @@ namespace Bu ar << rObj; } - template + template obtype *__cacheStoreNidsLoad( Bu::Stream &s, const keytype &key ) { - obtype *pObj = __cacheStoreNidsAlloc( key ); + obtype *pObj = __cacheStoreNidsAlloc( key ); Bu::Archive ar( s, Bu::Archive::load ); ar >> (*pObj); return pObj; } - template - class CacheStoreNids : public CacheStore + template + class CacheStoreNids : public CacheStore { public: CacheStoreNids( Bu::Stream &sArch, @@ -83,7 +83,7 @@ namespace Bu { int iStream = hId.get( key ); NidsStream ns = nStore.openStream( iStream ); - obtype *pOb = __cacheStoreNidsLoad( ns, key ); + obtype *pOb = __cacheStoreNidsLoad( ns, key ); return pOb; } @@ -91,17 +91,17 @@ namespace Bu { int iStream = hId.get( key ); NidsStream ns = nStore.openStream( iStream ); - __cacheStoreNidsStore( ns, *pObj, key ); + __cacheStoreNidsStore( ns, *pObj, key ); delete pObj; } virtual keytype create( obtype *pSrc ) { - keytype key = __cacheGetKey( pSrc ); + keytype key = __cacheGetKey( pSrc ); int iStream = nStore.createStream(); hId.insert( key, iStream ); NidsStream ns = nStore.openStream( iStream ); - __cacheStoreNidsStore( ns, *pSrc, key ); + __cacheStoreNidsStore( ns, *pSrc, key ); return key; } @@ -118,7 +118,7 @@ namespace Bu { int iStream = hId.get( key ); NidsStream ns = nStore.openStream( iStream ); - __cacheStoreNidsStore( ns, *pSrc, key ); + __cacheStoreNidsStore( ns, *pSrc, key ); } virtual void destroy( obtype *pObj, const keytype &key ) diff --git a/src/tests/cache.cpp b/src/tests/cache.cpp index a098145..11a4215 100644 --- a/src/tests/cache.cpp +++ b/src/tests/cache.cpp @@ -58,7 +58,7 @@ namespace Bu { } } -class BobStore : public Bu::CacheStore +class BobStore : public Bu::CacheStore { public: BobStore() : @@ -158,7 +158,7 @@ private: long cLastId; }; -class BobCalc : public Bu::CacheCalc +class BobCalc : public Bu::CacheCalc { public: BobCalc() @@ -189,7 +189,7 @@ private: int main( int argc, char *argv[] ) { TRACE( argc, argv ); - typedef Bu::Cache BobCache; + typedef Bu::Cache BobCache; typedef BobCache::Ptr BobPtr; if( argc < 3 ) -- cgit v1.2.3