From 1db266b863a805d49928d831a690c39df640dc28 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 18 Mar 2013 15:07:46 +0000 Subject: Corrected compliation issue in the new cache with older GCC versions. --- src/tests/cache.cpp | 84 ++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'src/tests') 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 ) namespace Bu { -template<> -void _cacheObjectSave( Bu::Stream &s, const Something *pObject ) -{ - Bu::Archive ar( s, Bu::Archive::save ); - if( typeid(*pObject) == typeid(SubSomethingA) ) - { - ar << (uint8_t)1 << (SubSomethingA &)*pObject; - } - else if( typeid(*pObject) == typeid(SubSomethingB) ) + template<> + void _cacheObjectSave( Bu::Stream &s, const Something *pObject ) { - ar << (uint8_t)2 << (SubSomethingB &)*pObject; + Bu::Archive ar( s, Bu::Archive::save ); + if( typeid(*pObject) == typeid(SubSomethingA) ) + { + ar << (uint8_t)1 << (SubSomethingA &)*pObject; + } + else if( typeid(*pObject) == typeid(SubSomethingB) ) + { + ar << (uint8_t)2 << (SubSomethingB &)*pObject; + } + else + { + Bu::println("Not a recognized type!"); + throw Bu::ExceptionBase("Not recognized type!"); + } } - else - { - Bu::println("Not a recognized type!"); - throw Bu::ExceptionBase("Not recognized type!"); - } -} -template<> -Something *_cacheObjectLoad( Bu::Stream &s ) -{ - Bu::Archive ar( s, Bu::Archive::load ); - uint8_t uType; - ar >> uType; - switch( uType ) + template<> + Something *_cacheObjectLoad( Bu::Stream &s ) { - case 1: - { - SubSomethingA *ret = new SubSomethingA(); - ar >> *ret; - return ret; - } - break; - - case 2: - { - SubSomethingB *ret = new SubSomethingB(); - ar >> *ret; - return ret; - } - break; - - default: - throw Bu::ExceptionBase("Flagrant error! Invalid type!"); + Bu::Archive ar( s, Bu::Archive::load ); + uint8_t uType; + ar >> uType; + switch( uType ) + { + case 1: + { + SubSomethingA *ret = new SubSomethingA(); + ar >> *ret; + return ret; + } + break; + + case 2: + { + SubSomethingB *ret = new SubSomethingB(); + ar >> *ret; + return ret; + } + break; + + default: + throw Bu::ExceptionBase("Flagrant error! Invalid type!"); + } } } -} typedef Bu::CachePtr SomethingPtr; typedef Bu::CachePtr SomethingAPtr; -- cgit v1.2.3