ATLAS Offline Software
Loading...
Searching...
No Matches
T_AthenaPoolCustomCnv.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ATHENAPOOLCNVSVC_T_ATHENAPOOLCUSTOMCNV_H
6#define ATHENAPOOLCNVSVC_T_ATHENAPOOLCUSTOMCNV_H
7
12
14
15#include "T_AthenaPoolCustCnv.h"
16
17#include <unordered_map>
18#include <vector>
19
20// class TopLevelTPCnvBase;
21// need the TopLevelTPCnvBase typedef still
23
24// forward declarations:
25template <class T, class P> class T_AthenaPoolExtendingCnv;
26
34template <class TRANS, class PERS>
36{
39friend class T_AthenaPoolExtendingCnv<TRANS,PERS>;
40
41public:
43
47 T_AthenaPoolCustomCnvWithKey(ISvcLocator* pSvcLocator,
48 const char* name = nullptr);
49
50protected:
51
52 // the 2 following methods are allowed to throw std::runtime_error
53
60 virtual PERS* createPersistentWithKey(TRANS* obj, const std::string& key) = 0;
61
70 virtual TRANS* createTransientWithKey(const Token* token, const std::string& key) = 0;
71
77 template <class P>
78 P* poolReadObject(const Token* token);
79
86 template <class P>
87 void poolReadObject(TopLevelTPCnvBase& tlp_converter, const Token* token);
88
91 void keepPoolObj(PERS* obj, const std::string& output);
92
95 virtual StatusCode transToPers(TRANS*, PERS*&) override { return(StatusCode::FAILURE); }
97 virtual StatusCode persToTrans(TRANS*&, PERS*) override { return(StatusCode::FAILURE); }
98
102 virtual StatusCode DataObjectToPool(IOpaqueAddress* pAddr, DataObject* pObj) override;
103
108 virtual StatusCode PoolToDataObject(DataObject*& pObj, const Token* token,
109 const std::string& key) override;
110
112 virtual StatusCode cleanUp(const std::string& output) override;
113
116 using PersObjCache_t = std::unordered_map<std::string, std::vector<std::unique_ptr<PERS>>>;
118
120 std::mutex m_pListMutex;
121};
122
126template <class TRANS, class PERS>
128 : public T_AthenaPoolCustomCnvWithKey<TRANS, PERS>
129{
130protected:
132
133 virtual PERS* createPersistent(TRANS* obj) = 0;
134 virtual PERS* createPersistentWithKey(TRANS* obj, const std::string& /*key*/) override;
135
136 virtual TRANS* createTransient(const Token* token) = 0;
137 virtual TRANS* createTransientWithKey(const Token* token, const std::string& /*key*/) override;
138};
139
141
142#endif
Maintain a set of objects, one per slot.
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.
Defines the base class for top-level TP converters.
Maintain a set of objects, one per slot.
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.
std::unordered_map< std::string, std::vector< std::unique_ptr< AUXSTORE > > > PersObjCache_t
virtual StatusCode transToPers(TRANS *, PERS *&) override
Obsolete methods replaced by createPersistent() and createTransient() obsolete.
SG::SlotSpecificObj< PersObjCache_t, SG::InvalidSlot::Enabled > m_persObjLists
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.
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.