ATLAS Offline Software
CaloRingsContainerCnv.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // CaloRingsContainerCnv.cxx
8 // Implementation file for class CaloRingsContainerCnv
9 // Author: D.E.Ferreira de Lima<dferreir@mail.cern.ch>
11 
12 // STL includes
13 
14 // Framework includes
15 #include "GaudiKernel/MsgStream.h"
16 
17 // RecTPCnv includes
19 
20 // RecAthenaPool includes
21 #include "CaloRingsContainerCnv.h"
22 #include "egammaMsgUtil.h"
23 
27 
31 
33 // Protected methods:
35 
36 
39 {
40  MsgStream msg( msgSvc(), "CaloRingsContainerCnv" );
41 
43  CaloRingsContainer_PERS *persObj = cnv.createPersistent( transCont, msg );
44 
45  MSG_DEBUG(msg, "::createPersistent [Success]");
46  return persObj;
47 }
48 
50 {
51  MsgStream msg( msgSvc(), "CaloRingsContainerCnv" );
52 
53  CaloRingsContainer *transObj = nullptr;
54 
55  static const pool::Guid tr_guid("DA20948A-A38A-11DE-BFE4-001CC0754D20");
56  static const pool::Guid p1_guid("E6E0435E-BFEC-11DE-B657-001CC0754D20");
57 
58  if ( compareClassGuid(p1_guid) ) {
59  // using unique_ptr ensures deletion of the persistent object
60  std::unique_ptr<CaloRingsContainer_p1> persObj( poolReadObject<CaloRingsContainer_p1>() );
62  transObj = cnv.createTransient( persObj.get(), msg );
63  } else if ( compareClassGuid(tr_guid) ) {
64  // regular object from before the T/P separation
65  return poolReadObject<CaloRingsContainer>();
66  } else {
67  throw std::runtime_error("Unsupported persistent version of CaloRingsContainer");
68  }
69 
70  return transObj;
71 }
CaloRingsContainerCnv::createPersistent
virtual CaloRingsContainer_PERS * createPersistent(CaloRingsContainer *transCont)
Build the persistent representation from the transient one.
Definition: CaloRingsContainerCnv.cxx:38
CaloRingsContainerCnv::createTransient
virtual CaloRingsContainer * createTransient()
Build the transient representation from a persistent one.
Definition: CaloRingsContainerCnv.cxx:49
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
CaloRingsContainer
Definition: Reconstruction/egamma/egammaEvent/egammaEvent/CaloRingsContainer.h:15
CaloRingsContainer_p1
Definition: CaloRingsContainer_p1.h:21
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
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
CaloRingsContainerCnv.h
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
egammaMsgUtil.h
MSG_DEBUG
#define MSG_DEBUG(log, x)
Definition: MsgUtil.h:15
TPCnvVector
Definition: TPConverter.h:1256
T_AthenaPoolCustCnv< CaloRingsContainer, CaloRingsContainer_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
CaloRingsContainerCnv_p1.h