ATLAS Offline Software
Loading...
Searching...
No Matches
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
9
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
22#include "StorageSvc/DbType.h"
23
24//--------------------------------------------------------------------
25
26long int
28 return(storageType());
29}
30
31//__________________________________________________________________________
34//__________________________________________________________________________
36 MsgStream log(msgSvc(), "CondAttrListVecCnv");
37
38 log << MSG::DEBUG << "initialize() in CondAttrListVecCnv" << endmsg;
39 StatusCode status = Converter::initialize();
40 if (!status.isSuccess()) {
41 log << MSG::ERROR << "Can not initialize Converter base class." << endmsg;
42 return(status);
43 }
44 return(status);
45}
46//__________________________________________________________________________
47StatusCode 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//__________________________________________________________________________
73StatusCode 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//__________________________________________________________________________
98//__________________________________________________________________________
102//__________________________________________________________________________
104 Converter(storageType(), classID(), svcloc) {
105}
106//__________________________________________________________________________
#define endmsg
This file contains the class definition for the CondAttrListVecAddress class.
This file contains the class definition for the CondAttrListVecCnv class.
A CondAttrListVec is an Athena DataObject holding a vector of CORAL AttributeLists,...
uint32_t CLID
The Class ID type.
This class provides an IOpaqueAddress/GenericAddress which can hold a pointer to a CondAttrListVec ob...
CondAttrListVec * attrListVec()
Access to CondAttrListVec.
void setAttrListVec(CondAttrListVec *attrListVec)
Add CondAttrListVec.
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create a transient object from a POOL persistent representation.
virtual long int repSvcType() const
virtual ~CondAttrListVecCnv()
Destructor.
CondAttrListVecCnv(ISvcLocator *svcloc)
Constructor.
static const CLID & classID()
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create a POOL persistent representation for a transient object.
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
static const DbType POOL_StorageType
Definition DbType.h:98