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-2025 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
88
93
96
99
105
109
112
115
119
120
127 Decorator (const std::string& name);
128
129
137 Decorator (const std::string& name, const std::string& clsname);
138
139
147
148
160 template <IsConstAuxElement ELT>
161 reference_type operator() (const ELT& e) const;
162
163
180
181
187 template <IsConstAuxElement ELT,
189 void set (const ELT& e, const RANGE& x) const;
190
191
198 template <CxxUtils::InputRangeOverT<PAYLOAD_T> RANGE>
199 void set (const AuxVectorData& container, size_t index, const RANGE& x) const;
200
201
207
208
214
215
226
227
238
239
246
247
254
255
262
263
275
276
288
289
299 span
301
302
307 template <IsConstAuxElement ELT>
308 bool isAvailableWritable (const ELT& e) const;
309
310
315 bool isAvailableWritable (const AuxVectorData& c) const;
316
317
318protected:
327 Decorator (const std::string& name,
328 const std::string& clsname,
329 const SG::AuxVarFlags flags);
330};
331
332
333} // namespace SG
334
335
337
338
339#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.
Allow customizing how aux data types are treated.
CxxUtils::span< container_value_type > span
CxxUtils::span< const container_value_type > const_span
Manage lookup of vectors of auxiliary data.
span getDecorationSpan(const AuxVectorData &container) const
Get a span over spans representing the jagged vector, as a decoration.
detail::JaggedVecProxyT< Payload_t, detail::JaggedVecProxyRefBase > JVecProxyInSpan
const_Elt_span getEltSpan(const AuxVectorData &container) const
Get a span over the array of JaggedVecElt objects.
const Elt_t * getEltArray(const AuxVectorData &container) const
Get a pointer to the start of the array of JaggedVecElt objects.
typename AuxDataTraits< Payload_t, PayloadAlloc_t >::const_span const_Payload_span
Decorator(const SG::auxid_t auxid)
Constructor taking an auxid directly.
detail::JaggedVecProxyT< Payload_t, detail::JaggedVecProxyValBase > JVecProxy
Writable proxies for a jagged vector element: both a single proxy and one used as part of a span.
typename ConstConverter_t::element_type element_type
Const span resulting from the conversion.
JVecProxy reference_type
The writable type we return.
CxxUtils::transform_view_with_at< const_Elt_span, ConstConverter_t > const_span
Spans over the entire jagged vector, both writable and not.
Decorator(const std::string &name, const std::string &clsname)
Constructor.
bool isAvailableWritable(const ELT &e) const
Test to see if this variable exists in the store and is writable.
const Payload_t * getPayloadArray(const AuxVectorData &container) const
Get a pointer to the start of the payload array.
bool isAvailableWritable(const AuxVectorData &c) const
Test to see if this variable exists in the store and is writable.
void set(const AuxVectorData &container, size_t index, const RANGE &x) const
Set the variable for one element.
CxxUtils::transform_view_with_at< Elt_span, Converter_t > span
typename std::allocator_traits< ALLOC >::template rebind_alloc< Payload_t > PayloadAlloc_t
Allocator to use for the payload vector.
Decorator(const std::string &name, const std::string &clsname, const SG::AuxVarFlags flags)
Constructor.
detail::JaggedVecConverter< Payload_t > Converter_t
Converter from JaggedVecElt to a (writable) span.
Decorator(const std::string &name)
Constructor.
Elt_span getEltDecorSpan(const AuxVectorData &container) const
Get a span over the array of JaggedVecElt objects, as a decoration.
typename AuxDataTraits< JaggedVecElt< Payload_t >, ALLOC >::span Elt_span
typename AuxDataTraits< JaggedVecElt< Payload_t >, ALLOC >::const_span const_Elt_span
Spans over the objects that are actually stored.
const_span getDataSpan(const AuxVectorData &container) const
Get a span over spans representing the jagged vector.
detail::JaggedVecConstConverter< Payload_t > ConstConverter_t
Converter from JaggedVecElt to a span.
Payload_span getPayloadDecorSpan(const AuxVectorData &container) const
Get a span over the payload vector, as a decoration.
Payload_t * getPayloadDecorArray(const AuxVectorData &container) const
Get a pointer to the start of the payload array, as a decoration.
void set(const ELT &e, const RANGE &x) const
Set the variable for one element.
const_Payload_span getPayloadSpan(const AuxVectorData &container) const
Get a span over the payload vector.
typename AuxDataTraits< Payload_t, PayloadAlloc_t >::span Payload_span
SG::JaggedVecElt< PAYLOAD_T > Elt_t
One element of the jagged vector.
Elt_t * getEltDecorArray(const AuxVectorData &container) const
Get a pointer to the start of the array of JaggedVecElt objects, as a decoration.
reference_type operator()(const ELT &e) const
Fetch the variable for one element, as a non-const reference.
Describe one element of a jagged vector.
Helper: Make a span from a jagged vector element.
CxxUtils::range_with_conv< typename AuxDataTraits< Payload_t >::const_span > element_type
Helper: Make a span — either read-only or writable — from a jagged vector element.
Proxy for jagged vectors.
Base class usable for accessors for variables with linked variables.
Concept for an input range over a given type.
Definition ranges.h:27
Test if T is compatible with ConstAuxElement.
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
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.