ATLAS Offline Software
T_AuxContainerCopyTPCnv.icc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
3  */
4 /**
5  * @file AthenaPoolCnvSvc/T_AuxContainerCopyTPCnv.icc
6  * @author scott snyder <snyder@bnl.gov>
7  * @date Oct, 2019
8  * @brief Convert aux container version by generic copy.
9  */
10 
11 
12 template <class NEWTYPE, class OLDTYPE>
13 void T_AuxContainerCopyTPCnv<NEWTYPE, OLDTYPE>::
14 persToTrans( const OLDTYPE* oldObj,
15  NEWTYPE* newObj,
16  MsgStream& log ) const
17 {
18  // Greet the user:
19  if( log.level() <= MSG::DEBUG ) {
20  log << MSG::DEBUG << "Converting " << ClassName<OLDTYPE>::name()
21  << " to " << ClassName<NEWTYPE>::name() << "..." << endmsg;
22  }
23 
24  // Clear the transient object:
25  newObj->resize( 0 );
26 
27  // Copy the payload of the v1 object into the latest one by misusing
28  // the thinning code a bit...
29  SG::copyAuxStoreThinned( *oldObj, *newObj, nullptr);
30 
31  // Print what happened:
32  if( log.level() <= MSG::DEBUG ) {
33  log << MSG::DEBUG << "Converting " << ClassName<OLDTYPE>::name()
34  << " to " << ClassName<NEWTYPE>::name() << " [OK]" << endmsg;
35  }
36 
37  return;
38 }
39 
40 /// This function should never be called, as we are not supposed to convert
41 /// object before writing.
42 ///
43 template <class NEWTYPE, class OLDTYPE>
44 void T_AuxContainerCopyTPCnv<NEWTYPE, OLDTYPE>::
45 transToPers( const NEWTYPE*,
46  OLDTYPE*,
47  MsgStream& log ) const
48 {
49  log << MSG::ERROR
50  << "Somebody called transToPers for "
51  << ClassName<OLDTYPE>::name() << endmsg;
52  throw std::runtime_error( "Somebody called transToPers for " +
53  ClassName<OLDTYPE>::name() );
54 
55  return;
56 }
57 
58