ATLAS Offline Software
CondAttrListVecCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 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 
23 //--------------------------------------------------------------------
24 
25 long int
27  return(storageType());
28 }
29 
30 //__________________________________________________________________________
32 }
33 //__________________________________________________________________________
35  MsgStream log(msgSvc(), "CondAttrListVecCnv");
36 
37  log << MSG::DEBUG << "initialize() in CondAttrListVecCnv" << endmsg;
39  if (!status.isSuccess()) {
40  log << MSG::ERROR << "Can not initialize Converter base class." << endmsg;
41  return(status);
42  }
43  return(status);
44 }
45 //__________________________________________________________________________
46 StatusCode CondAttrListVecCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj) {
47 
48  // This is the "read" method for an AttributeList. Here we only
49  // extract an AthenaAttributeList pointer from an
50  // AthenaAttrListAddress and return it
51 
52  MsgStream log(msgSvc(), "CondAttrListVecCnv");
53  log << MSG::DEBUG << "Creating CondAttrListVecAddress Object" << endmsg;
54 
55  CondAttrListVecAddress* addr = dynamic_cast<CondAttrListVecAddress*>(pAddr);
56 
57  if (addr) {
58  // Successful cast
59  pObj = SG::asStorable(addr->attrListVec());
60  if (!pObj) {
61  log << MSG::ERROR << "CondAttrListVec ptr is 0 from CondAttrListVecAddress " << endmsg;
62  return(StatusCode::FAILURE);
63  }
64  } else {
65  log << MSG::ERROR << "Could not extract ptr for CondAttrListVecAddress " << endmsg;
66  return(StatusCode::FAILURE);
67  }
68 
69  return(StatusCode::SUCCESS);
70 }
71 //__________________________________________________________________________
72 StatusCode CondAttrListVecCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr) {
73 
74  // This is the "write" method for an AttributeList. Here we only
75  // create an AthenaAttrListAddress and fill it with a pointer to
76  // the AthenaAttributeList
77 
78  MsgStream log(msgSvc(), "CondAttrListVecCnv");
79  log << MSG::DEBUG << "Copy CondAttrListVec ptr into CondAttrListVecAddress" << endmsg;
80 
81  CondAttrListVec* list = 0; //dynamic_cast<AthenaAttributeList*>(pObj);
82  SG::fromStorable(pObj, list);
83  CondAttrListVecAddress* addr = new CondAttrListVecAddress(POOL_StorageType,
84  classID(),
85  "POOLContainer_CondAttrListVec][CLID=x");
86  addr->setAttrListVec(list);
87  pAddr = addr;
88  log << MSG::DEBUG << "Created CondAttrListVec with list ptr: " << list << endmsg;
89  return(StatusCode::SUCCESS);
90 }
91 //__________________________________________________________________________
93  return(POOL_StorageType);
94 }
95 //__________________________________________________________________________
98 }
99 //__________________________________________________________________________
101  Converter(POOL_StorageType, classID(), svcloc) {
102 }
103 //__________________________________________________________________________
CondAttrListVecCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create a transient object from a POOL persistent representation.
Definition: CondAttrListVecCnv.cxx:46
CondAttrListVecCnv::CondAttrListVecCnv
CondAttrListVecCnv(ISvcLocator *svcloc)
Constructor.
Definition: CondAttrListVecCnv.cxx:100
CondAttrListVecCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
Definition: CondAttrListVecCnv.cxx:34
SG::fromStorable
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
Definition: StorableConversions.h:167
initialize
void initialize()
Definition: run_EoverP.cxx:894
CondAttrListVecCnv::repSvcType
virtual long int repSvcType() const
Definition: CondAttrListVecCnv.cxx:26
SG::asStorable
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
Definition: DataObjectSharedPtr.h:65
CondAttrListVecAddress::attrListVec
CondAttrListVec * attrListVec()
Access to CondAttrListVec.
Definition: CondAttrListVecAddress.h:120
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:40
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
CondAttrListVecAddress
This class provides the an IOpaqueAddress/GenericAddress which can hold a pointer to an AthenaAttribu...
Definition: CondAttrListVecAddress.h:25
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:72
CondAttrListVecCnv::storageType
static long storageType()
Definition: CondAttrListVecCnv.cxx:92
CondAttrListVecCnv::classID
static const CLID & classID()
Definition: CondAttrListVecCnv.cxx:96
Converter
Definition: Converter.h:27
CondAttrListVecCnv::~CondAttrListVecCnv
virtual ~CondAttrListVecCnv()
Destructor.
Definition: CondAttrListVecCnv.cxx:31
CondAttrListVecAddress::setAttrListVec
void setAttrListVec(CondAttrListVec *attrListVec)
Add CondAttrListVec.
Definition: CondAttrListVecAddress.h:126
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
CondAttrListVecAddress.h
This file contains the class definition for the CondAttrListVecAddress class.
CondAttrListVecCnv.h
This file contains the class definition for the CondAttrListVecCnv class.