ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Database
AthenaPOOL
AthenaPoolCnvSvc
src
CondAttrListVecCnv.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 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
18
#include "
AthenaPoolUtilities/CondAttrListVec.h
"
19
#include "
AthenaPoolUtilities/CondAttrListVecAddress.h
"
20
21
#include "
StoreGate/StoreGateSvc.h
"
22
#include "
StorageSvc/DbType.h
"
23
24
//--------------------------------------------------------------------
25
26
long
int
27
CondAttrListVecCnv::repSvcType
()
const
{
28
return
(
storageType
());
29
}
30
31
//__________________________________________________________________________
32
CondAttrListVecCnv::~CondAttrListVecCnv
() {
33
}
34
//__________________________________________________________________________
35
StatusCode
CondAttrListVecCnv::initialize
() {
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
//__________________________________________________________________________
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();
85
CondAttrListVecAddress
* addr =
new
CondAttrListVecAddress
(
storageType
(),
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
//__________________________________________________________________________
95
long
CondAttrListVecCnv::storageType
() {
96
return
pool::POOL_StorageType
.type();
97
}
98
//__________________________________________________________________________
99
CLID
CondAttrListVecCnv::classID
() {
100
return
(
ClassID_traits<CondAttrListVec>::ID
());
101
}
102
//__________________________________________________________________________
103
CondAttrListVecCnv::CondAttrListVecCnv
(ISvcLocator* svcloc) :
104
Converter
(
storageType
(),
classID
(), svcloc) {
105
}
106
//__________________________________________________________________________
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
CondAttrListVecAddress.h
This file contains the class definition for the CondAttrListVecAddress class.
CondAttrListVecCnv.h
This file contains the class definition for the CondAttrListVecCnv class.
CondAttrListVec.h
A CondAttrListVec is an Athena DataObject holding a vector of CORAL AttributeLists,...
DbType.h
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
StoreGateSvc.h
CondAttrListVecAddress
This class provides an IOpaqueAddress/GenericAddress which can hold a pointer to a CondAttrListVec ob...
Definition
CondAttrListVecAddress.h:22
CondAttrListVecAddress::attrListVec
CondAttrListVec * attrListVec()
Access to CondAttrListVec.
Definition
CondAttrListVecAddress.h:117
CondAttrListVecAddress::setAttrListVec
void setAttrListVec(CondAttrListVec *attrListVec)
Add CondAttrListVec.
Definition
CondAttrListVecAddress.h:123
CondAttrListVecCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create a transient object from a POOL persistent representation.
Definition
CondAttrListVecCnv.cxx:47
CondAttrListVecCnv::repSvcType
virtual long int repSvcType() const
Definition
CondAttrListVecCnv.cxx:27
CondAttrListVecCnv::storageType
static long storageType()
Definition
CondAttrListVecCnv.cxx:95
CondAttrListVecCnv::classID
static CLID classID()
Definition
CondAttrListVecCnv.cxx:99
CondAttrListVecCnv::~CondAttrListVecCnv
virtual ~CondAttrListVecCnv()
Destructor.
Definition
CondAttrListVecCnv.cxx:32
CondAttrListVecCnv::CondAttrListVecCnv
CondAttrListVecCnv(ISvcLocator *svcloc)
Constructor.
Definition
CondAttrListVecCnv.cxx:103
CondAttrListVecCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create a POOL persistent representation for a transient object.
Definition
CondAttrListVecCnv.cxx:73
CondAttrListVecCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
Definition
CondAttrListVecCnv.cxx:35
CondAttrListVec
Definition
CondAttrListVec.h:31
Converter::Converter
Converter()
Definition
Converter.h:29
SG::fromStorable
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
Definition
StorableConversions.h:169
SG::asStorable
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
Definition
DataObjectSharedPtr.h:31
pool::POOL_StorageType
static const DbType POOL_StorageType
Definition
DbType.h:84
ClassID_traits::ID
static constexpr CLID ID()
Definition
Control/AthenaKernel/AthenaKernel/ClassID_traits.h:44
Generated on
for ATLAS Offline Software by
1.17.0