ATLAS Offline Software
DataLinkCnv_p2.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 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  DLink_t tmp = trans; // ??? May not be needed now.
20  pers.m_SGKeyHash = tmp.key();
21 }
22 
23 template <typename DLINK_TYPE>
24 inline
25 void
26 DataLinkCnv_p2<DLINK_TYPE>
27 ::transToPers(const DLink_t* trans, PersDLink_t* pers, MsgStream& log) const
28 {
29  this->transToPers(*trans, *pers, log);
30 }
31 
32 
33 
34 template <typename DLINK_TYPE >
35 inline
36 void DataLinkCnv_p2< DLINK_TYPE >::persToTrans (const PersDLink_t& pers,
37  DLink_t& trans,
38  MsgStream& /*log*/) const
39 {
40  if( pers.m_SGKeyHash ) {
41  trans.toIdentifiedObject( pers.m_SGKeyHash );
42  if( !trans.toTransient() ) {
43  throw std::runtime_error("DataLinkCnv_p2::persToTrans: failed to convert DataLink.");
44  }
45  } else
46  trans.clear();
47 }
48 
49 template <typename DLINK_TYPE >
50 inline
51 void
52 DataLinkCnv_p2< DLINK_TYPE >
53 ::persToTrans(const PersDLink_t* pers, DLink_t* trans, MsgStream& log) const
54 {
55  this->persToTrans(*pers, *trans, log);
56 }