ATLAS Offline Software
T_AthenaPoolCoolMultChanCnv.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ATHENAPOOLCNVSVC_T_ATHENAPOOLCOOLMULTCHANCNV_H
6 #define ATHENAPOOLCNVSVC_T_ATHENAPOOLCOOLMULTCHANCNV_H
7 
18 
19 #include <string>
20 
21 class DataObject;
22 class StatusCode;
24 
26 template <class TYPE> class CnvFactory;
27 
34 template <class COLL_T, class ELEM_T, class ELEM_P = ELEM_T>
35 class T_AthenaPoolCoolMultChanCnv : public T_AthenaPoolCustCnv<COLL_T, ELEM_T> {
36 
37 public:
39  T_AthenaPoolCoolMultChanCnv(ISvcLocator* svcloc);
40 
41 protected:
45  virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj) override;
46 
50  virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr) override;
51 
55  virtual StatusCode fillRepRefs(IOpaqueAddress* pAddr, DataObject* pObj) override;
56 
62  StatusCode objectToAttrListColl ATLAS_NOT_THREAD_SAFE
63  (COLL_T* obj, IOpaqueAddress*& pAddr,
64  CondAttrListCollection*& attrListColl,
65  Token*& token);
66 
73  COLL_T*& obj);
74 
79  StatusCode condMultChanCollImplToObject(const std::string& collImplToken,
80  COLL_T*& obj);
81 
82  // the 2 following methods are allowed to throw std::runtime_error
83 
90  virtual ELEM_P* createPersistent(ELEM_T* obj);
91 
100  virtual ELEM_T* createTransient();
101 
102  //-------------------------------------------------------------------
103  // Helper methods intended to by used when implementing createTransient()
104 
106  virtual void setToken(const std::string& token) override final;
107 
113  template <class P>
115 
116  ELEM_T* poolReadObject();
117 
119  virtual StatusCode transToPers(COLL_T* obj, ELEM_T*& persObj) override;
120  virtual StatusCode persToTrans(COLL_T*& transObj, ELEM_T* obj) override;
121 
122 protected:
123 
125  int m_persCtx { 0 };
126 
127 };
128 
130 #endif
T_AthenaPoolCoolMultChanCnv::condMultChanCollImplToObject
StatusCode condMultChanCollImplToObject(const std::string &collImplToken, COLL_T *&obj)
Read in CondAttrListCollImpl and the objects for its tokens, saving them in the output collection.
T_AthenaPoolCoolMultChanCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override
Create a transient object from a POOL persistent representation.
T_AthenaPoolCoolMultChanCnv::T_AthenaPoolCoolMultChanCnv
T_AthenaPoolCoolMultChanCnv(ISvcLocator *svcloc)
Constructor.
DMTest::P
P_v1 P
Definition: P.h:23
T_AthenaPoolCoolMultChanCnv::createTransient
virtual ELEM_T * createTransient()
method to be implemented by the developer.
T_AthenaPoolCustCnv
This templated class provides the converter to translate an object to/from its persistent POOL repres...
Definition: T_AthenaPoolCustCnv.h:35
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
T_AthenaPoolCustCnv.h
his file contains the class definition for the templated T_AthenaPoolCustCnv class.
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition: Token.h:21
T_AthenaPoolCoolMultChanCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr) override
Create a POOL persistent representation for a transient object.
T_AthenaPoolCoolMultChanCnv::transToPers
virtual StatusCode transToPers(COLL_T *obj, ELEM_T *&persObj) override
Dummy methods not needed here.
T_AthenaPoolCoolMultChanCnv::poolReadObject
ELEM_T * poolReadObject()
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
T_AthenaPoolCoolMultChanCnv::persToTrans
virtual StatusCode persToTrans(COLL_T *&transObj, ELEM_T *obj) override
CnvFactory
Abstract factory to create the converter.
Definition: ToyConverter.h:16
T_AthenaPoolCoolMultChanCnv::attrListCollToObject
StatusCode attrListCollToObject(CondAttrListCollection *attrListColl, COLL_T *&obj)
Read in objects from POOL for the tokens stored CondAttrListCollection and save the objects in the ou...
T_AthenaPoolCoolMultChanCnv::poolReadObject
P * poolReadObject()
Read object of type P.
T_AthenaPoolCoolMultChanCnv::ATLAS_NOT_THREAD_SAFE
StatusCode objectToAttrListColl ATLAS_NOT_THREAD_SAFE(COLL_T *obj, IOpaqueAddress *&pAddr, CondAttrListCollection *&attrListColl, Token *&token)
Write out objects stored in "obj" into POOL and save the tokens in a CondAttrListCollection,...
T_AthenaPoolCoolMultChanCnv::m_persCtx
int m_persCtx
Persistency context in which to read all objects (extracted from the Collection Address)
Definition: T_AthenaPoolCoolMultChanCnv.h:125
T_AthenaPoolCoolMultChanCnv
This templated class provides the POOL converter to translate a DataVector<T> to and from a CondAttrL...
Definition: T_AthenaPoolCoolMultChanCnv.h:35
T_AthenaPoolCoolMultChanCnv::fillRepRefs
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddr, DataObject *pObj) override
Create a POOL persistent representation for a transient object.
T_AthenaPoolCoolMultChanCnv.icc
T_AthenaPoolCoolMultChanCnv::createPersistent
virtual ELEM_P * createPersistent(ELEM_T *obj)
method to be implemented by the developer.
python.PyAthena.obj
obj
Definition: PyAthena.py:132
T_AthenaPoolCoolMultChanCnv::setToken
virtual void setToken(const std::string &token) override final
specialized version that adds persistency contextID to tokens (for reading)