2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
6 * @file AthenaPoolCnvSvc/TPCnvList.icc
7 * @author scott snyder <snyder@bnl.gov>
9 * @brief Helper for calling TP converters from an Athena converter.
13namespace AthenaPoolCnvSvc {
17 * @brief Read the persistent object and convert it to transient.
18 * @param parent The top-level pool converter object.
19 * @param key The SG key of the object being read.
20 * @param msg MsgStream for error reporting.
22 * Returns a newly-allocated object.
23 * If the type of the persistent object on the file does not match the
24 * the type of any of our TP converters, return nullptr.
25 * Other errors are reported by raising exceptions.
27template <class CNV, class TRANS, class ... TPCNVS>
29TPCnvList<CNV, TRANS, TPCNVS...>::createTransient (CNV& parent,
31 const std::string& key,
34 // Try createTransient on each TPCnv; stop when one succeeds.
35 std::unique_ptr<TRANS> result;
36 std::apply([&](auto& ... elt) {
37 (void)(... || (result = elt.createTransient(parent, token, key, msg)));
44 * @brief Read the persistent object and convert it to transient.
45 * @param parent The top-level pool converter object.
46 * @param trans The transient object to modify.
47 * @param key The SG key of the object being read.
48 * @param msg MsgStream for error reporting.
50 * Overwrites the provided transient object.
51 * If the type of the persistent object on the file does not match the
52 * the type of any of our TP converters, return false.
53 * Other errors are reported by raising exceptions.
55template <class CNV, class TRANS, class ... TPCNVS>
56bool TPCnvList<CNV, TRANS, TPCNVS...>::persToTrans (CNV& parent,
59 const std::string& key,
62 // Try persToTrans on each TPCnv; stop when one succeeds.
64 std::apply([&](auto& ... elt) {
65 (void)(... || (found = elt.persToTrans(parent, trans, token, key, msg)));
71} // namespace AthenaPoolCnvSvc