From 9700147ab5adaf28eecf931a9c7c096918baaf73 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 12 Mar 2013 02:00:42 +0000 Subject: Mostly planning changes, nothing real functional but I want to commit and change computers. --- src/tests/cache.cpp | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'src/tests') diff --git a/src/tests/cache.cpp b/src/tests/cache.cpp index 00a32dd..5731a6a 100644 --- a/src/tests/cache.cpp +++ b/src/tests/cache.cpp @@ -5,6 +5,7 @@ #include #include #include +#include // // New Cache Implementation @@ -29,8 +30,8 @@ public: typedef CacheBase CacheType; - virtual const keytype getKey() const=0; - virtual const int getPersistenceScore() const { return 0; } + virtual keytype getKey() const=0; + virtual int getPersistenceScore() const { return 0; } void changed( bool bChanged=true ) { @@ -55,14 +56,31 @@ template class CachePtr { friend class CacheBase; -public: - CachePtr() +private: + CachePtr( CacheBase *pCache, obtype *pData, const keytype &kId ) : + pCache( pCache ), + kId( kId ), + pData( pData ) { } + CachePtr( CacheBase *pCache, const keytype &kId ) : + pCache( pCache ), + kId( kId ), + pData( NULL ) + { + } + +public: virtual ~CachePtr() { } + +private: + CacheBase *pCache; + mutable keytype kId; + mutable obtype *pData; + }; template @@ -77,6 +95,11 @@ public: { } +protected: + void objectChanged( const keytype &k ) + { + } + protected: virtual void _create( obtype *o )=0; virtual void _erase( const keytype &k )=0; @@ -175,7 +198,7 @@ public: { } - virtual const Bu::Uuid getKey() const + virtual Bu::Uuid getKey() const { return uId; } -- cgit v1.2.3