ATLAS Offline Software
CondAttrListCollCnv.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 "CondAttrListCollCnv.h"
12 
13 #include "GaudiKernel/ClassID.h"
14 #include "GaudiKernel/DataObject.h"
15 #include "GaudiKernel/MsgStream.h"
16 #include "GaudiKernel/StatusCode.h"
17 
18 // CondAttrListCollection 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(), "CondAttrListCollCnv");
37 
38  log << MSG::DEBUG << "initialize() in CondAttrListCollCnv" << 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 CondAttrListCollCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj) {
48 
49  // This is the "read" method for an CondAttrListCollection. Here
50  // we only extract an CondAttrListCollection pointer from an
51  // CondAttrListCollAddress and return it
52 
53  MsgStream log(msgSvc(), "CondAttrListCollCnv");
54  log << MSG::DEBUG << "Creating CondAttrListCollAddress Object" << endmsg;
55 
56  CondAttrListCollAddress* addr = dynamic_cast<CondAttrListCollAddress*>(pAddr);
57 
58  if (addr) {
59  // Successful cast
60  pObj = SG::asStorable(addr->attrListColl());
61  if (!pObj) {
62  log << MSG::ERROR << "CondAttrListCollection ptr is 0 from CondAttrListCollAddress " << endmsg;
63  return(StatusCode::FAILURE);
64  }
65  }
66  else {
67  log << MSG::ERROR << "Could not extract ptr for CondAttrListCollAddress " << endmsg;
68  return(StatusCode::FAILURE);
69  }
70 
71  return(StatusCode::SUCCESS);
72 }
73 //__________________________________________________________________________
74 StatusCode CondAttrListCollCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr) {
75 
76  // This is the "write" method for an CondAttrListCollection. Here
77  // we only create an CondAttrListCollAddress and fill it with a
78  // pointer to the CondAttrListCollection
79 
80  MsgStream log(msgSvc(), "CondAttrListCollCnv");
81  log << MSG::DEBUG << "Copy CondAttrListCollection ptr into CondAttrListCollAddress" << endmsg;
82 
83  CondAttrListCollection* list = 0; //dynamic_cast<CondAttrListCollection*>(pObj);
84  SG::fromStorable(pObj, list);
85  CondAttrListCollAddress* addr = new CondAttrListCollAddress(POOL_StorageType,
86  classID(),
87  "POOLContainer_CondAttrListCollection][CLID=x");
88  addr->setAttrListColl(list);
89  pAddr = addr;
90 
91  log << MSG::DEBUG << "Created CondAttrListCollAddress with list ptr: " << list << endmsg;
92  return(StatusCode::SUCCESS);
93 }
94 //__________________________________________________________________________
96  return(POOL_StorageType);
97 }
98 //__________________________________________________________________________
101 }
102 //__________________________________________________________________________
104  Converter(POOL_StorageType, classID(), svcloc) {
105 }
106 //__________________________________________________________________________
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
CondAttrListCollAddress.h
This file contains the class definition for the CondAttrListCollAddress class.
SG::fromStorable
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
Definition: StorableConversions.h:167
CondAttrListCollCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
Definition: CondAttrListCollCnv.cxx:35
initialize
void initialize()
Definition: run_EoverP.cxx:894
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
CondAttrListCollCnv.h
This file contains the class definition for the CondAttrListCollCnv class.
CondAttrListCollAddress
This class provides the an IOpaqueAddress/GenericAddress which can hold a pointer to an CondAttrListC...
Definition: CondAttrListCollAddress.h:27
SG::asStorable
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
Definition: DataObjectSharedPtr.h:65
CondAttrListCollCnv::repSvcType
virtual long int repSvcType() const
Definition: CondAttrListCollCnv.cxx:27
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
CondAttrListCollCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create a transient object from a POOL persistent representation.
Definition: CondAttrListCollCnv.cxx:47
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
CondAttrListCollAddress::setAttrListColl
void setAttrListColl(CondAttrListCollection *attrListColl)
Add AttributeList.
Definition: CondAttrListCollAddress.h:126
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
CondAttrListCollCnv::classID
static const CLID & classID()
Definition: CondAttrListCollCnv.cxx:99
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
CondAttrListCollAddress::attrListColl
CondAttrListCollection * attrListColl()
Access to AttributeList.
Definition: CondAttrListCollAddress.h:120
Converter
Definition: Converter.h:27
CondAttrListCollCnv::CondAttrListCollCnv
CondAttrListCollCnv(ISvcLocator *svcloc)
Constructor.
Definition: CondAttrListCollCnv.cxx:103
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
CondAttrListCollCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create a POOL persistent representation for a transient object.
Definition: CondAttrListCollCnv.cxx:74
merge.status
status
Definition: merge.py:17
StoreGateSvc.h
CondAttrListCollCnv::storageType
static long storageType()
Definition: CondAttrListCollCnv.cxx:95
CondAttrListCollCnv::~CondAttrListCollCnv
virtual ~CondAttrListCollCnv()
Destructor.
Definition: CondAttrListCollCnv.cxx:32