diff options
Diffstat (limited to 'src/tests/cache.cpp')
-rw-r--r-- | src/tests/cache.cpp | 30 |
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 | |||
8 | public: | 8 | public: |
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 | ||
39 | DECL_CACHABLE( Bob ); | ||
40 | DEF_CACHABLE( Bob ); | ||
41 | |||
25 | int main() | 42 | int 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 | ||