ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaPoolConverter.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_ATHENAPOOLCONVERTER_H
6#define ATHENAPOOLCNVSVC_ATHENAPOOLCONVERTER_H
7
12
13#include "GaudiKernel/Converter.h"
14#include "GaudiKernel/ServiceHandle.h"
20#include "PoolSvc/IPoolSvc.h"
21
22#include <string>
23#include <map>
24#include <mutex>
25
26class IOpaqueAddress;
27class DataObject;
28class StatusCode;
30class Guid;
31class Placement;
32class Token;
33
35template <class TYPE> class CnvFactory;
36
41class AthenaPoolConverter : public ::Converter, public ::AthMessaging, virtual public IAthenaPoolCleanUp {
42
43public:
45 virtual ~AthenaPoolConverter();
46
48 virtual StatusCode initialize() override;
49 virtual StatusCode finalize() override;
50
51 virtual long repSvcType() const override;
52
56 virtual StatusCode createObj(IOpaqueAddress* pAddr, DataObject*& pObj) override;
57
61 virtual StatusCode createRep(DataObject* pObj, IOpaqueAddress*& pAddr) override;
62
66 virtual StatusCode fillRepRefs(IOpaqueAddress* pAddr, DataObject* pObj) override;
67
70
72 static long storageType();
73
75 static const CLID& classID();
76
78 virtual StatusCode cleanUp(const std::string& output) override;
79
80
81protected:
83 AthenaPoolConverter(const CLID& id, ISvcLocator* pSvcLocator,
84 const char* name = nullptr);
85
89 virtual StatusCode DataObjectToPers(DataObject* pObj, IOpaqueAddress*& pAddr) = 0;
90
94 virtual StatusCode DataObjectToPool(IOpaqueAddress* pAddr, DataObject* pObj) = 0;
95
100 virtual StatusCode PoolToDataObject(DataObject*& pObj, const Token* token,
101 const std::string& key) = 0;
102
106 virtual Placement setPlacementWithType(const std::string& tname, const std::string& key, const std::string& output);
108 virtual Placement setPlacement(const std::string& key, const std::string& output) = 0;
109
111 virtual const DataObject* getDataObject() const;
112
113 bool compareClassGuid(const Guid &guid) const;
114
115protected: // data
119
120 typedef std::map<std::string, RootType> ClassMap;
121 typedef ClassMap::const_iterator ClassMapIt;
122 std::string m_className;
124
125 std::string m_containerPrefix;
127 std::string m_branchNameHint;
128
129 const DataObject* m_dataObject;
131
132 typedef std::mutex CallMutex;
134};
135
136#endif
uint32_t CLID
The Class ID type.
This file contains the class definition for the IAthenaPoolCleanUp class.
This file contains the class definition for the IPoolSvc interface class.
TTypeAdapter RootType
Definition RootType.h:211
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
ServiceHandle< StoreGateSvc > m_detStore
std::map< std::string, RootType > ClassMap
static const CLID & classID()
virtual ~AthenaPoolConverter()
Destructor.
ServiceHandle< IAthenaPoolCnvSvc > m_athenaPoolCnvSvc
virtual Placement setPlacementWithType(const std::string &tname, const std::string &key, const std::string &output)
Set POOL placement hint for a given type.
virtual long repSvcType() const override
virtual StatusCode PoolToDataObject(DataObject *&pObj, const Token *token, const std::string &key)=0
Read an object from POOL.
ClassMap::const_iterator ClassMapIt
virtual const DataObject * getDataObject() const
const ServiceHandle< StoreGateSvc > & detStore() const
Handle to DetectorStore.
bool compareClassGuid(const Guid &guid) const
virtual StatusCode DataObjectToPool(IOpaqueAddress *pAddr, DataObject *pObj)=0
Write an object into POOL.
virtual StatusCode DataObjectToPers(DataObject *pObj, IOpaqueAddress *&pAddr)=0
Convert an object into Persistent.
AthenaPoolConverter(const CLID &id, ISvcLocator *pSvcLocator, const char *name=nullptr)
Standard Service Constructor.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddr, DataObject *pObj) override
Create a POOL persistent representation for a transient object.
const DataObject * m_dataObject
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override
Create a transient object from a POOL persistent representation.
virtual StatusCode cleanUp(const std::string &output) override
Implement cleanUp for AthenaPoolConverter to do nothing.
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr) override
Create a POOL persistent representation for a transient object.
virtual StatusCode finalize() override
virtual Placement setPlacement(const std::string &key, const std::string &output)=0
Set POOL placement hint; pure virtual method implemented by classes templated by type.
Abstract factory to create the converter.
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition Guid.h:25
IAthenaPoolCleanUp()=default
Standard Constructor.
This class provides the interface between Athena and PoolSvc.
This class holds all the necessary information to guide the writing of an object in a physical place.
Definition Placement.h:19
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition Token.h:21