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 Token* token, const std::string& key) = 0;
70
76 template <class P>
77 P* poolReadObject(const Token* token);
78
85 template <class P>
86 void poolReadObject(TopLevelTPCnvBase& tlp_converter, const Token* token);
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 DataObjectToPool(IOpaqueAddress* pAddr, DataObject* pObj) override;
102
107 virtual StatusCode PoolToDataObject(DataObject*& pObj, const Token* token,
108 const std::string& key) override;
109
111 virtual StatusCode cleanUp(const std::string& output) override;
112
115 std::map<std::string, std::vector< std::unique_ptr<PERS> > > m_persObjLists;
116
118 std::mutex m_pListMutex;
119};
120
124template <class TRANS, class PERS>
126 : public T_AthenaPoolCustomCnvWithKey<TRANS, PERS>
127{
128protected:
130
131 virtual PERS* createPersistent(TRANS* obj) = 0;
132 virtual PERS* createPersistentWithKey(TRANS* obj, const std::string& /*key*/) override;
133
134 virtual TRANS* createTransient(const Token* token) = 0;
135 virtual TRANS* createTransientWithKey(const Token* token, const std::string& /*key*/) override;
136};
137
139
140#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 StatusCode cleanUp(const std::string &output) override
Callback from the CleanupSvc to delete persistent object in the local list.
virtual StatusCode persToTrans(TRANS *&, PERS *) override
obsolete
T_AthenaPoolCustCnv< AUXSTORE, AUXSTORE > BaseType
T_AthenaPoolCustomCnvWithKey(ISvcLocator *pSvcLocator, const char *name=nullptr)
Constructor.
void poolReadObject(TopLevelTPCnvBase &tlp_converter, const Token *token)
Read object of type P (plus all extending objects) using the indicated top-level TP converter.
virtual StatusCode DataObjectToPool(IOpaqueAddress *pAddr, DataObject *pObj) override
Write an object into POOL.
P * poolReadObject(const Token *token)
Read object of type P.
virtual TRANS * createTransientWithKey(const Token *token, const std::string &key)=0
method to be implemented by the developer.
std::map< std::string, std::vector< std::unique_ptr< AUXSTORE > > > m_persObjLists
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 PERS * createPersistent(TRANS *obj)=0
virtual TRANS * createTransientWithKey(const Token *token, const std::string &) override
method to be implemented by the developer.
virtual TRANS * createTransient(const Token *token)=0
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.