ATLAS Offline Software
Loading...
Searching...
No Matches
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-2026 CERN for the benefit of the ATLAS collaboration.
4 */
12
13
14#ifndef ATHCONTAINERS_PACKEDLINKDECORATOR_H
15#define ATHCONTAINERS_PACKEDLINKDECORATOR_H
16
17
29#include "AthLinks/DataLink.h"
31#include <string>
32#include <typeinfo>
33#include <iterator>
34
35
36namespace SG {
37
38
73template <class CONT, class ALLOC>
74class Decorator<PackedLink<CONT>, ALLOC>
76{
77public:
78 // Aliases for the types we're dealing with.
79 using Link_t = ElementLink<CONT>;
80 using PLink_t = SG::PackedLink<CONT>;
81 using DLink_t = DataLink<CONT>;
82 using DLinkAlloc_t = typename std::allocator_traits<ALLOC>::template rebind_alloc<DLink_t>;
83
84
86 using const_PackedLink_span = typename AuxDataTraits<PackedLink<CONT>, ALLOC>::const_span;
87 using const_DataLink_span = typename AuxDataTraits<DataLink<CONT>, DLinkAlloc_t>::const_span;
88 using PackedLink_span = typename AuxDataTraits<PackedLink<CONT>, ALLOC>::span;
89 using DataLink_span = typename AuxDataTraits<DataLink<CONT>, DLinkAlloc_t>::span;
90
91
93 using ConstConverter_t = detail::PackedLinkConstConverter<CONT>;
94
95
97 using const_span =
99
100
102 using ELProxy = detail::ELProxyT<detail::ELProxyValBase<CONT> >;
103
104
109
110
112 using element_type = Link_t;
113
115 using reference_type = ELProxy;
116
118 using const_reference_type = element_type;
119
122 using rhs_const_reference_type = const Link_t&;
123
125 using container_pointer_type = void;
126 using const_container_pointer_type = void;
127
128
135 Decorator (const std::string& name);
136
137
145 Decorator (const std::string& name, const std::string& clsname);
146
147
155
156
168 template <IsConstAuxElement ELT>
169 ELProxy operator() (const ELT& e) const;
170
171
186 ELProxy
187 operator() (const AuxVectorData& container, size_t index) const;
188
189
195 template <IsConstAuxElement ELT>
196 void set (const ELT& e, const element_type& l) const;
197
198
205 void set (const AuxVectorData& container, size_t index, const Link_t& x) const;
206
207
212 const PLink_t*
214
215
220 const DLink_t*
222
223
233 PLink_t*
235
236
246 DLink_t*
248
249
254 const_PackedLink_span
256
257
262 const_DataLink_span
264
265
271 getDataSpan (const AuxVectorData& container) const;
272
273
282 PackedLink_span
284
285
294 DataLink_span
296
297
308 span
310
311
316 template <IsConstAuxElement ELT>
317 bool isAvailableWritable (const ELT& e) const;
318
319
324 bool isAvailableWritable (const AuxVectorData& c) const;
325
326
327protected:
336 Decorator (const std::string& name,
337 const std::string& clsname,
338 const SG::AuxVarFlags flags);
339};
340
341
342//************************************************************************
343
344
390template <class CONT, class ALLOC, class VALLOC>
391class Decorator<std::vector<PackedLink<CONT>, VALLOC>, ALLOC>
392 : public detail::LinkedVarAccessorBase
393{
394public:
395 // Aliases for the types we're dealing with.
396 using Link_t = ElementLink<CONT>;
397 using PLink_t = SG::PackedLink<CONT>;
398 using VElt_t = std::vector<SG::PackedLink<CONT>, VALLOC>;
399 using DLink_t = DataLink<CONT>;
400 using DLinkAlloc_t = typename std::allocator_traits<ALLOC>::template rebind_alloc<DLink_t>;
401
403 using const_PackedLinkVector_span = typename AuxDataTraits<VElt_t, ALLOC>::const_span;
404 using const_DataLink_span = typename AuxDataTraits<DataLink<CONT>, DLinkAlloc_t>::const_span;
405 using PackedLinkVector_span = typename AuxDataTraits<VElt_t, ALLOC>::span;
406 using DataLink_span = typename AuxDataTraits<DataLink<CONT>, DLinkAlloc_t>::span;
407
409 using const_PackedLink_span = typename AuxDataTraits<PackedLink<CONT>, VALLOC>::const_span;
410 using PackedLink_span = typename AuxDataTraits<PackedLink<CONT>, VALLOC>::span;
411
412
414 using ConstVectorTransform_t = detail::PackedLinkVectorConstConverter<CONT>;
415
420
421
424
425
429 using span =
431
432
435
438
442
443
450 Decorator (const std::string& name);
451
452
460 Decorator (const std::string& name, const std::string& clsname);
461
462
470
471
483 template <IsConstAuxElement ELT>
484 elt_span operator() (const ELT& e) const;
485
486
502 operator() (const AuxVectorData& container, size_t index) const;
503
504
510 template <IsConstAuxElement ELT, detail::ElementLinkRange<CONT> RANGE>
511 void set (const ELT& e, const RANGE& x) const;
512
513
520 template <detail::ElementLinkRange<CONT> RANGE>
521 void set (const AuxVectorData& container, size_t index, const RANGE& r) const;
522
523
528 const VElt_t*
530
531
536 const DLink_t*
538
539
545 VElt_t*
547
548
554 DLink_t*
556
557
562 template <IsConstAuxElement ELT>
563 const_PackedLink_span
564 getPackedLinkSpan (const ELT& e) const;
565
566
572 const_PackedLink_span
574
575
581 PackedLink_span
583
584
589 const_PackedLinkVector_span
591
592
597 const_DataLink_span
599
600
606 getDataSpan (const AuxVectorData& container) const;
607
608
618 template <IsConstAuxElement ELT>
619 PackedLink_span
620 getPackedLinkDecorSpan (const ELT& e) const;
621
622
633 PackedLink_span
635
636
646 PackedLinkVector_span
648
649
658 DataLink_span
660
661
675 span
677
678
683 template <IsConstAuxElement ELT>
684 bool isAvailableWritable (const ELT& e) const;
685
686
691 bool isAvailableWritable (const AuxVectorData& e) const;
692
693
694protected:
703 Decorator (const std::string& name,
704 const std::string& clsname,
705 const SG::AuxVarFlags flags);
706};
707
708
709} // namespace SG
710
711
713
714
715
716#endif // not ATHCONTAINERS_PACKEDLINKDECORATOR_H
Allow customizing how aux data types are treated.
Handle mappings between names and auxid_t.
Basic definitions for auxiliary types.
Manage lookup of vectors of auxiliary data.
Helper class to provide type-safe access to aux data.
Helpers for proxying ElementLink for PackedLink accessors.
Flag that a class may have auxiliary data associated with it.
Helper class to provide constant type-safe access to aux data, specialized for PackedLink.
Definition of PackedLink type.
Factory object that creates vectors using AuxTypeVector, specialized for PackedLink.
#define x
Define macros for attributes used to control the static checker.
CxxUtils::span< container_value_type > span
CxxUtils::span< const container_value_type > const_span
Manage lookup of vectors of auxiliary data.
Converter from a vector of PackedLink to a range of ElementLink proxies.
Definition ELProxy.h:523
Proxy for a span of ElementLinks.
Definition ELProxy.h:331
Base class usable for accessors for variables with linked variables.
int r
Definition globals.cxx:22
range_with_at< std::ranges::transform_view< SPAN, XFORM > > transform_view_with_at
Helper to add at() methods to a transform_view.
detail::ELProxyConverter< detail::ELProxyInSpan< CONT > > ELProxyInSpanConverter
Converter producing a proxy — meant to be used when we have a proxy as a member of a span.
Definition ELProxy.h:293
typename AuxDataTraits< PackedLink< CONT >, PLINK_ALLOC >::span PackedLink_span
A span over PackedLink.
Definition ELProxy.h:302
Forward declaration.
detail::ELSpanConverter< CONT, VALLOC > ELSpanConverter
Transform a span over vector of PackedLink to a span over span over ElementLink proxies.
AuxVarFlags
Additional flags to qualify an auxiliary variable.
Definition AuxTypes.h:58
PackedLink_span getPackedLinkDecorSpan(const AuxVectorData &container) const
Get a span over the array of PackedLinks, as a decoration.
DataLink_span getDataLinkDecorSpan(const AuxVectorData &container) const
Get a span over the array of DataLinks, as a decoration.
const_PackedLinkVector_span getPackedLinkVectorSpan(const AuxVectorData &container) const
Get a span over the vectors of PackedLinks.
detail::ELSpanProxy< CONT, VALLOC > elt_span
Presents a vector of PackedLink as a range of ElementLink proxies.
const_PackedLink_span getPackedLinkSpan(const AuxVectorData &container) const
Get a span over the array of PackedLinks.
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
Definition AuxElement.h:576
SG::auxid_t auxid() const
Return the aux id for this variable.
const PLink_t * getPackedLinkArray(const AuxVectorData &container) const
Get a pointer to the start of the array of PackedLinks.
void set(const ELT &e, const element_type &x) const
Set the variable for one element.
const_DataLink_span getDataLinkSpan(const AuxVectorData &container) const
Get a span over the array of DataLinks.
reference_type operator()(const ELT &e) const
Fetch the variable for one element, as a non-const reference.
PackedLinkVector_span getPackedLinkVectorDecorSpan(const AuxVectorData &container) const
Get a span over the vectors of PackedLinks, as a decoration.
CxxUtils::transform_view_with_at< PackedLinkVector_span, ELSpanConverter > span
void const_container_pointer_type
DLink_t * getDataLinkDecorArray(const AuxVectorData &container) const
Get a pointer to the start of the linked array of DataLinks, as a decoration.
elt_span reference_type
Type referencing an item.
const SG::AuxVectorData * container() const
Return the container holding this element.
CxxUtils::transform_view_with_at< const_PackedLinkVector_span, ConstVectorTransform_t > const_span
Helper class to provide constant type-safe access to aux data, specialized for a vector of PackedLink...
XAOD_AUXDATA_DEPRECATED bool isAvailableWritable(const std::string &name, const std::string &clsname="")
Check if an aux variable is available for writing.
VElt_t * getPackedLinkVectorDecorArray(const AuxVectorData &container) const
Get a pointer to the start of the array of vectors of PackedLinks, as a decoration.
PLink_t * getPackedLinkDecorArray(const AuxVectorData &container) const
Get a pointer to the start of the array of PackedLinks, as a decoration.
const_span getDataSpan(const AuxVectorData &container) const
Get a span over the auxiliary data array.
elt_span element_type
Type the user sees.
const DLink_t * getDataLinkArray(const AuxVectorData &container) const
Get a pointer to the start of the linked array of DataLinks.
const VElt_t * getPackedLinkVectorArray(const AuxVectorData &container) const
Get a pointer to the start of the array of vectors of PackedLinks.
span getDecorationSpan(const AuxVectorData &container) const
Get a span over the auxiliary data array.
void container_pointer_type
Not supported.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27
Definition index.py:1
STL namespace.