ATLAS Offline Software
Loading...
Searching...
No Matches
TopLevelTPCnvBase.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TPTOPLEVELTPCNVBASE_H
6#define TPTOPLEVELTPCNVBASE_H
7
12
13#include <set>
14#include <map>
15
18#include "ITPConverter.h"
19
30
32{
33public:
35
36 virtual ~TopLevelTPCnvBase() { }
37
38 // ------------- Methods for elemental TP converter management
39
42 virtual void addTPConverter( ITPConverter *cnv );
43
48 virtual void addTPConverterForReading( ITPConverter *cnv );
49
50private:
54 virtual void addTPConverterForWriting( ITPConverter *cnv );
55
56public:
60 virtual void addExtTPConverterForReading( ITPConverter *cnv );
61
67 virtual void addTPConvertersTo( TopLevelTPCnvBase *dest );
68
75
80 ITPConverter* converterForType( const std::type_info &info ) const {
81 return m_converters.findConverter( info );
82 }
83
90 convIdMap_t::const_iterator iter = m_convIdMap.find( ref.typeID() );
91 return (iter == m_convIdMap.end())?
92 0 : iter->second;
93 }
94
95
96 // --------------------- methods dealing with the persistent
97 // object owned by the topl-level converter
98
100 virtual bool hasTLPersObject() const = 0;
101
103 virtual void* getTLPersObjectAsVoid() = 0;
104
106 virtual const void* getTLPersObjectAsVoid() const = 0;
107
109 virtual void createTLPersObject() = 0;
110
112 virtual void deleteTLPersObject() = 0;
113
115 virtual void clearTLPersObject() = 0;
116
121 virtual void setTLPersObject(void* persObj) = 0;
122
123
124 // ----------- methods dealing with the token list
125
126
135
142 virtual TPCnvTokenList_p1* getTokenListVarFrom( void *persObj ) = 0;
143
144
145 // ---- other methods
146
148 virtual unsigned short getConverterID() = 0;
149
150protected:
157 {
158 m_registeredTLConverters.insert(cnv);
159 }
160
167 {
168 return m_registeredTLConverters.find(cnv) != m_registeredTLConverters.end();
169 }
170
171
172protected:
173
174 typedef std::map<unsigned, ITPConverter*> convIdMap_t;
175
178
181
184 std::set<TopLevelTPCnvBase*> m_registeredTLConverters;
185
188};
189
190
191#endif
const boost::regex ref(r_ef)
Defines the base ITPConverter class interface for all TP converters.
Base interface class for all TP converters - typeless.
vector of TPCnvToken_p1 Each top-level persistent object that has extentions needs a data member of t...
This class is an object reference used in Athena persistent data model.
Definition TPObjRef.h:20
Base class for top-level TP converters.
virtual void addTPConverterForReading(ITPConverter *cnv)
Add a TP converter to this top level converter but only for reading.
std::map< unsigned, ITPConverter * > convIdMap_t
virtual void addTPConvertersForReadingTo(TopLevelTPCnvBase *dest)
copy all extending converters from this top level converter to "dest" top level converter - for readi...
virtual void addExtTPConverterForReading(ITPConverter *cnv)
add extending TP converter to this top level converter - to the list consulted when reading only.
virtual bool hasTLPersObject() const =0
Returns true if the converter has a persistent object.
virtual void addTPConverter(ITPConverter *cnv)
Add a TP converter to this top level converter.
std::set< TopLevelTPCnvBase * > m_registeredTLConverters
Set top-level converters from which elemental TP converters were registered.
virtual void addTPConvertersTo(TopLevelTPCnvBase *dest)
copy all extending converters from this top level converter to "dest" top level converter
convIdMap_t m_convIdMap
Map of elemental TP converters indexed by their ID - used for reading.
virtual unsigned short getConverterID()=0
virtual void addTPConverterForWriting(ITPConverter *cnv)
add TP converter to the list of converters consulted when writing - internal method.
void rememberConverter(TopLevelTPCnvBase *cnv)
Remember that elemental TP converters from the given top-level converter are already registered.
virtual TPCnvTokenList_p1 * getTokenListVarFrom(void *persObj)=0
Return the list of tokens to the objects extending the object NOT owned by this converter.
bool hasConvertersFrom(TopLevelTPCnvBase *cnv)
Check if TP converters from a given top-level converter were already registered in this converter.
virtual void clearTLPersObject()=0
Discard the persistent object.
ITPConverter * converterForRef(const TPObjRef &ref) const
Find and return a TP converter for persistent type referenced by ref.
TPConverterTypeMap< ITPConverter > m_converters
Map of elemental TP converters indexed by transient typeid - used for writing.
virtual void setTLPersObject(void *persObj)=0
Take ownership of the persistent object.
unsigned m_typeIDCount
Counter used to create typed IDs used in the transient Ref.
virtual void createTLPersObject()=0
Create persistent object - the converter keeps it.
virtual TPCnvTokenList_p1 * getTokenListVar()=0
Return the list of tokens to the objects extending the object owned by this converter.
ITPConverter * converterForType(const std::type_info &info) const
Find and return a TP converter for a given C++ type info.
virtual void * getTLPersObjectAsVoid()=0
virtual void deleteTLPersObject()=0
Delete the persistent object owned by the converter.
virtual const void * getTLPersObjectAsVoid() const =0