aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2008-11-10 23:10:38 +0000
committerMike Buland <eichlan@xagasoft.com>2008-11-10 23:10:38 +0000
commit4bbeb6208ac33f71a09701cc5251f0412977946e (patch)
tree038a71056f91d7ce3b26f90fde3519d404e7cb63 /src/tests
parent61edfe804eb1a1dbf96fcdf2f1b700ed1cfa7ff9 (diff)
downloadlibbu++-4bbeb6208ac33f71a09701cc5251f0412977946e.tar.gz
libbu++-4bbeb6208ac33f71a09701cc5251f0412977946e.tar.bz2
libbu++-4bbeb6208ac33f71a09701cc5251f0412977946e.tar.xz
libbu++-4bbeb6208ac33f71a09701cc5251f0412977946e.zip
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.
Diffstat (limited to '')
-rw-r--r--src/tests/cache.cpp30
1 files changed, 29 insertions, 1 deletions
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
8public: 8public:
9 Bob() 9 Bob()
10 { 10 {
11 TRACE();
11 } 12 }
12 13
13 virtual ~Bob() 14 virtual ~Bob()
14 { 15 {
16 TRACE();
17 }
18
19 void setInt( int i )
20 {
21 TRACE();
22 iInt = i;
23 }
24
25 int getInt()
26 {
27 return iInt;
15 } 28 }
16 29
17 long getCacheId() const 30 long getCacheId() const
18 { 31 {
32 TRACE();
19 return 0; 33 return 0;
20 } 34 }
21 35
22 int iInt; 36 int iInt;
23}; 37};
24 38
39DECL_CACHABLE( Bob );
40DEF_CACHABLE( Bob );
41
25int main() 42int main()
26{ 43{
27 Bu::Cache<Bob> bobCache; 44 Bu::Cache<Bob> bobCache;
28 45
29// Bu::CPtr<Bob> pB = bobCache.insert( new Bob() ); 46 Bu::CPtr<Bob> pB1 = bobCache.insert( new Bob() );
47
48 (*pB1).setInt( 44 );
49
50 printf("RefCnt = %d\n", bobCache.getRefCnt( 0 ) );
51
52 Bu::CPtr<Bob> pB2 = bobCache.get( 0 );
53
54 printf("RefCnt = %d\n", bobCache.getRefCnt( 0 ) );
55
56 printf("Int = %d\n", pB2->getInt() );
57
30} 58}
31 59