diff --git a/LumiBlock/LumiBlockPers/LumiBlockAthenaPool/CMakeLists.txt b/LumiBlock/LumiBlockPers/LumiBlockAthenaPool/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..74c4af4064ba708ba722748658c726cc013f702a --- /dev/null +++ b/LumiBlock/LumiBlockPers/LumiBlockAthenaPool/CMakeLists.txt @@ -0,0 +1,21 @@ +################################################################################ +# Package: LumiBlockAthenaPool +################################################################################ + +# Declare the package name: +atlas_subdir( LumiBlockAthenaPool ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + Database/AthenaPOOL/AthenaPoolUtilities + PRIVATE + Database/AthenaPOOL/AthenaPoolCnvSvc + LumiBlock/LumiBlockData + LumiBlock/LumiBlockPers/LumiBlockTPCnv ) + +# Component(s) in the package: +atlas_add_poolcnv_library( LumiBlockAthenaPoolPoolCnv + src/*.cxx + FILES LumiBlockData/LumiBlockCollection.h + LINK_LIBRARIES AthenaPoolUtilities AthenaPoolCnvSvcLib LumiBlockData LumiBlockTPCnv ) + diff --git a/LumiBlock/LumiBlockPers/LumiBlockAthenaPool/src/LumiBlockCollectionCnv.cxx b/LumiBlock/LumiBlockPers/LumiBlockAthenaPool/src/LumiBlockCollectionCnv.cxx index 1d94a10798b76429970e0199e6b5fe2453c46819..25c21c34321111906b4d8d712bb9523097cb6c16 100755 --- a/LumiBlock/LumiBlockPers/LumiBlockAthenaPool/src/LumiBlockCollectionCnv.cxx +++ b/LumiBlock/LumiBlockPers/LumiBlockAthenaPool/src/LumiBlockCollectionCnv.cxx @@ -8,6 +8,9 @@ ///////////////////////////////////////////////////////////////// #include "LumiBlockCollectionCnv.h" +#include "LumiBlockTPCnv/LumiBlockCollectionCnv_p1.h" +#include "LumiBlockTPCnv/LumiBlockCollectionCnv_p2.h" + LumiBlockCollection_PERS* LumiBlockCollectionCnv::createPersistent(LumiBlockCollection* transCont) { MsgStream log(messageService(), "LumiBlockCollectionConverter" ); @@ -20,10 +23,21 @@ LumiBlockCollection_PERS* LumiBlockCollectionCnv::createPersistent(LumiBlockColl LumiBlockCollection* LumiBlockCollectionCnv::createTransient() { MsgStream log(messageService(), "LumiBlockCollectionConverter" ); static pool::Guid p1_guid("CF1F40C9-6125-4C35-87FF-DDA2C319000C"); - if( compareClassGuid(p1_guid) ) { + static pool::Guid p2_guid("DEF9282A-F174-4382-8248-B94567CD869F"); + + static LumiBlockCollectionCnv_p1 TPConverter_p1; + static LumiBlockCollectionCnv_p2 TPConverter_p2; + + + if( compareClassGuid(p2_guid) ) { + // using auto_ptr ensures deletion of the persistent object + std::auto_ptr< LumiBlockCollection_p2 > col_vect( poolReadObject< LumiBlockCollection_p2 >() ); + return TPConverter_p2.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p1_guid) ) { // using auto_ptr ensures deletion of the persistent object std::auto_ptr< LumiBlockCollection_p1 > col_vect( poolReadObject< LumiBlockCollection_p1 >() ); - return m_TPConverter.createTransient( col_vect.get(), log ); + return TPConverter_p1.createTransient( col_vect.get(), log ); } else { throw std::runtime_error("Unsupported persistent version of LumiBlockCollection"); diff --git a/LumiBlock/LumiBlockPers/LumiBlockAthenaPool/src/LumiBlockCollectionCnv.h b/LumiBlock/LumiBlockPers/LumiBlockAthenaPool/src/LumiBlockCollectionCnv.h index 2bd4b0709ce1d8dcb7eaa47703d8979e6be3150a..1e43e9a72afce6b022c44902ea758715d71650b4 100755 --- a/LumiBlock/LumiBlockPers/LumiBlockAthenaPool/src/LumiBlockCollectionCnv.h +++ b/LumiBlock/LumiBlockPers/LumiBlockAthenaPool/src/LumiBlockCollectionCnv.h @@ -12,12 +12,11 @@ #define LUMIBLOCKCOLLECTIONCNV__H #include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" -#include "LumiBlockTPCnv/LumiBlockCollection_p1.h" #include "LumiBlockData/LumiBlockCollection.h" -#include "LumiBlockTPCnv/LumiBlockCollectionCnv_p1.h" +#include "LumiBlockTPCnv/LumiBlockCollectionCnv_p2.h" // the latest persistent representation type of LumiBlockCollection -typedef LumiBlockCollection_p1 LumiBlockCollection_PERS; +typedef LumiBlockCollection_p2 LumiBlockCollection_PERS; typedef T_AthenaPoolCustomCnv<LumiBlockCollection, LumiBlockCollection_PERS > LumiBlockCollectionCnvBase; class LumiBlockCollectionCnv : public LumiBlockCollectionCnvBase @@ -31,7 +30,7 @@ class LumiBlockCollectionCnv : public LumiBlockCollectionCnvBase // virtual AthenaPoolTopLevelTPCnvBase* getTopLevelTPCnv() { return &m_TPConverter; } private: - LumiBlockCollectionCnv_p1 m_TPConverter; + LumiBlockCollectionCnv_p2 m_TPConverter; }; #endif // LUMIBLOCKCOLLECTIONCNV__H