ATLAS Offline Software
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-2017 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 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 
163  virtual unsigned long addRef();
164  virtual unsigned long release();
165  virtual StatusCode queryInterface(const InterfaceID& riid,
166  void** ppvInterface);
167 
168 
169 
170 
171 private:
174 
175 
177  INamedInterface* m_parent;
178 
180  const std::string* m_targetLabel;
181 
184  const std::vector<std::string>* m_targetLabels;
185 
187  ToolHandle<ICollectionGetterRegistryTool>* m_registry;
188 
190  ToolHandleArray<ICollectionGetterTool>* m_getters;
191 
193  const bool& m_allowMissing;
194 
196  std::vector<ICollectionGetterTool*> m_targets;
197 
199  typedef std::unordered_multimap<const void*, std::pair<int, int> > map_t;
201 
203  bool m_valid;
204 
206  std::vector<TypeConverter> m_converters;
207 };
208 
209 
210 } // namespace D3PD
211 
212 
213 
214 #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.
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
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:177
D3PD::IndexMap::m_map
map_t m_map
Definition: IndexMap.h:200
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::IndexMap::queryInterface
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
Definition: IndexMap.cxx:342
D3PD
Block filler tool for noisy FEB information.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/ChainGroup.h:21
lumiFormat.i
int i
Definition: lumiFormat.py:92
D3PD::IndexMap::release
virtual unsigned long release()
Definition: IndexMap.cxx:341
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:190
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:184
D3PD::IndexMap::m_targets
std::vector< ICollectionGetterTool * > m_targets
Getters defining the collections within which to index.
Definition: IndexMap.h:196
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:199
D3PD::IndexMap::m_allowMissing
const bool & m_allowMissing
Property for the allowMissing flag.
Definition: IndexMap.h:193
D3PD::IndexMap
Definition: IndexMap.h:44
D3PD::IndexMap::m_valid
bool m_valid
Flag if the map is valid.
Definition: IndexMap.h:203
D3PD::IndexMap::addRef
virtual unsigned long addRef()
Dummies needed to satisfy IInterface requirements.
Definition: IndexMap.cxx:340
D3PD::IndexMap::m_targetLabel
const std::string * m_targetLabel
Property for the label of the getter defining the target collection.
Definition: IndexMap.h:180
D3PD::IndexMap::m_converters
std::vector< TypeConverter > m_converters
Converter for each target.
Definition: IndexMap.h:206
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:187