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