ATLAS Offline Software
ElementLinkCnv_p2.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef DATAMODELATHENAPOOL_ELEMENTLINKCNV_P2_H
6 #define DATAMODELATHENAPOOL_ELEMENTLINKCNV_P2_H
7 
15 #include "ElementLink_p2.h"
16 namespace SG {
17  class ThinningCache;
18 }
19 
52 
53 template <class LINK_TYPE>
55  : public T_AthenaPoolTPCnvBase< LINK_TYPE, typename GeneratePersELinkType_p2<LINK_TYPE >::type > {
56 public:
57  typedef LINK_TYPE Link_t;
59 
60  struct State
61  {
62  typedef std::map<std::string, unsigned int> IndexMap;
63 
64  State();
66  State (const ElementLinkContNames_p2& lookupTable);
67 
76  std::string m_lastNameAdded;
79  const std::string* m_lastNameFound;
81  unsigned int m_lastNameIndex = 0;
82 
83  void reset (ElementLinkContNames_p2& lookupTable);
84  void reset (const ElementLinkContNames_p2& lookupTable);
85 
86  private:
87  const std::string* defaultLastName () const;
88  };
89 
90 
94  ElementLinkCnv_p2(bool isPersistible);
95 
96 
97  void transToPers (State& state,
98  const Link_t& trans,
99  PersLink_t& pers,
100  const SG::ThinningCache* cache,
101  MsgStream& log) const;
102 
103  void transToPers (State& state,
104  const Link_t& trans,
105  PersLink_t& pers,
106  MsgStream& log) const;
107 
108  void persToTrans (State& state,
109  const PersLink_t& pers,
110  Link_t& trans,
111  MsgStream& log) const;
112 
113 
115  void resetForCnv(const ElementLinkContNames_p2& lookupTable);
116 
117  virtual void persToTrans(const PersLink_t* pers, Link_t* trans, MsgStream& log) ;
118  virtual void transToPers(const Link_t* trans, PersLink_t* pers, MsgStream& log) ;
119 
120  void persToTrans(const PersLink_t& pers, Link_t& trans, MsgStream& log) ;
121  void transToPers(const Link_t& trans, PersLink_t& pers, MsgStream& log) ;
122 
123 
124 private:
125 
127  unsigned int getNameIndex (State& state, const std::string& name) const;
129  void getContName (State& state,
130  unsigned int nameIndex,
131  std::string const *& name,
132  MsgStream& log) const;
133 
134  State m_state;
135 
138 };
139 
140 
141 #ifndef __REFLEX__
142 #include "ElementLinkCnv_p2.icc"
143 #endif // not __REFLEX__
144 
145 #endif
ElementLinkCnv_p2::getNameIndex
unsigned int getNameIndex(State &state, const std::string &name) const
Add name to lookup table and return index.
ElementLinkCnv_p2::State::State
State(const ElementLinkContNames_p2 &lookupTable)
ElementLinkCnv_p2::Link_t
LINK_TYPE Link_t
Definition: ElementLinkCnv_p2.h:57
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
ElementLinkCnv_p2::State
Definition: ElementLinkCnv_p2.h:61
ElementLinkCnv_p2::transToPers
void transToPers(State &state, const Link_t &trans, PersLink_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
ElementLinkCnv_p2::getContName
void getContName(State &state, unsigned int nameIndex, std::string const *&name, MsgStream &log) const
Get the container name from lookup table.
ElementLinkCnv_p2::State::m_lastNameFound
const std::string * m_lastNameFound
Last container name found - for transToPers use string ptr to avoid string copy.
Definition: ElementLinkCnv_p2.h:79
ElementLinkCnv_p2::ElementLinkCnv_p2
ElementLinkCnv_p2()
ElementLinkCnv_p2::persToTrans
void persToTrans(const PersLink_t &pers, Link_t &trans, MsgStream &log)
TPConverterBase
Definition: TPConverter.h:738
ElementLinkCnv_p2::ElementLinkCnv_p2
ElementLinkCnv_p2(bool isPersistible)
If client sets state of EL to persistible (i.e.
ElementLinkContNames_p2
Definition: ElementLinkContNames_p2.h:22
ElementLinkCnv_p2::State::defaultLastName
const std::string * defaultLastName() const
ElementLinkCnv_p2::State::m_lastNameIndex
unsigned int m_lastNameIndex
Last name inded.
Definition: ElementLinkCnv_p2.h:81
ElementLinkCnv_p2::transToPers
void transToPers(const Link_t &trans, PersLink_t &pers, MsgStream &log)
ElementLinkCnv_p2::State::m_nameIndexMap
IndexMap m_nameIndexMap
Map to find index of container name in lookup table.
Definition: ElementLinkCnv_p2.h:69
ElementLinkCnv_p2::State::reset
void reset(const ElementLinkContNames_p2 &lookupTable)
ElementLinkCnv_p2
Definition: ElementLinkCnv_p2.h:55
ElementLinkCnv_p2::State::IndexMap
std::map< std::string, unsigned int > IndexMap
Definition: ElementLinkCnv_p2.h:62
ElementLinkCnv_p2::State::m_lookupTable
ElementLinkContNames_p2 * m_lookupTable
Lookup table with list of container names and starting element link index for each container name cha...
Definition: ElementLinkCnv_p2.h:72
T_AthenaPoolTPConverter.h
ElementLinkCnv_p2::transToPers
virtual void transToPers(const Link_t *trans, PersLink_t *pers, MsgStream &log)
ElementLinkCnv_p2::m_isPersistible
bool m_isPersistible
Can avoid call to toPersistent if work already done by caller.
Definition: ElementLinkCnv_p2.h:137
ElementLinkCnv_p2::State::reset
void reset(ElementLinkContNames_p2 &lookupTable)
ElementLinkCnv_p2::m_state
State m_state
Definition: ElementLinkCnv_p2.h:134
ElementLinkCnv_p2::persToTrans
virtual void persToTrans(const PersLink_t *pers, Link_t *trans, MsgStream &log)
ElementLinkCnv_p2::persToTrans
void persToTrans(State &state, const PersLink_t &pers, Link_t &trans, MsgStream &log) const
ElementLinkCnv_p2.icc
ElementLinkCnv_p2::State::State
State(ElementLinkContNames_p2 &lookupTable)
ElementLinkCnv_p2::State::m_lastNameAdded
std::string m_lastNameAdded
Last container name added - for persToTrans must be string by value
Definition: ElementLinkCnv_p2.h:76
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ElementLinkCnv_p2::State::State
State()
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
ElementLinkCnv_p2::resetForCnv
void resetForCnv(ElementLinkContNames_p2 &lookupTable)
ElementLinkCnv_p2::transToPers
void transToPers(State &state, const Link_t &trans, PersLink_t &pers, MsgStream &log) const
ElementLinkCnv_p2::resetForCnv
void resetForCnv(const ElementLinkContNames_p2 &lookupTable)
ElementLinkCnv_p2::PersLink_t
GeneratePersELinkType_p2< Link_t >::type PersLink_t
Definition: ElementLinkCnv_p2.h:58
SG::ThinningCache
Cache thinning decisions for converters.
Definition: ThinningCache.h:48
ElementLinkCnv_p2::State::m_clookupTable
const ElementLinkContNames_p2 * m_clookupTable
Definition: ElementLinkCnv_p2.h:73