2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
7 * @file AthenaPoolCnvSvc/T_AthenaPoolTPCnvCnv.icc
8 * @author scott snyder <snyder@bnl.gov>
10 * @brief Athena pool converter for a class using TP separation.
16 * @param svcLoc Gaudi service locator.
18 template <class TRANS, class TPCNV_CUR, class ... TPCNVS>
19 T_AthenaPoolTPCnvCnv<TRANS, TPCNV_CUR, TPCNVS...>::T_AthenaPoolTPCnvCnv( ISvcLocator* svcLoc )
21 m_guid (AthenaPoolCnvSvc::guidFromTypeinfo (typeid (Pers_t)))
27 * @brief Convert a transient object to persistent form.
28 * @param key The SG key of the object being written.
29 * @param trans The transient object to convert.
31 * Returns a newly-allocated persistent object.
33 template <class TRANS, class TPCNV_CUR, class ... TPCNVS>
34 typename T_AthenaPoolTPCnvCnv<TRANS, TPCNV_CUR, TPCNVS...>::Pers_t*
35 T_AthenaPoolTPCnvCnv<TRANS, TPCNV_CUR, TPCNVS...>::createPersistentWithKey( TRANS* trans,
36 const std::string& key)
38 AthenaPoolCnvSvc::debugCreatePersistent (ClassID_traits<TRANS>::ID());
39 return AthenaPoolCnvSvc::createPersistent (m_tpcnv_cur, trans, key, this->msg()).release();
44 * @brief Read the persistent object and convert it to transient.
45 * @param key The SG key of the object being read.
47 * Returns a newly-allocated transient object.
48 * Errors are reported by raising exceptions.
50 template <class TRANS, class TPCNV_CUR, class ... TPCNVS>
52 T_AthenaPoolTPCnvCnv<TRANS, TPCNV_CUR, TPCNVS...>::createTransientWithKey (const std::string& key)
54 AthenaPoolCnvSvc::debugCreateTransient (ClassID_traits<TRANS>::ID());
55 if ( this->compareClassGuid( m_guid ) ) {
56 // It's the latest version.
57 std::unique_ptr<Pers_t> persObj( this->template poolReadObject<Pers_t>() );
58 return AthenaPoolCnvSvc::createTransient (m_tpcnv_cur, persObj.get(), key, this->msg()).release();
62 std::unique_ptr<TRANS> c = m_tpcnvs.createTransient (*this, key, this->msg());
66 // Didn't recognize the GUID.
67 AthenaPoolCnvSvc::throwExcUnsupportedVersion (typeid(TRANS),
68 this->m_i_poolToken->classID());