ATLAS Offline Software
Loading...
Searching...
No Matches
T_AthenaPoolCustomCnv.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_ATHENAPOOLCUSTOMCNV_H
6#define ATHENAPOOLCNVSVC_T_ATHENAPOOLCUSTOMCNV_H
7
12
13#include "GaudiKernel/ThreadLocalContext.h"
14#include "GaudiKernel/EventContext.h"
15#include "T_AthenaPoolCustCnv.h"
16
17#include <vector>
18
19// class TopLevelTPCnvBase;
20// need the TopLevelTPCnvBase typedef still
22
23// forward declarations:
24template <class T, class P> class T_AthenaPoolExtendingCnv;
25
33template <class TRANS, class PERS>
35{
38friend class T_AthenaPoolExtendingCnv<TRANS,PERS>;
39
40public:
42
46 T_AthenaPoolCustomCnvWithKey(ISvcLocator* pSvcLocator,
47 const char* name = nullptr);
48
49protected:
50
51 // the 2 following methods are allowed to throw std::runtime_error
52
59 virtual PERS* createPersistentWithKey(TRANS* obj, const std::string& key) = 0;
60
69 virtual TRANS* createTransientWithKey(const std::string& key) = 0;
70
76 template <class P>
78
85 template <class P>
86 void poolReadObject(TopLevelTPCnvBase& tlp_converter);
87
90 void keepPoolObj(PERS* obj, const std::string& output);
91
94 virtual StatusCode transToPers(TRANS*, PERS*&) override { return(StatusCode::FAILURE); }
96 virtual StatusCode persToTrans(TRANS*&, PERS*) override { return(StatusCode::FAILURE); }
97
101 virtual StatusCode DataObjectToPers(DataObject* pObj, IOpaqueAddress*& pAddr) override;
102
106 virtual StatusCode DataObjectToPool(IOpaqueAddress* pAddr, DataObject* pObj) override;
107
112 virtual StatusCode PoolToDataObject(DataObject*& pObj, const Token* token,
113 const std::string& key) override;
114
116 virtual StatusCode cleanUp(const std::string& output) override;
117
120 std::map<std::string, std::vector< std::unique_ptr<PERS> > > m_persObjLists;
121
123 std::mutex m_pListMutex;
124};
125
129template <class TRANS, class PERS>
131 : public T_AthenaPoolCustomCnvWithKey<TRANS, PERS>
132{
133protected:
135
136 virtual PERS* createPersistent(TRANS* obj) = 0;
137 virtual PERS* createPersistentWithKey(TRANS* obj, const std::string& /*key*/) override;
138
139 virtual TRANS* createTransient() = 0;
140 virtual TRANS* createTransientWithKey(const std::string& /*key*/) override;
141};
142
144
145#endif
static Double_t P(Double_t *tt, Double_t *par)
RpcSectorLogicContainer_p1 PERS
his file contains the class definition for the templated T_AthenaPoolCustCnv class.
T_AthenaPoolCustCnv(ISvcLocator *pSvcLocator, const char *name=nullptr)
Constructor.
virtual StatusCode PoolToDataObject(DataObject *&pObj, const Token *token, const std::string &key) override
Read an object from POOL.
virtual StatusCode transToPers(TRANS *, PERS *&) override
Obsolete methods replaced by createPersistent() and createTransient() obsolete.
virtual PERS * createPersistentWithKey(TRANS *obj, const std::string &key)=0
method to be implemented by the developer.
virtual TRANS * createTransientWithKey(const std::string &key)=0
method to be implemented by the developer.
virtual StatusCode cleanUp(const std::string &output) override
Callback from the CleanupSvc to delete persistent object in the local list.
void poolReadObject(TopLevelTPCnvBase &tlp_converter)
Read object of type P (plus all extending objects) using the indicated top-level TP converter.
virtual StatusCode persToTrans(TRANS *&, PERS *) override
obsolete
T_AthenaPoolCustCnv< AUXSTORE, AUXSTORE > BaseType
T_AthenaPoolCustomCnvWithKey(ISvcLocator *pSvcLocator, const char *name=nullptr)
Constructor.
virtual StatusCode DataObjectToPers(DataObject *pObj, IOpaqueAddress *&pAddr) override
Convert an object into Persistent.
virtual StatusCode DataObjectToPool(IOpaqueAddress *pAddr, DataObject *pObj) override
Write an object into POOL.
std::map< std::string, std::vector< std::unique_ptr< AUXSTORE > > > m_persObjLists
P * poolReadObject()
Read object of type P.
void keepPoolObj(PERS *obj, const std::string &output)
Remember the POOL object to be written out (will be deleted after commit)
Compatibility for old converter classes that don't get passed the key.
virtual TRANS * createTransient()=0
virtual PERS * createPersistent(TRANS *obj)=0
virtual TRANS * createTransientWithKey(const std::string &) override
method to be implemented by the developer.
virtual PERS * createPersistentWithKey(TRANS *obj, const std::string &) override
method to be implemented by the developer.
This templated class extends T_AthenaPoolCustomCnv to provide additional/chaged functionality for Ath...
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition Token.h:21
Base class for top-level TP converters.