ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaPoolCnvSvc.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 ATHENAPOOLCNVSVC_ATHENAPOOLCNVSVC_H
6#define ATHENAPOOLCNVSVC_ATHENAPOOLCNVSVC_H
7
12
14
15#include "GaudiKernel/IClassIDSvc.h"
16#include "GaudiKernel/IIncidentListener.h"
17#include "GaudiKernel/IIoComponent.h"
18#include "GaudiKernel/ServiceHandle.h"
19#include "GaudiKernel/ToolHandle.h"
20
24#include "PoolSvc/IPoolSvc.h"
25
26#include <vector>
27#include <map>
28#include <mutex>
29#include <limits>
30
31// Forward declarations
32class Guid;
33
34template <class TYPE> class SvcFactory;
35
39class AthenaPoolCnvSvc : public extends<AthCnvSvc,
40 IAthenaPoolCnvSvc,
41 IIncidentListener,
42 IIoComponent> {
43 // Allow the factory class access to the constructor
44 friend class SvcFactory<AthenaPoolCnvSvc>;
45
46public:
47
49 virtual StatusCode initialize() override;
50 virtual StatusCode io_reinit() override;
52 virtual StatusCode finalize() override;
53 virtual StatusCode io_finalize() override;
54 virtual StatusCode stop() override;
55
59 virtual StatusCode createObj(IOpaqueAddress* pAddress, DataObject*& refpObject) override;
60
64 virtual StatusCode createRep(DataObject* pObject, IOpaqueAddress*& refpAddress) override;
65
69 virtual StatusCode fillRepRefs(IOpaqueAddress* pAddress, DataObject* pObject) override;
70
74 virtual StatusCode connectOutput(const std::string& outputConnectionSpec,
75 const std::string& openMode) override;
76
80 virtual StatusCode connectOutput(const std::string& outputConnectionSpec) override;
81
84 virtual StatusCode commitOutput(const std::string& outputConnectionSpec, bool doCommit) override;
85
87 virtual StatusCode disconnectOutput(const std::string& outputConnectionSpec) override;
88
93 virtual Token* registerForWrite(Placement* placement, const void* obj, const RootType& classDesc) override;
94
97 virtual void setObjPtr(void*& obj, const Token* token) override;
98
100 virtual bool useDetailChronoStat() const override;
101
108 StatusCode createAddress(long svcType,
109 const CLID& clid,
110 const std::string* par,
111 const unsigned long* ip,
112 IOpaqueAddress*& refpAddress) override;
113
119 virtual StatusCode createAddress(long svcType,
120 const CLID& clid,
121 const std::string& refAddress,
122 IOpaqueAddress*& refpAddress) override;
123
127 virtual StatusCode convertAddress(const IOpaqueAddress* pAddress, std::string& refAddress) override;
128
130 virtual StatusCode registerCleanUp(IAthenaPoolCleanUp* cnv) override;
131
133 virtual StatusCode cleanUp(const std::string& connection) override;
134
137 virtual StatusCode setInputAttributes(const std::string& fileName) override;
138
140 virtual void handle(const Incident& incident) override;
141
143 void flushDataHeaderForms(const std::string& streamName = "*");
144
146 AthenaPoolCnvSvc(const std::string& name, ISvcLocator* pSvcLocator);
148 virtual ~AthenaPoolCnvSvc() = default;
149
150private: // member functions
152 void extractPoolAttributes(const Gaudi::Property<std::vector<std::string>>& property,
153 std::vector<std::vector<std::string> >* contAttr,
154 std::vector<std::vector<std::string> >* dbAttr,
155 std::vector<std::vector<std::string> >* domAttr = 0) const;
156
158 StatusCode processPoolAttributes(std::vector<std::vector<std::string> >& attr,
159 const std::string& fileName,
160 unsigned long contextId,
161 bool doGet = true,
162 bool doSet = true,
163 bool doClear = true) const;
164
165private: // data
168 ServiceHandle<IClassIDSvc> m_clidSvc{this,"ClassIDSvc","ClassIDSvc"};
169
170protected: // shared with derived services
171 ServiceHandle<IPoolSvc> m_poolSvc{this,"PoolSvc","PoolSvc"};
174
175private: // properties
178 Gaudi::Property<bool> m_useDetailChronoStat{this,"UseDetailChronoStat",false};
179
181 Gaudi::Property<std::string> m_containerNamingSchemeProp{this, "PoolContainerNamingScheme", "Historical"};
182
184 Gaudi::Property<std::vector<std::string>> m_poolAttr{this,"PoolAttributes",{},"Pool Attributes","OrderedSet<std::string>"};
185 std::vector<std::vector<std::string> > m_domainAttr;
186 std::vector<std::vector<std::string> > m_databaseAttr;
187 std::vector<std::vector<std::string> > m_containerAttr;
188
190 Gaudi::Property<std::vector<std::string>> m_inputPoolAttr{this,"InputPoolAttributes",{}};
191 std::vector<std::vector<std::string> > m_inputAttr;
194 Gaudi::Property<std::vector<std::string>> m_inputPoolAttrPerEvent{this,"PrintInputAttrPerEvt",{}};
195 std::vector<std::vector<std::string> > m_inputAttrPerEvent;
196
197protected: // properties
200 Gaudi::Property<bool> m_persSvcPerOutput{this,"PersSvcPerOutput",true};
201 unsigned outputContextId(const std::string& outputConnection);
202
205 Gaudi::Property<std::string> m_persSvcPerInputType{this,"PersSvcPerInputType",""};
206 std::mutex m_mutex;
207
209 std::set<unsigned int> m_processedContextIds;
210
212 Gaudi::Property<bool> m_oneDataHeaderForm { this, "OneDataHeaderForm", false };
213
215 Gaudi::Property<int> m_DHFormCacheSize { this, "maxDHFormCacheSize", 100 };
216
218 Gaudi::Property<bool> m_DHFilterAliases { this, "doFilterDHAliases", true };
219
221 Gaudi::Property<std::string> m_defaultContainerType{this, "DefaultContainerType", "ROOTTREEINDEX"};
222};
223
224#endif
uint32_t CLID
The Class ID type.
This file contains the class definition for the IAthenaPoolCnvSvc interface class.
This file contains the class definition for the IPoolSvc interface class.
TTypeAdapter RootType
Definition RootType.h:211
Gaudi::Property< int > m_DHFormCacheSize
Property for DataHeaderCnv input DHForm cache size.
ServiceHandle< IClassIDSvc > m_clidSvc
StatusCode createAddress(long svcType, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress) override
Create a Generic address using explicit arguments to identify a single object.
virtual void handle(const Incident &incident) override
Implementation of IIncidentListener: Handle for EndEvent incidence.
Gaudi::Property< bool > m_useDetailChronoStat
UseDetailChronoStat, enable detailed output for time and size statistics for AthenaPOOL: default = fa...
StatusCode processPoolAttributes(std::vector< std::vector< std::string > > &attr, const std::string &fileName, unsigned long contextId, bool doGet=true, bool doSet=true, bool doClear=true) const
Set/get technology dependent POOL attributes.
std::vector< std::vector< std::string > > m_inputAttrPerEvent
virtual StatusCode io_finalize() override
virtual StatusCode stop() override
virtual StatusCode io_reinit() override
virtual StatusCode registerCleanUp(IAthenaPoolCleanUp *cnv) override
Implement registerCleanUp to register a IAthenaPoolCleanUp to be called during cleanUp.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConversionSvc: Resolve the references of the converted object.
std::vector< std::vector< std::string > > m_databaseAttr
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject) override
Implementation of IConversionSvc: Create the transient representation of an object from persistent st...
void extractPoolAttributes(const Gaudi::Property< std::vector< std::string > > &property, std::vector< std::vector< std::string > > *contAttr, std::vector< std::vector< std::string > > *dbAttr, std::vector< std::vector< std::string > > *domAttr=0) const
Extract POOL attributes for Domain, Database and Container from property.
virtual bool useDetailChronoStat() const override
std::vector< std::vector< std::string > > m_containerAttr
virtual Token * registerForWrite(Placement *placement, const void *obj, const RootType &classDesc) override
Gaudi::Property< std::string > m_defaultContainerType
Default container type.
virtual StatusCode disconnectOutput(const std::string &outputConnectionSpec) override
Disconnect to the output connection.
Gaudi::Property< bool > m_oneDataHeaderForm
If true, use only one DataHeaderForm per Stream.
Gaudi::Property< std::string > m_persSvcPerInputType
PersSvcPerInputType, string property, tree name to use multiple persistency services,...
Gaudi::Property< std::vector< std::string > > m_inputPoolAttr
Input PoolAttributes, vector with names and values of technology specific attributes for POOL.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress) override
Implementation of IConversionSvc: Convert the transient object to the requested representation.
PMonUtils::BasicStopWatchResultMap_t m_chronoMap
Map that holds chrono information.
virtual StatusCode connectOutput(const std::string &outputConnectionSpec, const std::string &openMode) override
Implementation of IConversionSvc: Connect to the output connection specification with open mode.
Gaudi::Property< bool > m_persSvcPerOutput
PersSvcPerOutput, boolean property to use multiple persistency services, one per output stream.
std::string m_lastInputFileName
decoded storage tech requested in "StorageTechnology" property
Gaudi::Property< bool > m_DHFilterAliases
Flag to control SG alias filtering when writing out DataHeader (see DataHeaderCnv_p6).
Gaudi::Property< std::string > m_containerNamingSchemeProp
POOL container naming scheme selection.
virtual StatusCode finalize() override
Required of all Gaudi Services.
virtual StatusCode commitOutput(const std::string &outputConnectionSpec, bool doCommit) override
Implementation of IConversionSvc: Commit pending output.
void flushDataHeaderForms(const std::string &streamName="*")
Tell DataHeaderCnv to write out all DataHeaderForms for a given streamName (default is all).
ServiceHandle< IPoolSvc > m_poolSvc
std::set< unsigned int > m_processedContextIds
Track context IDs for which extractPoolAttributes has been called.
virtual StatusCode cleanUp(const std::string &connection) override
Implement cleanUp to call all registered IAthenaPoolCleanUp cleanUp() function.
std::vector< std::vector< std::string > > m_inputAttr
virtual ~AthenaPoolCnvSvc()=default
Destructor.
virtual StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress) override
Convert address to string form.
virtual void setObjPtr(void *&obj, const Token *token) override
std::vector< std::vector< std::string > > m_domainAttr
Gaudi::Property< std::vector< std::string > > m_poolAttr
Output PoolAttributes, vector with names and values of technology specific attributes for POOL.
virtual StatusCode setInputAttributes(const std::string &fileName) override
Set the input file attributes, if any are requested from jobOpts.
Gaudi::Property< std::vector< std::string > > m_inputPoolAttrPerEvent
Print input PoolAttributes per event, vector with names of technology specific attributes for POOL to...
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition Guid.h:25
This class provides the interface for the AthenaPoolCleanUp which is used to clean up AthenaPoolConve...
This class holds all the necessary information to guide the writing of an object in a physical place.
Definition Placement.h:20
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition Token.h:22
tbb::concurrent_hash_map< std::string, double > BasicStopWatchResultMap_t
void initialize()