aboutsummaryrefslogtreecommitdiff
path: root/src/tests/cachedel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/cachedel.cpp')
-rw-r--r--src/tests/cachedel.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/tests/cachedel.cpp b/src/tests/cachedel.cpp
index 817757c..f4cb1b5 100644
--- a/src/tests/cachedel.cpp
+++ b/src/tests/cachedel.cpp
@@ -21,6 +21,12 @@ public:
21 21
22 virtual ~Something() 22 virtual ~Something()
23 { 23 {
24 //Bu::println("Deleting %1").arg( this->toString() );
25 }
26
27 void sayHi()
28 {
29 Bu::println("Hello %1").arg( toString() );
24 } 30 }
25 31
26 virtual Bu::Uuid getKey() const 32 virtual Bu::Uuid getKey() const
@@ -39,7 +45,7 @@ public:
39 changed(); 45 changed();
40 } 46 }
41 47
42 virtual Bu::String toString() const=0; 48 virtual Bu::String toString() const=0;// { return Bu::String("ERROR"); };
43 49
44private: 50private:
45 Bu::Uuid uId; 51 Bu::Uuid uId;
@@ -60,6 +66,11 @@ public:
60 iNumber( iNumber ) 66 iNumber( iNumber )
61 { 67 {
62 } 68 }
69
70 virtual ~SubSomethingA()
71 {
72 Bu::println("Deleting-A %1").arg( this->toString() );
73 }
63 74
64 virtual Bu::String toString() const 75 virtual Bu::String toString() const
65 { 76 {
@@ -84,6 +95,10 @@ public:
84 sString( sString ) 95 sString( sString )
85 { 96 {
86 } 97 }
98
99 virtual ~SubSomethingB()
100 {
101 }
87 102
88 virtual Bu::String toString() const 103 virtual Bu::String toString() const
89 { 104 {
@@ -187,6 +202,11 @@ int main( int, char *[] )
187 Bu::MemBuf mbStore; 202 Bu::MemBuf mbStore;
188 SomethingCache c( mbStore ); 203 SomethingCache c( mbStore );
189 204
205 {
206 SubSomethingA a("Test", 1);
207 a.sayHi();
208 }
209
190 SomethingPtr ptr; 210 SomethingPtr ptr;
191 if( time(NULL)%2 ) 211 if( time(NULL)%2 )
192 ptr = c.insert( new SubSomethingA("Hello", 55) ).cast<Something>(); 212 ptr = c.insert( new SubSomethingA("Hello", 55) ).cast<Something>();
@@ -205,8 +225,13 @@ int main( int, char *[] )
205 225
206 SomethingPtr p2 = c.insert( new SubSomethingA("new test", 123) ).cast<Something>(); 226 SomethingPtr p2 = c.insert( new SubSomethingA("new test", 123) ).cast<Something>();
207 id = p2.getKey(); 227 id = p2.getKey();
228 Bu::println("p2 %1: %2").arg( id ).arg( c.has( id ) );
208 p2.unbind(); 229 p2.unbind();
230 Bu::println("p2 %1: %2").arg( id ).arg( c.has( id ) );
209 c.erase( id ); 231 c.erase( id );
232 Bu::println("p2 %1: %2").arg( id ).arg( c.has( id ) );
233
234 Bu::println("Program listing over, leaving main scope.");
210 235
211 return 0; 236 return 0;
212} 237}