summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2013-03-18 15:07:46 +0000
committerMike Buland <eichlan@xagasoft.com>2013-03-18 15:07:46 +0000
commit1db266b863a805d49928d831a690c39df640dc28 (patch)
treed89d38ec82816517805f183ce3fc78a97d13fa8b /src
parentfb5176bbd5355b02b7d0e65da3ef3f0105824cd0 (diff)
downloadlibbu++-1db266b863a805d49928d831a690c39df640dc28.tar.gz
libbu++-1db266b863a805d49928d831a690c39df640dc28.tar.bz2
libbu++-1db266b863a805d49928d831a690c39df640dc28.tar.xz
libbu++-1db266b863a805d49928d831a690c39df640dc28.zip
Corrected compliation issue in the new cache with older GCC versions.
Diffstat (limited to 'src')
-rw-r--r--src/tests/cache.cpp84
-rw-r--r--src/unstable/myriadcache.h2
2 files changed, 43 insertions, 43 deletions
diff --git a/src/tests/cache.cpp b/src/tests/cache.cpp
index dc5dbd0..20b384e 100644
--- a/src/tests/cache.cpp
+++ b/src/tests/cache.cpp
@@ -125,54 +125,54 @@ Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const SubSomethingB &s )
125 125
126namespace Bu 126namespace Bu
127{ 127{
128template<> 128 template<>
129void _cacheObjectSave<const Something>( Bu::Stream &s, const Something *pObject ) 129 void _cacheObjectSave<const Something>( Bu::Stream &s, const Something *pObject )
130{
131 Bu::Archive ar( s, Bu::Archive::save );
132 if( typeid(*pObject) == typeid(SubSomethingA) )
133 {
134 ar << (uint8_t)1 << (SubSomethingA &)*pObject;
135 }
136 else if( typeid(*pObject) == typeid(SubSomethingB) )
137 { 130 {
138 ar << (uint8_t)2 << (SubSomethingB &)*pObject; 131 Bu::Archive ar( s, Bu::Archive::save );
132 if( typeid(*pObject) == typeid(SubSomethingA) )
133 {
134 ar << (uint8_t)1 << (SubSomethingA &)*pObject;
135 }
136 else if( typeid(*pObject) == typeid(SubSomethingB) )
137 {
138 ar << (uint8_t)2 << (SubSomethingB &)*pObject;
139 }
140 else
141 {
142 Bu::println("Not a recognized type!");
143 throw Bu::ExceptionBase("Not recognized type!");
144 }
139 } 145 }
140 else
141 {
142 Bu::println("Not a recognized type!");
143 throw Bu::ExceptionBase("Not recognized type!");
144 }
145}
146 146
147template<> 147 template<>
148Something *_cacheObjectLoad<Something>( Bu::Stream &s ) 148 Something *_cacheObjectLoad<Something>( Bu::Stream &s )
149{
150 Bu::Archive ar( s, Bu::Archive::load );
151 uint8_t uType;
152 ar >> uType;
153 switch( uType )
154 { 149 {
155 case 1: 150 Bu::Archive ar( s, Bu::Archive::load );
156 { 151 uint8_t uType;
157 SubSomethingA *ret = new SubSomethingA(); 152 ar >> uType;
158 ar >> *ret; 153 switch( uType )
159 return ret; 154 {
160 } 155 case 1:
161 break; 156 {
162 157 SubSomethingA *ret = new SubSomethingA();
163 case 2: 158 ar >> *ret;
164 { 159 return ret;
165 SubSomethingB *ret = new SubSomethingB(); 160 }
166 ar >> *ret; 161 break;
167 return ret; 162
168 } 163 case 2:
169 break; 164 {
170 165 SubSomethingB *ret = new SubSomethingB();
171 default: 166 ar >> *ret;
172 throw Bu::ExceptionBase("Flagrant error! Invalid type!"); 167 return ret;
168 }
169 break;
170
171 default:
172 throw Bu::ExceptionBase("Flagrant error! Invalid type!");
173 }
173 } 174 }
174} 175}
175}
176 176
177typedef Bu::CachePtr<Bu::Uuid, Something> SomethingPtr; 177typedef Bu::CachePtr<Bu::Uuid, Something> SomethingPtr;
178typedef Bu::CachePtr<Bu::Uuid, SubSomethingA, Something> SomethingAPtr; 178typedef Bu::CachePtr<Bu::Uuid, SubSomethingA, Something> SomethingAPtr;
diff --git a/src/unstable/myriadcache.h b/src/unstable/myriadcache.h
index f8c0e00..7ff2183 100644
--- a/src/unstable/myriadcache.h
+++ b/src/unstable/myriadcache.h
@@ -55,7 +55,7 @@ namespace Bu
55 55
56 using typename Bu::CacheBase<keytype,obtype>::KeyList; 56 using typename Bu::CacheBase<keytype,obtype>::KeyList;
57 57
58 virtual KeyList getKeys() const 58 virtual typename Bu::CacheBase<keytype,obtype>::KeyList getKeys() const
59 { 59 {
60 Bu::ReadWriteMutex::ReadLocker rl( rwStore ); 60 Bu::ReadWriteMutex::ReadLocker rl( rwStore );
61 return hIndex.getKeys(); 61 return hIndex.getKeys();