From 4bbeb6208ac33f71a09701cc5251f0412977946e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 10 Nov 2008 23:10:38 +0000 Subject: Ok, the cache-id officiation is being delegated to the CacheHandlers, this is just fine, since they can do it any way they want. The Congo CacheHandlers will all have to be specialized versions of the generic ones, but they'll use all the general functionality, just make up IDs differently. It'll rock. --- src/tests/cache.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src/tests') diff --git a/src/tests/cache.cpp b/src/tests/cache.cpp index e51c31b..f05de57 100644 --- a/src/tests/cache.cpp +++ b/src/tests/cache.cpp @@ -8,24 +8,52 @@ class Bob : public Bu::Cachable public: Bob() { + TRACE(); } virtual ~Bob() { + TRACE(); + } + + void setInt( int i ) + { + TRACE(); + iInt = i; + } + + int getInt() + { + return iInt; } long getCacheId() const { + TRACE(); return 0; } int iInt; }; +DECL_CACHABLE( Bob ); +DEF_CACHABLE( Bob ); + int main() { Bu::Cache bobCache; -// Bu::CPtr pB = bobCache.insert( new Bob() ); + Bu::CPtr pB1 = bobCache.insert( new Bob() ); + + (*pB1).setInt( 44 ); + + printf("RefCnt = %d\n", bobCache.getRefCnt( 0 ) ); + + Bu::CPtr pB2 = bobCache.get( 0 ); + + printf("RefCnt = %d\n", bobCache.getRefCnt( 0 ) ); + + printf("Int = %d\n", pB2->getInt() ); + } -- cgit v1.2.3