ATLAS Offline Software
DataHeaderCnv.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef DATAHEADERCNV_H
6 #define DATAHEADERCNV_H
7 
19 
20 #include "GaudiKernel/IIncidentListener.h"
21 
22 #include <map>
23 
24 class DataHeader_p5;
25 class DataHeaderForm_p6;
26 
31 class DataHeaderCnv : public DataHeaderCnvBase, virtual public IIncidentListener
32 {
33  friend class CnvFactory<DataHeaderCnv>;
34 public:
35  DataHeaderCnv(ISvcLocator* svcloc);
37  virtual StatusCode initialize() override;
38 
40  virtual StatusCode updateRep(IOpaqueAddress* pAddress, DataObject* pObject) override;
41 
42  virtual StatusCode updateRepRefs(IOpaqueAddress* pAddress, DataObject* pObject) override;
43 
44  virtual StatusCode DataObjectToPool(IOpaqueAddress* pAddr, DataObject* pObj) override;
45 
46  std::unique_ptr<DataHeader_p5> poolReadObject_p5();
47  std::unique_ptr<DataHeader_p6> poolReadObject_p6();
48 
50  virtual DataHeader* createTransient() override;
51 
52  [[deprecated("this converter uses createPersistent() with 2 arguments")]]
53  virtual DataHeader_p6* createPersistent(DataHeader*) override { return nullptr; }
54 
56  virtual void handle(const Incident& incident) override;
57 
59  void clearInputDHFormCache( const std::string& dbGuid );
60 
63 
64 protected:
67 
72  bool m_oneDHForm = true;
74  struct placementComp{ bool operator() (const std::string& lhs, const std::string& rhs) const; };
75  std::map<std::string, std::unique_ptr<DataHeaderForm_p6>, placementComp > m_persFormMap;
77  std::map<std::string, std::unique_ptr<DataHeaderForm_p6> > m_inputDHForms;
78 
80  std::map<std::string, unsigned> m_inDHFormCount;
83 
84  std::map< std::string, std::string> m_lastGoodDHFRef;
85 
88  std::unique_ptr<DataHeaderForm_p5> m_dhInForm5;
89  std::string m_dhFormMdx;
90 
92  DataHeader_p6* m_sharedWriterCachedDH = nullptr; // no ownership
94  std::map< std::string, std::unique_ptr<DataHeaderForm_p6> > m_sharedWriterCachedDHForm;
97 };
98 
99 #endif
DataHeaderCnv::handle
virtual void handle(const Incident &incident) override
Incident service handle listening for EndInputFile.
Definition: DataHeaderCnv.cxx:89
DataHeaderForm_p6
This class provides storage for the constant fields of the persistent DataHeader class.
Definition: DataHeader_p6.h:27
DataHeaderCnv::m_persFormMap
std::map< std::string, std::unique_ptr< DataHeaderForm_p6 >, placementComp > m_persFormMap
Definition: DataHeaderCnv.h:75
DataHeaderCnv::updateRep
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject) override
Extend base-class conversion methods.
Definition: DataHeaderCnv.cxx:209
DataHeaderCnv::createTransient
virtual DataHeader * createTransient() override
Definition: DataHeaderCnv.cxx:560
DataHeaderCnv::m_sharedWriterCachedDHToken
std::string m_sharedWriterCachedDHToken
Definition: DataHeaderCnv.h:96
DataHeaderCnv_p6
This class provides the converter to customize the saving of DataHeader_p6.
Definition: DataHeaderCnv_p6.h:22
DataHeaderCnv::m_dhFormMdx
std::string m_dhFormMdx
Definition: DataHeaderCnv.h:89
DataHeaderCnv::m_sharedWriterCachedDHKey
std::string m_sharedWriterCachedDHKey
Definition: DataHeaderCnv.h:95
DataHeaderCnv::m_tpOutConverter
DataHeaderCnv_p6 m_tpOutConverter
Definition: DataHeaderCnv.h:65
DataHeaderCnv::m_tpInConverter_p5
DataHeaderCnv_p5 m_tpInConverter_p5
for use when reading DataHeader_p5
Definition: DataHeaderCnv.h:87
PyPoolBrowser.dh
dh
Definition: PyPoolBrowser.py:102
DataHeaderCnv::m_inputDHForms
std::map< std::string, std::unique_ptr< DataHeaderForm_p6 > > m_inputDHForms
DHForm cache indexed by the DHForm reference (from DataHeader) that was used to read it.
Definition: DataHeaderCnv.h:77
DataHeaderCnv::m_sharedWriterCachedDHForm
std::map< std::string, std::unique_ptr< DataHeaderForm_p6 > > m_sharedWriterCachedDHForm
map of cached DHForms for DataHeader ID
Definition: DataHeaderCnv.h:94
DataHeaderCnv_p5
This class provides the converter to customize the saving of DataHeader_p5.
Definition: DataHeaderCnv_p5.h:42
DataHeaderCnv::DataHeaderCnv
DataHeaderCnv(ISvcLocator *svcloc)
Definition: DataHeaderCnv.cxx:33
DataHeaderCnvBase
T_AthenaPoolCustomCnv< DataHeader, DataHeader_p6 > DataHeaderCnvBase
Definition: DataHeaderCnv.h:30
DataHeaderCnv::placementComp::operator()
bool operator()(const std::string &lhs, const std::string &rhs) const
Definition: DataHeaderCnv.cxx:188
DataHeaderCnv::createPersistent
virtual DataHeader_p6 * createPersistent(DataHeader *) override
Definition: DataHeaderCnv.h:53
DataHeaderCnv::m_inDHFMapMaxsize
unsigned m_inDHFMapMaxsize
Max DHForms to cache per input file.
Definition: DataHeaderCnv.h:82
DataHeaderCnv::m_sharedWriterCachedDH
DataHeader_p6 * m_sharedWriterCachedDH
cached values for use with SharedWriter server
Definition: DataHeaderCnv.h:92
T_AthenaPoolCustomCnv
Compatibility for old converter classes that don't get passed the key.
Definition: T_AthenaPoolCustomCnv.h:132
DataHeader
This class provides the layout for summary information stored for data written to POOL.
Definition: DataHeader.h:124
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DataHeaderCnv::updateRepRefs
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Definition: DataHeaderCnv.cxx:247
DataHeaderCnv_p6.h
This file contains the class definition for DataHeaderCnv_p6.
DataHeaderCnv::DataObjectToPool
virtual StatusCode DataObjectToPool(IOpaqueAddress *pAddr, DataObject *pObj) override
Write an object into POOL.
Definition: DataHeaderCnv.cxx:288
DataHeader_p6.h
This file contains the class definitions for the DataHeader_p6 and DataHeaderForm_p6.
DataHeaderCnv
This class provides the converter to customize the saving of DataHeader.
Definition: DataHeaderCnv.h:32
DataHeaderCnv::m_tpInConverter
DataHeaderCnv_p6 m_tpInConverter
Definition: DataHeaderCnv.h:66
DataHeaderCnv::clearInputDHFormCache
void clearInputDHFormCache(const std::string &dbGuid)
Delete cached DHForms for a given input file GUID.
Definition: DataHeaderCnv.cxx:149
T_AthenaPoolCustomCnv.h
his file contains the class definition for the templated T_AthenaPoolCustomCnv class.
CnvFactory
Abstract factory to create the converter.
Definition: ToyConverter.h:16
DataHeaderCnv_p5.h
This file contains the class definition for the DataHeaderCnv_p5 and DataHeaderElementCnv_p5 classes.
DataHeader.h
This file contains the class definition for the DataHeader and DataHeaderElement classes.
DataHeader_p6
This class provides a persistent representation for the DataHeader class.
Definition: DataHeader_p6.h:115
DataHeaderCnv::createPersistent
DataHeader_p6 * createPersistent(DataHeader *transObj, DataHeaderForm_p6 *)
Definition: DataHeaderCnv.cxx:540
DataHeaderCnv::m_dhInForm5
std::unique_ptr< DataHeaderForm_p5 > m_dhInForm5
Definition: DataHeaderCnv.h:88
DataHeaderCnv::poolReadObject_p5
std::unique_ptr< DataHeader_p5 > poolReadObject_p5()
Definition: DataHeaderCnv.cxx:395
DataHeaderCnv::m_lastGoodDHFRef
std::map< std::string, std::string > m_lastGoodDHFRef
Definition: DataHeaderCnv.h:84
DataHeaderCnv::m_oneDHForm
bool m_oneDHForm
if true write only one DataHeaderForm at the end (stop, finalize, or WriteDataHeaderForms incident) t...
Definition: DataHeaderCnv.h:72
DataHeaderCnv::m_inDHFormCount
std::map< std::string, unsigned > m_inDHFormCount
How many DHForms for an input file are in the cache.
Definition: DataHeaderCnv.h:80
DataHeaderCnv::m_dhFormType
RootType m_dhFormType
cached shape of the DataHeaderForm_pN
Definition: DataHeaderCnv.h:69
runJobs.deprecated
deprecated
Definition: runJobs.py:191
DataHeaderCnv::removeBadElements
void removeBadElements(DataHeader *dh)
Remove DataHeaderElements with incomplete (dbID="") refs.
Definition: DataHeaderCnv.cxx:546
DataHeader_p5
This class provides a persistent representation for the DataHeader class.
Definition: DataHeader_p5.h:67
DataHeaderCnv::~DataHeaderCnv
~DataHeaderCnv()
Definition: DataHeaderCnv.cxx:40
DataHeaderCnv::placementComp
Cache for new DHForms created when writing, indexed by ref or placement.
Definition: DataHeaderCnv.h:74
DataHeaderCnv::poolReadObject_p6
std::unique_ptr< DataHeader_p6 > poolReadObject_p6()
Definition: DataHeaderCnv.cxx:424
DataHeaderCnv::initialize
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
Definition: DataHeaderCnv.cxx:49
TScopeAdapter
Definition: RootType.h:119