ATLAS Offline Software
INav4MomAssocsCnv.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 // INav4MomAssocsCnv.cxx
8 // Implementation file for class INav4MomAssocsCnv
9 // Author: S.Binet<binet@cern.ch>
11 
12 // STL includes
13 
14 // Framework includes
15 #include "GaudiKernel/MsgStream.h"
16 #include "StoreGate/StoreGateSvc.h"
17 
18 // EventCommonAthenaPool includes
19 #include "INav4MomAssocsCnv.h"
20 
24 
25 INav4MomAssocsCnv::INav4MomAssocsCnv( ISvcLocator* svcLocator ) :
27 {
28  if ( 0 == svcLocator ) {
29  throw std::runtime_error("NULL pointer to ISvcLocator !!");
30  }
31 
32  if ( svcLocator->service("StoreGateSvc",m_storeGate).isFailure() ||
33  0 == m_storeGate ) {
34  throw std::runtime_error("Could not fetch StoreGateSvc !!");
35  }
36 }
37 
41 
43 // Protected methods:
45 
46 
49 {
50  MsgStream log( msgSvc(), "INav4MomAssocsCnv" );
51 
53 
54  log << MSG::DEBUG << "::createPersistent [Success]" << endmsg;
55  return persObj;
56 }
57 
59 {
60  MsgStream log( msgSvc(), "INav4MomAssocsConverter" );
61 
62  INav4MomAssocs *transObj = 0;
63 
64  static const pool::Guid tr_guid("DF941034-CCB2-4A1A-9A8C-5F3D5EAFD08C");
65  static const pool::Guid p1_guid("85027AE1-4FD4-4808-B151-5485634ACD5D");
66  static const pool::Guid p2_guid("8040BEAA-BC65-43B8-B468-A7157C89ACB3");
67  static const pool::Guid p3_guid("455AEE6B-9834-4E72-8F81-2532A52E3BE7");
68 
69  if( compareClassGuid(p3_guid) ) {
70  // using unique_ptr ensures deletion of the persistent object
71  std::unique_ptr<INav4MomAssocs_p3> persObj( poolReadObject<INav4MomAssocs_p3>() );
72  transObj = m_tpConverter_p3.createTransient( persObj.get(), log );
73  }
74  else if ( compareClassGuid(p2_guid) ) {
75  // using unique_ptr ensures deletion of the persistent object
76  std::unique_ptr<INav4MomAssocs_p2> persObj( poolReadObject<INav4MomAssocs_p2>() );
77  transObj = m_tpConverter_p2.createTransient( persObj.get(), log );
78  }
79  else if( compareClassGuid(p1_guid) ) {
80  // using unique_ptr ensures deletion of the persistent object
81  std::unique_ptr<INav4MomAssocs_p1> persObj( poolReadObject<INav4MomAssocs_p1>() );
83  transObj = cnv.createTransient( persObj.get(), log );
84  }
85  else if( compareClassGuid(tr_guid) ) {
86  // regular object from before the T/P separation
87  return poolReadObject<INav4MomAssocs>();
88  }
89  else {
90  throw std::runtime_error("Unsupported persistent version of INav4MomAssocs");
91  }
92 
93  return transObj;
94 }
INav4MomAssocsCnv.h
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
INav4MomAssocsCnv::createPersistent
virtual INav4MomAssocs_PERS * createPersistent(INav4MomAssocs *transCont)
Build the persistent representation from the transient one.
Definition: INav4MomAssocsCnv.cxx:48
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
INav4MomAssocsCnv::INav4MomAssocsCnv
INav4MomAssocsCnv(ISvcLocator *svcloc)
Create the converter from the service locator.
Definition: INav4MomAssocsCnv.cxx:25
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
INav4MomAssocs_p3
Definition: INav4MomAssocs_p3.h:27
INav4MomAssocsCnv::m_tpConverter_p2
INav4MomAssocsCnv_p2 m_tpConverter_p2
Definition: INav4MomAssocsCnv.h:75
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
T_AthenaPoolCustomCnv
Compatibility for old converter classes that don't get passed the key.
Definition: T_AthenaPoolCustomCnv.h:132
INav4MomAssocsCnv::m_tpConverter_p3
INav4MomAssocsCnv_p3 m_tpConverter_p3
Definition: INav4MomAssocsCnv.h:74
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
INav4MomAssocs
Definition: INav4MomAssocs.h:33
INav4MomAssocsCnv::createTransient
virtual INav4MomAssocs * createTransient()
Build the transient representation from a persistent one.
Definition: INav4MomAssocsCnv.cxx:58
INav4MomAssocsCnv_p1
Definition: INav4MomAssocsCnv_p1.h:36
INav4MomAssocsCnv::m_storeGate
StoreGateSvc * m_storeGate
Pointer to the StoreGateSvc.
Definition: INav4MomAssocsCnv.h:72
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
T_AthenaPoolCustCnv< INav4MomAssocs, INav4MomAssocs_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
StoreGateSvc.h