Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
IndexMap.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 
3 /*
4  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id$
23 #ifndef D3PDMAKERUTILS_INDEXMAP_HPP
24 #define D3PDMAKERUTILS_INDEXMAP_HPP
25 
26 
29 #include "GaudiKernel/IIncidentListener.h"
30 #include "GaudiKernel/ToolHandle.h"
31 #include <string>
32 #include <vector>
33 #include <unordered_map>
34 
35 
36 namespace D3PD {
37 
38 
39 class ICollectionGetterTool;
40 
41 
42 class IndexMap
43  : public implements<IIncidentListener>
44 {
45 public:
54  IndexMap (INamedInterface* parent,
55  const std::string& targetLabel,
56  ToolHandle<ICollectionGetterRegistryTool>& registry,
57  const bool& allowMissing);
58 
59 
72  IndexMap (INamedInterface* parent,
73  const std::string& targetLabel,
74  const std::vector<std::string>& targetLabels,
75  ToolHandle<ICollectionGetterRegistryTool>& registry,
76  const bool& allowMissing);
77 
78 
85  IndexMap (INamedInterface* parent,
86  ToolHandleArray<ICollectionGetterTool>& getters,
87  const bool& allowMissing);
88 
89 
94 
95 
100  StatusCode configureD3PD (const std::type_info& ti);
101 
102 
105 
106 
108  ICollectionGetterTool* target (unsigned int i);
109 
110 
112  int ntargets();
113 
114 
116  virtual void handle (const Incident &inc);
117 
118 
120  StatusCode reset();
121 
122 
129  int findIndex (const void* p);
130 
131 
140  int findIndex (const void* p, unsigned int i);
141 
142 
149  std::pair<int, int> findIndexPair (const void* p);
150 
151 
153  bool valid() const;
154 
155 
159  std::string formatLabels() const;
160 
161 
162 private:
165 
166 
168  INamedInterface* m_parent;
169 
171  const std::string* m_targetLabel;
172 
175  const std::vector<std::string>* m_targetLabels;
176 
178  ToolHandle<ICollectionGetterRegistryTool>* m_registry;
179 
181  ToolHandleArray<ICollectionGetterTool>* m_getters;
182 
184  const bool& m_allowMissing;
185 
187  std::vector<ICollectionGetterTool*> m_targets;
188 
190  typedef std::unordered_multimap<const void*, std::pair<int, int> > map_t;
192 
194  bool m_valid;
195 
197  std::vector<TypeConverter> m_converters;
198 };
199 
200 
201 } // namespace D3PD
202 
203 
204 
205 #endif // not D3PDMAKERUTILS_INDEXMAP_HPP
python.Dso.registry
registry
Definition: Control/AthenaServices/python/Dso.py:159
D3PD::IndexMap::target
ICollectionGetterTool * target()
Return the getter defining the first collection within which to index.
Definition: IndexMap.cxx:175
D3PD::IndexMap::formatLabels
std::string formatLabels() const
Return list of all configured targets as a comma-separated string.
Definition: IndexMap.cxx:325
ICollectionGetterRegistryTool.h
Abstract interface to keep a registry of collection getter tools.
D3PD::IndexMap::findIndex
int findIndex(const void *p)
Find the index corresponding to an element.
Definition: IndexMap.cxx:255
D3PD::IndexMap::m_parent
INamedInterface * m_parent
The parent tool.
Definition: IndexMap.h:168
D3PD::IndexMap::m_map
map_t m_map
Definition: IndexMap.h:191
D3PD::IndexMap::findIndexPair
std::pair< int, int > findIndexPair(const void *p)
Find the (index,container) pair corresponding to an element.
Definition: IndexMap.cxx:293
TypeConverter.h
Helper to convert pointers.
D3PD::IndexMap::reset
StatusCode reset()
Call before asking for an index. Rebuilds cache if needed.
Definition: IndexMap.cxx:227
D3PD::IndexMap::ntargets
int ntargets()
Return the number of valid targets.
Definition: IndexMap.cxx:199
D3PD::IndexMap::configureCommon
StatusCode configureCommon()
Common part of configuration.
Definition: IndexMap.cxx:97
D3PD::ICollectionGetterTool
Abstract interface to get a collection of objects and iterate over it.
Definition: ICollectionGetterTool.h:39
D3PD::IndexMap::valid
bool valid() const
Return the valid flag.
Definition: IndexMap.cxx:316
D3PD
Block filler tool for noisy FEB information.
Definition: CaloCellDetailsFillerTool.cxx:29
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
D3PD::IndexMap::IndexMap
IndexMap(INamedInterface *parent, const std::string &targetLabel, ToolHandle< ICollectionGetterRegistryTool > &registry, const bool &allowMissing)
Constructor: for a single target.
Definition: IndexMap.cxx:31
test_pyathena.parent
parent
Definition: test_pyathena.py:15
D3PD::IndexMap::m_getters
ToolHandleArray< ICollectionGetterTool > * m_getters
Property for a direct list of getters.
Definition: IndexMap.h:181
D3PD::IndexMap::m_targetLabels
const std::vector< std::string > * m_targetLabels
Property for the label of the getter defining the list of target collections.
Definition: IndexMap.h:175
D3PD::IndexMap::m_targets
std::vector< ICollectionGetterTool * > m_targets
Getters defining the collections within which to index.
Definition: IndexMap.h:187
D3PD::IndexMap::configureD3PD
StatusCode configureD3PD()
Configure during initialization: type-check.
Definition: IndexMap.cxx:137
D3PD::IndexMap::map_t
std::unordered_multimap< const void *, std::pair< int, int > > map_t
The pointer -> (index,target) map.
Definition: IndexMap.h:190
D3PD::IndexMap::m_allowMissing
const bool & m_allowMissing
Property for the allowMissing flag.
Definition: IndexMap.h:184
D3PD::IndexMap
Definition: IndexMap.h:44
D3PD::IndexMap::m_valid
bool m_valid
Flag if the map is valid.
Definition: IndexMap.h:194
D3PD::IndexMap::m_targetLabel
const std::string * m_targetLabel
Property for the label of the getter defining the target collection.
Definition: IndexMap.h:171
D3PD::IndexMap::m_converters
std::vector< TypeConverter > m_converters
Converter for each target.
Definition: IndexMap.h:197
D3PD::IndexMap::handle
virtual void handle(const Incident &inc)
Incident handler.
Definition: IndexMap.cxx:214
D3PD::IndexMap::m_registry
ToolHandle< ICollectionGetterRegistryTool > * m_registry
Property for the ICollectionGetterRegistryTool instance.
Definition: IndexMap.h:178