ATLAS Offline Software
Loading...
Searching...
No Matches
JaggedVecDecorator.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_JAGGEDVECDECORATOR_H
15#define ATHCONTAINERS_JAGGEDVECDECORATOR_H
16
17
28#include "CxxUtils/ranges.h"
32#include <string>
33#include <typeinfo>
34#include <iterator>
35
36
37namespace SG {
38
39
75template <class PAYLOAD_T, class ALLOC>
76class Decorator<JaggedVecElt<PAYLOAD_T>, ALLOC>
78{
79public:
81 using Payload_t = PAYLOAD_T;
82
84 using PayloadAlloc_t = typename std::allocator_traits<ALLOC>::template rebind_alloc<Payload_t>;
85
87 using Elt_t = SG::JaggedVecElt<PAYLOAD_T>;
88
91 using JVecProxy = detail::JaggedVecProxyT<Payload_t, detail::JaggedVecProxyValBase>;
92 using JVecProxyInSpan = detail::JaggedVecProxyT<Payload_t, detail::JaggedVecProxyRefBase>;
93
95 using Converter_t = detail::JaggedVecConverter<Payload_t>;
96
98 using ConstConverter_t = detail::JaggedVecConstConverter<Payload_t>;
99
101 using const_Elt_span = typename AuxDataTraits<JaggedVecElt<Payload_t>, ALLOC>::const_span;
102 using const_Payload_span = typename AuxDataTraits<Payload_t, PayloadAlloc_t>::const_span;
103 using Elt_span = typename AuxDataTraits<JaggedVecElt<Payload_t>, ALLOC>::span;
104 using Payload_span = typename AuxDataTraits<Payload_t, PayloadAlloc_t>::span;
105
109
111 using element_type = typename ConstConverter_t::element_type;
112
114 using const_reference_type = element_type;
115
117 using reference_type = JVecProxy;
118
121 using rhs_const_reference_type = std::span<const Payload_t>;
122
124 using container_pointer_type = void;
125 using const_container_pointer_type = void;
126
127
134 Decorator (const std::string& name);
135
136
144 Decorator (const std::string& name, const std::string& clsname);
145
146
154
155
167 template <IsConstAuxElement ELT>
168 reference_type operator() (const ELT& e) const;
169
170
186 operator() (const AuxVectorData& container, size_t index) const;
187
188
194 template <IsConstAuxElement ELT,
195 CxxUtils::InputRangeOverT<PAYLOAD_T> RANGE>
196 void set (const ELT& e, const RANGE& x) const;
197
198
205 template <CxxUtils::InputRangeOverT<PAYLOAD_T> RANGE>
206 void set (const AuxVectorData& container, size_t index, const RANGE& x) const;
207
208
213 const Elt_t* getEltArray (const AuxVectorData& container) const;
214
215
220 const Payload_t* getPayloadArray (const AuxVectorData& container) const;
221
222
233
234
245
246
251 const_Elt_span
253
254
259 const_Payload_span
261
262
268 getDataSpan (const AuxVectorData& container) const;
269
270
280 Elt_span
282
283
293 Payload_span
295
296
306 span
308
309
314 template <IsConstAuxElement ELT>
315 bool isAvailableWritable (const ELT& e) const;
316
317
322 bool isAvailableWritable (const AuxVectorData& c) const;
323
324
325protected:
334 Decorator (const std::string& name,
335 const std::string& clsname,
336 const SG::AuxVarFlags flags);
337};
338
339
340} // namespace SG
341
342
344
345
346#endif // not ATHCONTAINERS_JAGGEDVECDECORATOR_H
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.
Flag that a class may have auxiliary data associated with it.
Helper class to provide constant type-safe access to aux data, specialized for JaggedVecElt.
Conversions for accessing jagged vector variables.
Definition of JaggedVecElt.
Factory object that creates vectors using AuxTypeVector, specialized for JaggedVec.
#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.
Describe one element of a jagged vector.
Base class usable for accessors for variables with linked variables.
range_with_at< std::ranges::transform_view< SPAN, XFORM > > transform_view_with_at
Helper to add at() methods to a transform_view.
Forward declaration.
AuxVarFlags
Additional flags to qualify an auxiliary variable.
Definition AuxTypes.h:58
const_Elt_span getEltSpan(const AuxVectorData &container) const
Get a span over the array of JaggedVecElt objects.
Payload_t * getPayloadDecorArray(const AuxVectorData &container) const
Get a pointer to the start of the payload array, as a decoration.
Payload_span getPayloadDecorSpan(const AuxVectorData &container) const
Get a span over the payload vector, as a decoration.
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.
void set(const ELT &e, const element_type &x) const
Set the variable for one element.
reference_type operator()(const ELT &e) const
Fetch the variable for one element, as a non-const reference.
Elt_span getEltDecorSpan(const AuxVectorData &container) const
Get a span over the array of JaggedVecElt objects, as a decoration.
CxxUtils::transform_view_with_at< PackedLinkVector_span, ELSpanConverter > span
const_Payload_span getPayloadSpan(const AuxVectorData &container) const
Get a span over the payload vector.
void const_container_pointer_type
elt_span reference_type
Type referencing an item.
size_t index() const
Return the index of this element within its container.
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.
const Payload_t * getPayloadArray(const AuxVectorData &container) const
Get a pointer to the start of the payload array.
const_span getDataSpan(const AuxVectorData &container) const
Get a span over the auxiliary data array.
elt_span element_type
Type the user sees.
span getDecorationSpan(const AuxVectorData &container) const
Get a span over the auxiliary data array.
void container_pointer_type
Not supported.
const Elt_t * getEltArray(const AuxVectorData &container) const
Get a pointer to the start of the array of JaggedVecElt objects.
Elt_t * getEltDecorArray(const AuxVectorData &container) const
Get a pointer to the start of the array of JaggedVecElt objects, as a decoration.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27
Definition index.py:1
Add at() methods to a range class.
Add to a range class conversions to containers.
C++20 range helpers.