ATLAS Offline Software
CondAttrListCollCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
11 #include "CondAttrListCollCnv.h"
12 
13 #include "GaudiKernel/ClassID.h"
14 #include "GaudiKernel/DataObject.h"
15 #include "GaudiKernel/MsgStream.h"
16 #include "GaudiKernel/StatusCode.h"
17 
18 // CondAttrListCollection and address
21 
22 #include "StoreGate/StoreGateSvc.h"
23 #include "StorageSvc/DbType.h"
24 
25 //--------------------------------------------------------------------
26 
27 long int
29  return(storageType());
30 }
31 
32 //__________________________________________________________________________
34 }
35 //__________________________________________________________________________
37  MsgStream log(msgSvc(), "CondAttrListCollCnv");
38 
39  log << MSG::DEBUG << "initialize() in CondAttrListCollCnv" << endmsg;
41  if (!status.isSuccess()) {
42  log << MSG::ERROR << "Can not initialize Converter base class." << endmsg;
43  return(status);
44  }
45  return(status);
46 }
47 //__________________________________________________________________________
48 StatusCode CondAttrListCollCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj) {
49 
50  // This is the "read" method for an CondAttrListCollection. Here
51  // we only extract an CondAttrListCollection pointer from an
52  // CondAttrListCollAddress and return it
53 
54  MsgStream log(msgSvc(), "CondAttrListCollCnv");
55  log << MSG::DEBUG << "Creating CondAttrListCollAddress Object" << endmsg;
56 
57  CondAttrListCollAddress* addr = dynamic_cast<CondAttrListCollAddress*>(pAddr);
58 
59  if (addr) {
60  // Successful cast
61  pObj = SG::asStorable(addr->attrListColl());
62  if (!pObj) {
63  log << MSG::ERROR << "CondAttrListCollection ptr is 0 from CondAttrListCollAddress " << endmsg;
64  return(StatusCode::FAILURE);
65  }
66  }
67  else {
68  log << MSG::ERROR << "Could not extract ptr for CondAttrListCollAddress " << endmsg;
69  return(StatusCode::FAILURE);
70  }
71 
72  return(StatusCode::SUCCESS);
73 }
74 //__________________________________________________________________________
75 StatusCode CondAttrListCollCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr) {
76 
77  // This is the "write" method for an CondAttrListCollection. Here
78  // we only create an CondAttrListCollAddress and fill it with a
79  // pointer to the CondAttrListCollection
80 
81  MsgStream log(msgSvc(), "CondAttrListCollCnv");
82  log << MSG::DEBUG << "Copy CondAttrListCollection ptr into CondAttrListCollAddress" << endmsg;
83 
84  CondAttrListCollection* list = 0; //dynamic_cast<CondAttrListCollection*>(pObj);
85  SG::fromStorable(pObj, list);
86  if ( pAddr != nullptr ) pAddr->release();
88  classID(),
89  "POOLContainer_CondAttrListCollection][CLID=x");
90  addr->setAttrListColl(list);
91  pAddr = addr;
92  pAddr->addRef();
93 
94  log << MSG::DEBUG << "Created CondAttrListCollAddress with list ptr: " << list << endmsg;
95  return(StatusCode::SUCCESS);
96 }
97 //__________________________________________________________________________
99  return pool::POOL_StorageType.type();
100 }
101 //__________________________________________________________________________
104 }
105 //__________________________________________________________________________
107  Converter(storageType(), classID(), svcloc) {
108 }
109 //__________________________________________________________________________
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
CondAttrListCollAddress.h
This file contains the class definition for the CondAttrListCollAddress class.
SG::fromStorable
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
Definition: StorableConversions.h:169
CondAttrListCollCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
Definition: CondAttrListCollCnv.cxx:36
initialize
void initialize()
Definition: run_EoverP.cxx:894
DbType.h
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:51
CondAttrListCollCnv.h
This file contains the class definition for the CondAttrListCollCnv class.
pool::DbType::type
int type() const
Access to full type.
Definition: DbType.h:66
CondAttrListCollAddress
This class provides an IOpaqueAddress/GenericAddress which can hold a pointer to a CondAttrListCollec...
Definition: CondAttrListCollAddress.h:24
SG::asStorable
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
Definition: DataObjectSharedPtr.h:31
CondAttrListCollCnv::repSvcType
virtual long int repSvcType() const
Definition: CondAttrListCollCnv.cxx:28
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
CondAttrListCollCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create a transient object from a POOL persistent representation.
Definition: CondAttrListCollCnv.cxx:48
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:37
CondAttrListCollAddress::setAttrListColl
void setAttrListColl(CondAttrListCollection *attrListColl)
Add AttributeList.
Definition: CondAttrListCollAddress.h:123
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
CondAttrListCollCnv::classID
static const CLID & classID()
Definition: CondAttrListCollCnv.cxx:102
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
CondAttrListCollAddress::attrListColl
CondAttrListCollection * attrListColl()
Access to AttributeList.
Definition: CondAttrListCollAddress.h:117
Converter
Definition: Converter.h:27
CondAttrListCollCnv::CondAttrListCollCnv
CondAttrListCollCnv(ISvcLocator *svcloc)
Constructor.
Definition: CondAttrListCollCnv.cxx:106
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
CondAttrListCollCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create a POOL persistent representation for a transient object.
Definition: CondAttrListCollCnv.cxx:75
merge.status
status
Definition: merge.py:16
StoreGateSvc.h
CondAttrListCollCnv::storageType
static long storageType()
Definition: CondAttrListCollCnv.cxx:98
CondAttrListCollCnv::~CondAttrListCollCnv
virtual ~CondAttrListCollCnv()
Destructor.
Definition: CondAttrListCollCnv.cxx:33