ATLAS Offline Software
AthExFatObjectCnv.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 // FatObjectCnv.cxx
8 // Implementation file for class FatObjectCnv
9 // Author: S.Binet<binet@cern.ch>
11 
12 // STL includes
13 
14 // Framework includes
15 #include "GaudiKernel/MsgStream.h"
16 #include "GaudiKernel/IToolSvc.h"
17 #include "GaudiKernel/IAlgTool.h"
18 #include "StoreGate/StoreGateSvc.h"
19 
20 // AthExThinning includes
21 #include "AthExFatObjectCnv_p1.h"
22 #include "AthExFatObjectCnv.h"
23 
27 
31 
33 // Protected methods:
35 
36 AthExFatObjectCnv::AthExFatObjectCnv(ISvcLocator* svcLocator) :
38  AthExFatObject_PERS>(svcLocator)
39 {
40  if ( 0 == svcLocator ) {
41  throw std::runtime_error("NULL pointer to ISvcLocator !!");
42  }
43 
44 }
45 
46 
49 {
50  MsgStream msg( msgSvc(), "AthExFatObjectCnv" );
51 
53  AthExFatObject_PERS *persObj = cnv.createPersistent(transCont, msg);
54 
55  msg << MSG::DEBUG << "::createPersistent [Success]" << endmsg;
56  return persObj;
57 }
58 
60 {
61  MsgStream msg( msgSvc(), "AthExFatObjectConverter" );
62 
63  AthExFatObject *transObj = 0;
64 
65  static const pool::Guid p1_guid("C757B4CB-7C1F-4E79-895E-C77D76FB960B");
66 
67  if ( compareClassGuid(p1_guid) ) {
68 
69  // using unique_ptr ensures deletion of the persistent object
70  std::unique_ptr<AthExFatObject_p1> persObj( poolReadObject<AthExFatObject_p1>() );
72  transObj = cnv.createTransient( persObj.get(), msg );
73 
74  } else {
75  throw std::runtime_error("Unsupported persistent version of FatObject");
76  }
77 
78  return transObj;
79 }
AthExFatObjectCnv_p1.h
TPPolyCnvBase::createTransient
virtual TRANS * createTransient(const PERS *persObj, MsgStream &log)
Create transient representation of a persistent object.
AthExFatObjectCnv.h
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
T_AthenaPoolCustomCnv
Compatibility for old converter classes that don't get passed the key.
Definition: T_AthenaPoolCustomCnv.h:132
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
AthExFatObject_p1
Definition: AthExFatObject_p1.h:23
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
AthExFatObjectCnv::AthExFatObjectCnv
AthExFatObjectCnv(ISvcLocator *svcloc)
Create the converter from the service locator.
Definition: AthExFatObjectCnv.cxx:36
AthExFatObjectCnv_p1
Definition: AthExFatObjectCnv_p1.h:39
AthExFatObjectCnv::createPersistent
virtual AthExFatObject_PERS * createPersistent(AthExFatObject *transCont)
Build the persistent representation from the transient one.
Definition: AthExFatObjectCnv.cxx:48
AthExFatObject
Definition: AthExFatObject.h:29
DEBUG
#define DEBUG
Definition: page_access.h:11
T_AthenaPoolCustCnv< AthExFatObject, AthExFatObject_PERS >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
StoreGateSvc.h
AthExFatObjectCnv::createTransient
virtual AthExFatObject * createTransient()
Build the transient representation from a persistent one.
Definition: AthExFatObjectCnv.cxx:59