ATLAS Offline Software
Loading...
Searching...
No Matches
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
13template <typename DLINK_TYPE>
14inline
15void 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
22template <typename DLINK_TYPE>
23inline
24void
25DataLinkCnv_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
33template <typename DLINK_TYPE >
34inline
35void 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
50template <typename DLINK_TYPE >
51inline
52void
53DataLinkCnv_p1< DLINK_TYPE >
54::persToTrans(const PersDLink_t* pers, DLink_t* trans, MsgStream& log) const
55{
56 this->persToTrans(*pers, *trans, log);
57}