ATLAS Offline Software
PackedLinkDecorator.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_PACKEDLINKDECORATOR_H
15 #define ATHCONTAINERS_PACKEDLINKDECORATOR_H
16 
17 
20 #include "AthContainers/Accessor.h"
28 #include "AthLinks/DataLink.h"
29 #include "CxxUtils/concepts.h"
31 #include <string>
32 #include <typeinfo>
33 #include <iterator>
34 
35 
36 namespace SG {
37 
38 
73 template <class CONT, class ALLOC>
74 class Decorator<PackedLink<CONT>, ALLOC>
76 {
77 public:
78  // Aliases for the types we're dealing with.
80  using PLink_t = SG::PackedLink<CONT>;
82  using DLinkAlloc_t = typename std::allocator_traits<ALLOC>::template rebind_alloc<DLink_t>;
83 
84 
90 
91 
94 
95 
97  using const_span =
99 
100 
103 
104 
109 
110 
113 
116 
120 
121 
128  Decorator (const std::string& name);
129 
130 
138  Decorator (const std::string& name, const std::string& clsname);
139 
140 
148 
149 
161  template <IsConstAuxElement ELT>
162  ELProxy operator() (const ELT& e) const;
163 
164 
179  ELProxy
180  operator() (const AuxVectorData& container, size_t index) const;
181 
182 
188  template <IsConstAuxElement ELT>
189  void set (const ELT& e, const element_type& l) const;
190 
191 
198  void set (const AuxVectorData& container, size_t index, const Link_t& x) const;
199 
200 
205  const PLink_t*
206  getPackedLinkArray (const AuxVectorData& container) const;
207 
208 
213  const DLink_t*
214  getDataLinkArray (const AuxVectorData& container) const;
215 
216 
226  PLink_t*
227  getPackedLinkDecorArray (const AuxVectorData& container) const;
228 
229 
239  DLink_t*
240  getDataLinkDecorArray (const AuxVectorData& container) const;
241 
242 
248  getPackedLinkSpan (const AuxVectorData& container) const;
249 
250 
256  getDataLinkSpan (const AuxVectorData& container) const;
257 
258 
263  const_span
264  getDataSpan (const AuxVectorData& container) const;
265 
266 
276  getPackedLinkDecorSpan (const AuxVectorData& container) const;
277 
278 
288  getDataLinkDecorSpan (const AuxVectorData& container) const;
289 
290 
301  span
302  getDecorationSpan (const AuxVectorData& container) const;
303 
304 
309  template <IsConstAuxElement ELT>
310  bool isAvailableWritable (const ELT& e) const;
311 
312 
317  bool isAvailableWritable (const AuxVectorData& c) const;
318 
319 
320 protected:
329  Decorator (const std::string& name,
330  const std::string& clsname,
331  const SG::AuxVarFlags flags);
332 };
333 
334 
335 //************************************************************************
336 
337 
383 template <class CONT, class ALLOC, class VALLOC>
384 class Decorator<std::vector<PackedLink<CONT>, VALLOC>, ALLOC>
386 {
387 public:
388  // Aliases for the types we're dealing with.
390  using PLink_t = SG::PackedLink<CONT>;
391  using VElt_t = std::vector<SG::PackedLink<CONT>, VALLOC>;
393  using DLinkAlloc_t = typename std::allocator_traits<ALLOC>::template rebind_alloc<DLink_t>;
394 
400 
404 
405 
408 
411  using const_span =
413 
414 
417 
418 
422  using span =
424 
425 
428 
431 
435 
436 
443  Decorator (const std::string& name);
444 
445 
453  Decorator (const std::string& name, const std::string& clsname);
454 
455 
463 
464 
476  template <IsConstAuxElement ELT>
477  elt_span operator() (const ELT& e) const;
478 
479 
494  elt_span
495  operator() (const AuxVectorData& container, size_t index) const;
496 
497 
503  template <IsConstAuxElement ELT, detail::ElementLinkRange<CONT> RANGE>
504  void set (const ELT& e, const RANGE& x) const;
505 
506 
513  template <detail::ElementLinkRange<CONT> RANGE>
514  void set (const AuxVectorData& container, size_t index, const RANGE& r) const;
515 
516 
521  const VElt_t*
522  getPackedLinkVectorArray (const AuxVectorData& container) const;
523 
524 
529  const DLink_t*
530  getDataLinkArray (const AuxVectorData& container) const;
531 
532 
538  VElt_t*
540 
541 
547  DLink_t*
548  getDataLinkDecorArray (const AuxVectorData& container) const;
549 
550 
555  template <IsConstAuxElement ELT>
557  getPackedLinkSpan (const ELT& e) const;
558 
559 
566  getPackedLinkSpan (const AuxVectorData& container, size_t index) const;
567 
568 
575  getPackedLinkSpan (AuxVectorData& container, size_t index) const;
576 
577 
583  getPackedLinkVectorSpan (const AuxVectorData& container) const;
584 
585 
591  getDataLinkSpan (const AuxVectorData& container) const;
592 
593 
598  const_span
599  getDataSpan (const AuxVectorData& container) const;
600 
601 
611  template <IsConstAuxElement ELT>
613  getPackedLinkDecorSpan (const ELT& e) const;
614 
615 
627  getPackedLinkDecorSpan (const AuxVectorData& container, size_t index) const;
628 
629 
640  getPackedLinkVectorDecorSpan (const AuxVectorData& container) const;
641 
642 
652  getDataLinkDecorSpan (const AuxVectorData& container) const;
653 
654 
668  span
669  getDecorationSpan (const AuxVectorData& container) const;
670 
671 
676  template <IsConstAuxElement ELT>
677  bool isAvailableWritable (const ELT& e) const;
678 
679 
684  bool isAvailableWritable (const AuxVectorData& e) const;
685 
686 
687 protected:
696  Decorator (const std::string& name,
697  const std::string& clsname,
698  const SG::AuxVarFlags flags);
699 };
700 
701 
702 } // namespace SG
703 
704 
706 
707 
708 
709 #endif // not ATHCONTAINERS_PACKEDLINKDECORATOR_H
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
SG::detail::LinkedVarAccessorBase
Base class usable for accessors for variables with linked variables.
Definition: LinkedVarAccessorBase.h:29
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::detail::PackedLinkVectorConstConverter
Helper: Convert a vector of PackedLink to a span over ElementLinks.
Definition: PackedLinkConversions.h:75
AuxElementConcepts.h
SG::detail::PackedLinkConstConverter
Helper: Convert a PackedLink to an ElementLink.
Definition: PackedLinkConversions.h:37
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
IAuxElement.h
Flag that a class may have auxiliary data associated with it.
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
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
taskman.template
dictionary template
Definition: taskman.py:317
SG::Decorator::span
typename AuxDataTraits< T, ALLOC >::span span
A span over elements in the container.
Definition: Decorator.h:74
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
SG::Decorator::auxid
SG::auxid_t auxid() const
Return the aux id for this variable.
x
#define x
CxxUtils::span
Simplified version of the C++20 std::span.
Definition: span.h:67
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
SG::Decorator::operator()
reference_type operator()(const ELT &e) const
Fetch the variable for one element, as a non-const reference.
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
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::AuxVarFlags
AuxVarFlags
Additional flags to qualify an auxiliary variable.
Definition: AuxTypes.h:58
AuxVectorData.h
Manage lookup of vectors of auxiliary data.
PackedLinkDecorator.icc
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
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.
SG::Decorator::const_span
typename AuxDataTraits< T, ALLOC >::const_span const_span
Definition: Decorator.h:75
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