ATLAS Offline Software
AthenaAttributeListCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
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
21 
22 #include "StoreGate/StoreGateSvc.h"
23 
24 //--------------------------------------------------------------------
25 
26 long int
28  return(storageType());
29 }
30 
31 //__________________________________________________________________________
33 }
34 //__________________________________________________________________________
36  MsgStream log(msgSvc(), "AthenaAttributeListCnv");
37 
38  log << MSG::DEBUG << "initialize() in AthenaAttributeListCnv" << 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 AthenaAttributeListCnv::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(), "AthenaAttributeListCnv");
54  log << MSG::DEBUG << "Creating AthenaAttrListAddress Object" << endmsg;
55 
56  AthenaAttrListAddress* addr = dynamic_cast<AthenaAttrListAddress*>(pAddr);
57 
58  if (addr) {
59  // Successful cast
60  pObj = SG::asStorable(addr->attrList());
61  if (!pObj) {
62  log << MSG::ERROR << "AttributeList ptr is 0 from AthenaAttrListAddress " << endmsg;
63  return(StatusCode::FAILURE);
64  }
65  } else {
66  log << MSG::ERROR << "Could not extract ptr for AthenaAttrListAddress " << endmsg;
67  return(StatusCode::FAILURE);
68  }
69 
70  return(StatusCode::SUCCESS);
71 }
72 //__________________________________________________________________________
73 StatusCode AthenaAttributeListCnv::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(), "AthenaAttributeListCnv");
80  log << MSG::DEBUG << "Copy AthenaAttributeList ptr into AthenaAttrListAddress" << endmsg;
81 
82  AthenaAttributeList* list = 0; //dynamic_cast<AthenaAttributeList*>(pObj);
83  SG::fromStorable(pObj, list);
84  AthenaAttrListAddress* addr = new AthenaAttrListAddress(POOL_StorageType,
85  classID(),
86  "POOLContainer_AthenaAttributeList][CLID=x");
87  addr->setAttrList(list);
88  pAddr = addr;
89 
90  log << MSG::DEBUG << "Created AthenaAttrListAddress with list ptr: " << list << endmsg;
91  return(StatusCode::SUCCESS);
92 }
93 //__________________________________________________________________________
95  return(POOL_StorageType);
96 }
97 //__________________________________________________________________________
100 }
101 //__________________________________________________________________________
103  Converter(POOL_StorageType, classID(), svcloc) {
104 }
105 //__________________________________________________________________________
SG::fromStorable
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
Definition: StorableConversions.h:180
initialize
void initialize()
Definition: run_EoverP.cxx:894
AthenaAttrListAddress::attrList
AthenaAttributeList * attrList()
Access to AttributeList.
Definition: AthenaAttrListAddress.h:110
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
AthenaAttributeListCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
Definition: AthenaAttributeListCnv.cxx:35
AthenaAttributeList.h
AthenaAttributeListCnv::AthenaAttributeListCnv
AthenaAttributeListCnv(ISvcLocator *svcloc)
Constructor.
Definition: AthenaAttributeListCnv.cxx:102
AthenaAttributeListCnv.h
This file contains the class definition for the AthenaAttributeListCnv class.
AthenaAttributeListCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create a transient object from a POOL persistent representation.
Definition: AthenaAttributeListCnv.cxx:47
AthenaAttrListAddress
This class provides the an IOpaqueAddress/GenericAddress which can hold a pointer to an AthenaAttribu...
Definition: AthenaAttrListAddress.h:27
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
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
AthenaAttributeListCnv::repSvcType
virtual long int repSvcType() const
Definition: AthenaAttributeListCnv.cxx:27
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
AthenaAttrListAddress.h
This file contains the class definition for theAthenaAttrListAddress class.
AthenaAttributeListCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create a POOL persistent representation for a transient object.
Definition: AthenaAttributeListCnv.cxx:73
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
AthenaAttrListAddress::setAttrList
void setAttrList(AthenaAttributeList *attrList)
Add AttributeList.
Definition: AthenaAttrListAddress.h:116
AthenaAttributeListCnv::storageType
static long storageType()
Definition: AthenaAttributeListCnv.cxx:94
Converter
Definition: Converter.h:27
AthenaAttributeListCnv::classID
static const CLID & classID()
Definition: AthenaAttributeListCnv.cxx:98
AthenaAttributeListCnv::~AthenaAttributeListCnv
virtual ~AthenaAttributeListCnv()
Destructor.
Definition: AthenaAttributeListCnv.cxx:32
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
merge.status
status
Definition: merge.py:17
StoreGateSvc.h