ATLAS Offline Software
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-2024 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"
26 #include "CxxUtils/concepts.h"
28 #include <string>
29 #include <typeinfo>
30 
31 
32 namespace SG {
33 
34 
75 template <class CONT, class ALLOC>
76 class Accessor<PackedLink<CONT>, ALLOC>
77  : public ConstAccessor<PackedLink<CONT>, ALLOC>
78 {
79 public:
80  // Aliases for the types we're dealing with.
83  using PLink_t = SG::PackedLink<CONT>;
85  using DLinkAlloc_t = typename std::allocator_traits<ALLOC>::template rebind_alloc<DLink_t>;
86 
87 
91 
92 
95 
96 
101 
102 
105 
108 
112 
113 
115  using Base::operator();
116  using Base::getPackedLinkArray;
117  using Base::getDataLinkArray;
118  using Base::getPackedLinkSpan;
119  using Base::getDataLinkSpan;
120  using Base::getDataSpan;
121 
122 
129  Accessor (const std::string& name);
130 
131 
139  Accessor (const std::string& name, const std::string& clsname);
140 
141 
149 
150 
158  template <IsAuxElement ELT>
159  ELProxy operator() (ELT& e) const;
160 
161 
172  ELProxy operator() (AuxVectorData& container, size_t index) const;
173 
174 
180  void set (AuxElement& e, const Link_t& l) const;
181 
182 
189  void set (AuxVectorData& container, size_t index, const Link_t& x) const;
190 
191 
196  PLink_t*
197  getPackedLinkArray (AuxVectorData& container) const;
198 
199 
204  DLink_t*
205  getDataLinkArray (AuxVectorData& container) const;
206 
207 
213  getPackedLinkSpan (AuxVectorData& container) const;
214 
215 
221  getDataLinkSpan (AuxVectorData& container) const;
222 
223 
230  span
231  getDataSpan (AuxVectorData& container) const;
232 
233 
239 
240 
246 };
247 
248 
249 //************************************************************************
250 
251 
293 template <class CONT, class ALLOC, class VALLOC>
294 class Accessor<std::vector<PackedLink<CONT>, VALLOC>, ALLOC>
295  : public ConstAccessor<std::vector<PackedLink<CONT>, VALLOC>, ALLOC>
296 {
297 public:
298  // Aliases for the types we're dealing with.
301  using PLink_t = SG::PackedLink<CONT>;
302  using VElt_t = std::vector<SG::PackedLink<CONT>, VALLOC>;
304  using DLinkAlloc_t = typename std::allocator_traits<ALLOC>::template rebind_alloc<DLink_t>;
305 
309 
312 
315 
316 
320  using span =
322 
323 
326 
329 
333 
334 
336  using Base::operator();
337  using Base::getPackedLinkVectorArray;
338  using Base::getDataLinkArray;
339  using Base::getPackedLinkSpan;
340  using Base::getPackedLinkVectorSpan;
341  using Base::getDataSpan;
342  using Base::getDataLinkSpan;
343 
344 
351  Accessor (const std::string& name);
352 
353 
361  Accessor (const std::string& name, const std::string& clsname);
362 
363 
371 
372 
380  template <IsAuxElement ELT>
381  elt_span operator() (ELT& e) const;
382 
383 
394  elt_span operator() (AuxVectorData& container, size_t index) const;
395 
396 
402  template <detail::ElementLinkRange<CONT> RANGE>
403  void set (AuxElement& e, const RANGE& r) const;
404 
405 
412  template <detail::ElementLinkRange<CONT> RANGE>
413  void set (AuxVectorData& container, size_t index, const RANGE& x) const;
414 
415 
420  VElt_t*
422 
423 
428  DLink_t*
429  getDataLinkArray (AuxVectorData& container) const;
430 
431 
438 
439 
446  getPackedLinkSpan (AuxVectorData& container, size_t index) const;
447 
448 
455 
456 
462  getDataLinkSpan (AuxVectorData& container) const;
463 
464 
473  span
474  getDataSpan (AuxVectorData& container) const;
475 
476 
482 
483 
489 };
490 
491 
492 } // namespace SG
493 
494 
496 
497 
498 #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:472
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:67
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:221
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
concepts.h
Compatibility helpers for using some pieces of C++20 concepts with older compilers.
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