ATLAS Offline Software
DataLinkCnv_p2.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /** @file DataLinkCnv_p2.icc
6  * @brief This file contains the implementation for the DataLinkCnv_p2 template methods.
7  * @author Marcin.Nowak@cern.ch
8  **/
9 
10 #include <stdexcept>
11 
12 
13 template <typename DLINK_TYPE>
14 inline
15 void DataLinkCnv_p2<DLINK_TYPE>::transToPers (const DLink_t& trans,
16  PersDLink_t& pers,
17  MsgStream& /*log*/) const
18 {
19  pers.m_SGKeyHash = trans.key();
20 }
21 
22 template <typename DLINK_TYPE>
23 inline
24 void
25 DataLinkCnv_p2<DLINK_TYPE>
26 ::transToPers(const DLink_t* trans, PersDLink_t* pers, MsgStream& log) const
27 {
28  this->transToPers(*trans, *pers, log);
29 }
30 
31 
32 
33 template <typename DLINK_TYPE >
34 inline
35 void DataLinkCnv_p2< DLINK_TYPE >::persToTrans (const PersDLink_t& pers,
36  DLink_t& trans,
37  MsgStream& /*log*/) const
38 {
39  if( pers.m_SGKeyHash ) {
40  trans.toIdentifiedObject( pers.m_SGKeyHash );
41  if( !trans.toTransient() ) {
42  throw std::runtime_error("DataLinkCnv_p2::persToTrans: failed to convert DataLink.");
43  }
44  } else
45  trans.clear();
46 }
47 
48 template <typename DLINK_TYPE >
49 inline
50 void
51 DataLinkCnv_p2< DLINK_TYPE >
52 ::persToTrans(const PersDLink_t* pers, DLink_t* trans, MsgStream& log) const
53 {
54  this->persToTrans(*pers, *trans, log);
55 }