ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Database
AthenaPOOL
AthenaPoolCnvSvc
src
AthenaAttributeListCnv.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
10
11
#include "
AthenaAttributeListCnv.h
"
12
13
#include "GaudiKernel/ClassID.h"
14
#include "GaudiKernel/DataObject.h"
15
#include "GaudiKernel/MsgStream.h"
16
#include "GaudiKernel/StatusCode.h"
17
18
// AthenaAttributeList and address
19
#include "
AthenaPoolUtilities/AthenaAttributeList.h
"
20
#include "
AthenaPoolUtilities/AthenaAttrListAddress.h
"
21
22
#include "
StoreGate/StoreGateSvc.h
"
23
#include "
StorageSvc/DbType.h
"
24
25
//--------------------------------------------------------------------
26
27
long
int
28
AthenaAttributeListCnv::repSvcType
()
const
{
29
return
(
storageType
());
30
}
31
32
//__________________________________________________________________________
33
AthenaAttributeListCnv::~AthenaAttributeListCnv
() {
34
}
35
//__________________________________________________________________________
36
StatusCode
AthenaAttributeListCnv::initialize
() {
37
MsgStream log(msgSvc(),
"AthenaAttributeListCnv"
);
38
39
log << MSG::DEBUG <<
"initialize() in AthenaAttributeListCnv"
<<
endmsg
;
40
StatusCode status = Converter::initialize();
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
AthenaAttributeListCnv::createObj
(IOpaqueAddress* pAddr, DataObject*& pObj) {
49
50
// This is the "read" method for an AttributeList. Here we only
51
// extract an AthenaAttributeList pointer from an
52
// AthenaAttrListAddress and return it
53
54
MsgStream log(msgSvc(),
"AthenaAttributeListCnv"
);
55
log << MSG::DEBUG <<
"Creating AthenaAttrListAddress Object"
<<
endmsg
;
56
57
AthenaAttrListAddress
* addr =
dynamic_cast<
AthenaAttrListAddress
*
>
(pAddr);
58
59
if
(addr) {
60
// Successful cast
61
pObj =
SG::asStorable
(addr->
attrList
());
62
if
(!pObj) {
63
log << MSG::ERROR <<
"AttributeList ptr is 0 from AthenaAttrListAddress "
<<
endmsg
;
64
return
(StatusCode::FAILURE);
65
}
66
}
else
{
67
log << MSG::ERROR <<
"Could not extract ptr for AthenaAttrListAddress "
<<
endmsg
;
68
return
(StatusCode::FAILURE);
69
}
70
71
return
(StatusCode::SUCCESS);
72
}
73
//__________________________________________________________________________
74
StatusCode
AthenaAttributeListCnv::createRep
(DataObject* pObj, IOpaqueAddress*& pAddr) {
75
76
// This is the "write" method for an AttributeList. Here we only
77
// create an AthenaAttrListAddress and fill it with a pointer to
78
// the AthenaAttributeList
79
80
MsgStream log(msgSvc(),
"AthenaAttributeListCnv"
);
81
log << MSG::DEBUG <<
"Copy AthenaAttributeList ptr into AthenaAttrListAddress"
<<
endmsg
;
82
83
AthenaAttributeList
* list = 0;
//dynamic_cast<AthenaAttributeList*>(pObj);
84
SG::fromStorable
(pObj, list);
85
if
( pAddr !=
nullptr
) pAddr->release();
86
AthenaAttrListAddress
* addr =
new
AthenaAttrListAddress
(
storageType
(),
87
classID
(),
88
"POOLContainer_AthenaAttributeList][CLID=x"
);
89
addr->
setAttrList
(list);
90
pAddr = addr;
91
pAddr->addRef();
92
log << MSG::DEBUG <<
"Created AthenaAttrListAddress with list ptr: "
<< list <<
endmsg
;
93
return
(StatusCode::SUCCESS);
94
}
95
//__________________________________________________________________________
96
long
AthenaAttributeListCnv::storageType
() {
97
return
pool::POOL_StorageType
.type();
98
}
99
//__________________________________________________________________________
100
CLID
AthenaAttributeListCnv::classID
() {
101
return
(
ClassID_traits<AthenaAttributeList>::ID
());
102
}
103
//__________________________________________________________________________
104
AthenaAttributeListCnv::AthenaAttributeListCnv
(ISvcLocator* svcloc) :
105
Converter
(
storageType
(),
classID
(), svcloc) {
106
}
107
//__________________________________________________________________________
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
AthenaAttrListAddress.h
This file contains the class definition for the AthenaAttrListAddress class.
AthenaAttributeListCnv.h
This file contains the class definition for the AthenaAttributeListCnv class.
AthenaAttributeList.h
DbType.h
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
StoreGateSvc.h
AthenaAttrListAddress
This class provides an IOpaqueAddress/GenericAddress which can hold a pointer to an AthenaAttributeLi...
Definition
AthenaAttrListAddress.h:24
AthenaAttrListAddress::attrList
AthenaAttributeList * attrList()
Access to AttributeList.
Definition
AthenaAttrListAddress.h:107
AthenaAttrListAddress::setAttrList
void setAttrList(AthenaAttributeList *attrList)
Add AttributeList.
Definition
AthenaAttrListAddress.h:113
AthenaAttributeListCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
Definition
AthenaAttributeListCnv.cxx:36
AthenaAttributeListCnv::storageType
static long storageType()
Definition
AthenaAttributeListCnv.cxx:96
AthenaAttributeListCnv::repSvcType
virtual long int repSvcType() const
Definition
AthenaAttributeListCnv.cxx:28
AthenaAttributeListCnv::~AthenaAttributeListCnv
virtual ~AthenaAttributeListCnv()
Destructor.
Definition
AthenaAttributeListCnv.cxx:33
AthenaAttributeListCnv::AthenaAttributeListCnv
AthenaAttributeListCnv(ISvcLocator *svcloc)
Constructor.
Definition
AthenaAttributeListCnv.cxx:104
AthenaAttributeListCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create a transient object from a POOL persistent representation.
Definition
AthenaAttributeListCnv.cxx:48
AthenaAttributeListCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create a POOL persistent representation for a transient object.
Definition
AthenaAttributeListCnv.cxx:74
AthenaAttributeListCnv::classID
static CLID classID()
Definition
AthenaAttributeListCnv.cxx:100
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table.
Definition
PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:46
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