ATLAS Offline Software
egDetailContainerCnv.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // egDetailContainerCnv.cxx
8 // Implementation file for class egDetailContainerCnv
9 // Author: K.Cranmer<cranmer@cern.ch>
10 // Author: S.Binet<binet@cern.ch>
12 
13 // STL includes
14 
15 // Framework includes
16 #include "GaudiKernel/MsgStream.h"
17 
18 // egammaEventTPCnv includes
21 
22 // RecAthenaPool includes
23 #include "egDetailContainerCnv.h"
24 #include "egammaMsgUtil.h"
25 
29 
33 
35 // Protected methods:
37 
38 
41 {
42  MsgStream msg( msgSvc(), "egDetailContainerCnv" );
43 
45  egDetailContainer_PERS *persObj = cnv.createPersistent( transCont, msg );
46 
47  MSG_DEBUG(msg, "::createPersistent [Success]");
48  return persObj;
49 }
50 
52 {
53  MsgStream msg( msgSvc(), "egDetailContainerCnv" );
54 
55  egDetailContainer *transObj = nullptr;
56 
57  static const pool::Guid tr_guid("F8C02E11-E6C5-4843-A57D-3DB2EFACCC5B");
58  static const pool::Guid p1_guid("C3E26ADE-A984-41AC-83DF-F430F6DF1F1F");
59  static const pool::Guid p2_guid("6AB9ADFD-836F-416D-B343-3DDF7D4F6E18");
60 
61  if ( compareClassGuid(tr_guid) ) {
62 
63  // regular object from before the T/P separation
64  return poolReadObject<egDetailContainer>();
65 
66  } if ( compareClassGuid(p1_guid) ) {
67 
68  // using unique_ptr ensures deletion of the persistent object
69  std::unique_ptr<egDetailContainer_p1> persObj( poolReadObject<egDetailContainer_p1>() );
71  transObj = cnv.createTransient( persObj.get(), msg );
72  } else if ( compareClassGuid(p2_guid) ) {
73 
74  // using unique_ptr ensures deletion of the persistent object
75  std::unique_ptr<egDetailContainer_p2> persObj( poolReadObject<egDetailContainer_p2>() );
77  transObj = cnv.createTransient( persObj.get(), msg );
78  } else {
79  throw std::runtime_error("Unsupported persistent version of egDetailContainer");
80  }
81 
82  return transObj;
83 }
84 
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
egDetailContainerCnv_p2
Definition: egDetailContainerCnv_p2.h:29
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
egDetailContainer_p2
Definition: egDetailContainer_p2.h:21
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
egDetailContainerCnv_p1
Definition: egDetailContainerCnv_p1.h:31
egammaMsgUtil.h
egDetailContainerCnv.h
egDetailContainerCnv::createPersistent
virtual egDetailContainer_PERS * createPersistent(egDetailContainer *transCont)
Build the persistent representation from the transient one.
Definition: egDetailContainerCnv.cxx:40
MSG_DEBUG
#define MSG_DEBUG(log, x)
Definition: MsgUtil.h:15
egDetailContainerCnv_p1.h
T_AthenaPoolCustCnv< egDetailContainer, egDetailContainer_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
egDetailContainer
Definition: egDetailContainer.h:18
egDetailContainerCnv::createTransient
virtual egDetailContainer * createTransient()
Build the transient representation from a persistent one.
Definition: egDetailContainerCnv.cxx:51
egDetailContainerCnv_p2.h