2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
6/** @file T_AthenaPoolExtendingCnv.icc
7 * @brief his file contains method definitions for the templated T_AthenaPoolExtendingCnv class.
8 * @author Marcin.Nowak@cern.ch
13template <class TRANS, class PERS>
14T_AthenaPoolExtendingCnv< TRANS, PERS >::T_AthenaPoolExtendingCnv(ISvcLocator* svcloc) :
15 T_AthenaPoolCustomCnv<TRANS, PERS>( svcloc ),
16 m_originalExtendingCnv( 0 )
21template <class TRANS, class PERS>
22inline const std::string
23T_AthenaPoolExtendingCnv< TRANS, PERS >::name() const
25 return std::to_string(this->objType());
29template <class TRANS, class PERS>
31T_AthenaPoolExtendingCnv< TRANS, PERS >::
32wasClonedFrom( AthenaConverterTLPExtension *converter )
34 if( !converter->needsCloning() ) {
35 // converter doesn't have any reference to an original converter - must be the original itself
36 m_originalExtendingCnv = dynamic_cast< BaseType* >(converter);
38 // in case of cloning a clone, get the real original converter
39 auto* extcnv = dynamic_cast< T_AthenaPoolExtendingCnv< TRANS, PERS >* >(converter);
40 if (!extcnv) std::abort();
41 m_originalExtendingCnv = extcnv->baseAthenaPoolCnv();
43// std::cout << " TPCNVINFO: Registering clone source " << (void*)m_originalExtendingCnv << std::endl;
48template <class TRANS, class PERS>
51T_AthenaPoolExtendingCnv< TRANS, PERS >::
52poolReadObject(const Token* token)
54 // std::cout << " TPCNVINFO: redirecting poolReadObject() to original APcnv" << std::endl;
55 return baseAthenaPoolCnv()->template poolReadObject<P>(token);
60template <class TRANS, class PERS>
63T_AthenaPoolExtendingCnv< TRANS, PERS >::
64poolReadObject( TopLevelTPCnvBase& tlp_converter, const Token* token )
66 // set which Top level TP concerter will by used for reading
67 usingTPCnvForReading( tlp_converter );
69 P* persObj = poolReadObject< P >( token );
70 // remember the object we just read
71 tlp_converter.setTLPersObject( persObj );
76template <class TRANS, class PERS>
77std::unique_ptr<const Token>
78T_AthenaPoolExtendingCnv< TRANS, PERS >::writeObject(const std::string& key, const std::string& output)
80 std::unique_ptr<Token> pTok;
81 PERS *persObj = reinterpret_cast<PERS*>( getTopLevelTPCnv()->getTLPersObjectAsVoid() );
83 //MN - do not pass SG key - this will put the object in a separate container
84 if( !baseAthenaPoolCnv()->objectToPool( persObj, pTok, key, output ).isSuccess() ) {
85 throw std::runtime_error("Component persistent object write failed");
87 getTopLevelTPCnv()->clearTLPersObject();
88 std::size_t cpos = output.find(':');
89 std::size_t bpos = output.find('[');
90 if (cpos == std::string::npos) {
95 if (bpos != std::string::npos) bpos = bpos - cpos;
96 baseAthenaPoolCnv()->keepPoolObj(persObj , output.substr(cpos, bpos));