ATLAS Offline Software
DataLinkCnv_p1.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_p1.icc
6  * @brief This file contains the implementation for the DataLinkCnv_p1 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_p1<DLINK_TYPE>::transToPers(const DLink_t& trans, PersDLink_t& pers, MsgStream& /*log*/) const
16 {
17  DLink_t tmp = trans;
18  tmp.toPersistent(); // ??? May not be needed now.
19  pers.m_SGKeyHash = tmp.key();
20 }
21 
22 template <typename DLINK_TYPE>
23 inline
24 void
25 DataLinkCnv_p1<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_p1< DLINK_TYPE >::persToTrans(const PersDLink_t& pers, DLink_t& trans, MsgStream& /*log*/) const
36 {
37  if ( !pers.m_link.empty() ) {
38  trans.toIdentifiedObject(pers.m_link);
39  if( !trans.toTransient() ) {
40  throw std::runtime_error("persToTrans: failed to convert DataLink.");
41  }
42  }
43  else if (pers.m_SGKeyHash != 0) {
44  trans.toIdentifiedObject (pers.m_SGKeyHash);
45  }
46  else
47  trans.clear();
48 }
49 
50 template <typename DLINK_TYPE >
51 inline
52 void
53 DataLinkCnv_p1< DLINK_TYPE >
54 ::persToTrans(const PersDLink_t* pers, DLink_t* trans, MsgStream& log) const
55 {
56  this->persToTrans(*pers, *trans, log);
57 }