Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
PackedLinkAccessor.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  * Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
4  */
14 #ifndef ATHCONTAINERS_PACKEDLINKACCESSOR_H
15 #define ATHCONTAINERS_PACKEDLINKACCESSOR_H
16 
17 
21 #include "AthContainers/Accessor.h"
27 #include <string>
28 #include <typeinfo>
29 
30 
31 namespace SG {
32 
33 
74 template <class CONT, class ALLOC>
75 class Accessor<PackedLink<CONT>, ALLOC>
76  : public ConstAccessor<PackedLink<CONT>, ALLOC>
77 {
78 public:
79  // Aliases for the types we're dealing with.
82  using PLink_t = SG::PackedLink<CONT>;
84  using DLinkAlloc_t = typename std::allocator_traits<ALLOC>::template rebind_alloc<DLink_t>;
85 
86 
90 
91 
94 
95 
100 
101 
104 
107 
111 
112 
114  using Base::operator();
115  using Base::getPackedLinkArray;
116  using Base::getDataLinkArray;
117  using Base::getPackedLinkSpan;
118  using Base::getDataLinkSpan;
119  using Base::getDataSpan;
120 
121 
128  Accessor (const std::string& name);
129 
130 
138  Accessor (const std::string& name, const std::string& clsname);
139 
140 
148 
149 
157  template <IsAuxElement ELT>
158  ELProxy operator() (ELT& e) const;
159 
160 
171  ELProxy operator() (AuxVectorData& container, size_t index) const;
172 
173 
179  void set (AuxElement& e, const Link_t& l) const;
180 
181 
188  void set (AuxVectorData& container, size_t index, const Link_t& x) const;
189 
190 
195  PLink_t*
196  getPackedLinkArray (AuxVectorData& container) const;
197 
198 
203  DLink_t*
204  getDataLinkArray (AuxVectorData& container) const;
205 
206 
212  getPackedLinkSpan (AuxVectorData& container) const;
213 
214 
220  getDataLinkSpan (AuxVectorData& container) const;
221 
222 
229  span
230  getDataSpan (AuxVectorData& container) const;
231 
232 
238 
239 
245 };
246 
247 
248 //************************************************************************
249 
250 
292 template <class CONT, class ALLOC, class VALLOC>
293 class Accessor<std::vector<PackedLink<CONT>, VALLOC>, ALLOC>
294  : public ConstAccessor<std::vector<PackedLink<CONT>, VALLOC>, ALLOC>
295 {
296 public:
297  // Aliases for the types we're dealing with.
300  using PLink_t = SG::PackedLink<CONT>;
301  using VElt_t = std::vector<SG::PackedLink<CONT>, VALLOC>;
303  using DLinkAlloc_t = typename std::allocator_traits<ALLOC>::template rebind_alloc<DLink_t>;
304 
308 
311 
314 
315 
319  using span =
321 
322 
325 
328 
332 
333 
335  using Base::operator();
336  using Base::getPackedLinkVectorArray;
337  using Base::getDataLinkArray;
338  using Base::getPackedLinkSpan;
339  using Base::getPackedLinkVectorSpan;
340  using Base::getDataSpan;
341  using Base::getDataLinkSpan;
342 
343 
350  Accessor (const std::string& name);
351 
352 
360  Accessor (const std::string& name, const std::string& clsname);
361 
362 
370 
371 
379  template <IsAuxElement ELT>
380  elt_span operator() (ELT& e) const;
381 
382 
393  elt_span operator() (AuxVectorData& container, size_t index) const;
394 
395 
401  template <detail::ElementLinkRange<CONT> RANGE>
402  void set (AuxElement& e, const RANGE& r) const;
403 
404 
411  template <detail::ElementLinkRange<CONT> RANGE>
412  void set (AuxVectorData& container, size_t index, const RANGE& x) const;
413 
414 
419  VElt_t*
421 
422 
427  DLink_t*
428  getDataLinkArray (AuxVectorData& container) const;
429 
430 
437 
438 
445  getPackedLinkSpan (AuxVectorData& container, size_t index) const;
446 
447 
454 
455 
461  getDataLinkSpan (AuxVectorData& container) const;
462 
463 
472  span
473  getDataSpan (AuxVectorData& container) const;
474 
475 
481 
482 
488 };
489 
490 
491 } // namespace SG
492 
493 
495 
496 
497 #endif // not ATHCONTAINERS_PACKEDLINKACCESSOR_H
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
beamspotman.r
def r
Definition: beamspotman.py:676
SG::detail::ELProxyT
Proxy for ElementLink.
Definition: ELProxy.h:126
ELProxy.h
Helpers for proxying ElementLink for PackedLink accessors.
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
IAuxElement.h
Flag that a class may have auxiliary data associated with it.
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
index
Definition: index.py:1
SG::detail::ELProxyConverter
Extend PackedLinkConverter with a (non-const) conversion from PackedLink to a proxy object.
Definition: ELProxy.h:246
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:483
SG::ConstAccessor< T, AuxAllocator_t< T > >::auxid
SG::auxid_t auxid() const
Return the aux id for this variable.
taskman.template
dictionary template
Definition: taskman.py:317
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
x
#define x
CxxUtils::span
Simplified version of the C++20 std::span.
Definition: span.h:61
PackedLinkAccessor.icc
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
SG::detail::ELSpanConverter
Converter from a vector of PackedLink to a range of ElementLink proxies.
Definition: ELProxy.h:523
SG::AuxDataTraits
Allow customizing how aux data types are treated.
Definition: AuxDataTraits.h:40
vector
Definition: MultiHisto.h:13
SG::detail::ELSpanProxy
Proxy for a span of ElementLinks.
Definition: ELProxy.h:331
AuxDataTraits.h
Allow customizing how aux data types are treated.
SG::Accessor::operator()
reference_type operator()(ELT &e) const
Fetch the variable for one element, as a non-const reference.
AuxVectorData.h
Manage lookup of vectors of auxiliary data.
SG::Accessor::span
typename AuxDataTraits< T, ALLOC >::span span
A span over elements in the container.
Definition: Control/AthContainers/AthContainers/Accessor.h:81
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
Accessor.h
Helper class to provide type-safe access to aux data.
AuxTypes.h
Basic definitions for auxiliary types.
CxxUtils::range_with_at
Add at() methods to a range class.
Definition: range_with_at.h:33
AuxTypeRegistry.h
Handle mappings between names and auxid_t.
PackedLinkConstAccessor.h
Helper class to provide constant type-safe access to aux data, specialized for PackedLink.
SG::AuxVectorData
Manage lookup of vectors of auxiliary data.
Definition: AuxVectorData.h:168
SG::detail::PackedLink_span
typename AuxDataTraits< PackedLink< CONT >, PLINK_ALLOC >::span PackedLink_span
A span over PackedLink.
Definition: ELProxy.h:302
checker_macros.h
Define macros for attributes used to control the static checker.
python.compressB64.c
def c
Definition: compressB64.py:93