ATLAS Offline Software
Loading...
Searching...
No Matches
PackedLinkConstAccessor.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_PACKEDLINKCONSTACCESSOR_H
15#define ATHCONTAINERS_PACKEDLINKCONSTACCESSOR_H
16
17
26#include "AthLinks/ElementLink.h"
27#include "AthLinks/DataLink.h"
29#include <iterator>
30#include <ranges>
31
32
33class IProxyDict;
34
35
36namespace SG {
37
38
69template <class CONT, class ALLOC>
70class ConstAccessor<SG::PackedLink<CONT>, ALLOC>
72{
73public:
74 // Aliases for the types we're dealing with.
78 using DLinkAlloc_t = typename std::allocator_traits<ALLOC>::template rebind_alloc<DLink_t>;
79
80
84
85
88
89
91 using const_span = std::ranges::transform_view<const_PackedLink_span,
93
94
97
100
103
104
111 ConstAccessor (const std::string& name);
112
113
121 ConstAccessor (const std::string& name, const std::string& clsname);
122
123
131
132
137 template <IsConstAuxElement ELT>
138 const Link_t operator() (const ELT& e) const;
139
140
148 const Link_t
150
151
156 const PLink_t*
158
159
164 const DLink_t*
166
167
174
175
182
183
190
191
192protected:
201 ConstAccessor (const std::string& name,
202 const std::string& clsname,
203 const SG::AuxVarFlags flags);
204
205
211 Link_t
212 resolveLink (const AuxVectorData& container, size_t index) const;
213};
214
215
216//************************************************************************
217
218
252template <class CONT, class ALLOC, class VALLOC>
253class ConstAccessor<std::vector<SG::PackedLink<CONT>, VALLOC>, ALLOC>
255{
256public:
257 // Aliases for the types we're dealing with.
260 using VElt_t = std::vector<SG::PackedLink<CONT>, VALLOC>;
262 using DLinkAlloc_t = typename std::allocator_traits<ALLOC>::template rebind_alloc<DLink_t>;
263
267
270
271
275
276
279 using const_span = std::ranges::transform_view<const_PackedLinkVector_span,
281
282
285
288
291
292
299 ConstAccessor (const std::string& name);
300
301
309 ConstAccessor (const std::string& name, const std::string& clsname);
310
311
319
320
327 template <IsConstAuxElement ELT>
328 const_elt_span operator() (const ELT& e) const;
329
330
342
343
348 const VElt_t*
350
351
356 const DLink_t*
358
359
364 template <IsConstAuxElement ELT>
366 getPackedLinkSpan (const ELT& e) const;
367
368
376
377
384
385
392
393
400
401
402protected:
411 ConstAccessor (const std::string& name,
412 const std::string& clsname,
413 const SG::AuxVarFlags flags);
414};
415
416
417} // namespace SG
418
419
421
422
423#endif // not ATHCONTAINERS_PACKEDLINKCONSTACCESSOR_H
Allow customizing how aux data types are treated.
Base class for elements of a container that can have aux data.
Basic definitions for auxiliary types.
Helper class to provide constant type-safe access to aux data.
Base class usable for accessors for variables with linked variables.
Conversions between PackedLink and ElementLink.
Definition of PackedLink type.
Allow customizing how aux data types are treated.
CxxUtils::span< const container_value_type > const_span
Manage lookup of vectors of auxiliary data.
const_reference_type operator()(const ELT &e) const
Fetch the variable for one element, as a const reference.
Base class usable for accessors for variables with linked variables.
Helper: Convert a PackedLink to an ElementLink.
Helper: Convert a vector of PackedLink to a span over ElementLinks.
CxxUtils::range_with_conv< CxxUtils::transform_view_with_at< const_PackedLink_span, detail::PackedLinkConstConverter< CONT > > > value_type
Transform the span of PackedLinks to a span of ElementLinks.
Forward declaration.
AuxVarFlags
Additional flags to qualify an auxiliary variable.
Definition AuxTypes.h:58
const SG::AuxVectorData * container() const
Return the container holding this element.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27
Definition index.py:1
STL namespace.
Add to a range class conversions to containers.