ATLAS Offline Software
JaggedVecAccessor.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_JAGGEDVECACCESSOR_H
15 #define ATHCONTAINERS_JAGGEDVECACCESSOR_H
16 
17 
21 #include "AthContainers/Accessor.h"
24 #include "CxxUtils/concepts.h"
25 #include "CxxUtils/ranges.h"
27 #include "CxxUtils/range_with_at.h"
28 #include <string>
29 #include <typeinfo>
30 
31 
32 namespace SG {
33 
34 
77 template <class PAYLOAD_T, class ALLOC>
78 class Accessor<JaggedVecElt<PAYLOAD_T>, ALLOC>
79  : public ConstAccessor<JaggedVecElt<PAYLOAD_T>, ALLOC>
80 {
81 public:
83 
85  using Payload_t = typename Base::Payload_t;
86 
88  using PayloadAlloc_t = typename std::allocator_traits<ALLOC>::template rebind_alloc<Payload_t>;
89 
91  using Elt_t = typename Base::Elt_t;
92 
97 
100 
104 
107 
110 
114 
116  using Base::operator();
117  using Base::getDataSpan;
118  using Base::getEltArray;
119  using Base::getPayloadArray;
120  using Base::getEltSpan;
121  using Base::getPayloadSpan;
122 
123 
130  Accessor (const std::string& name);
131 
132 
140  Accessor (const std::string& name, const std::string& clsname);
141 
142 
150 
151 
159  template <IsAuxElement ELT>
161 
162 
173  reference_type operator() (AuxVectorData& container, size_t index) const;
174 
175 
181  template <CxxUtils::InputRangeOverT<PAYLOAD_T> RANGE>
182  void set (AuxElement& e, const RANGE& x) const;
183 
184 
191  template <CxxUtils::InputRangeOverT<PAYLOAD_T> RANGE>
192  void set (AuxVectorData& container, size_t index, const RANGE& x) const;
193 
194 
199  Elt_t* getEltArray (AuxVectorData& container) const;
200 
201 
207 
208 
213  Elt_span getEltSpan (AuxVectorData& container) const;
214 
215 
221 
222 
227  span getDataSpan (AuxVectorData& container) const;
228 
229 
235 
236 
242 };
243 
244 
245 } // namespace SG
246 
247 
249 
250 
251 #endif // not ATHCONTAINERS_JAGGEDVECACCESSOR_H
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
SG::detail::JaggedVecProxyT
Proxy for jagged vectors.
Definition: JaggedVecConversions.h:251
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
IAuxElement.h
Flag that a class may have auxiliary data associated with it.
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::getPayloadSpan
Payload_span getPayloadSpan(AuxVectorData &container) const
Get a span over the payload vector.
index
Definition: index.py:1
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:483
SG::ConstAccessor< T, AuxAllocator_t< T > >::auxid
SG::auxid_t auxid() const
Return the aux id for this variable.
taskman.template
dictionary template
Definition: taskman.py:317
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::set
void set(AuxVectorData &container, size_t index, const RANGE &x) const
Set the variable for one element.
JaggedVecAccessor.icc
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::Elt_t
typename Base::Elt_t Elt_t
One element of the jagged vector.
Definition: JaggedVecAccessor.h:91
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::set
void set(AuxElement &e, const RANGE &x) const
Set the variable for one element.
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
x
#define x
CxxUtils::span
Simplified version of the C++20 std::span.
Definition: span.h:67
SG::detail::JaggedVecConverter
Helper: Make a span — either read-only or writable — from a jagged vector element.
Definition: JaggedVecConversions.h:693
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::Payload_span
typename AuxDataTraits< Payload_t, PayloadAlloc_t >::span Payload_span
Definition: JaggedVecAccessor.h:103
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::const_container_pointer_type
void const_container_pointer_type
Definition: JaggedVecAccessor.h:113
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::getDataSpan
span getDataSpan(AuxVectorData &container) const
Get a span over spans representing the jagged vector.
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::Accessor
Accessor(const std::string &name, const std::string &clsname)
Constructor.
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::Elt_span
typename AuxDataTraits< Elt_t, ALLOC >::span Elt_span
Spans over the objects that are actually stored.
Definition: JaggedVecAccessor.h:102
SG::Accessor::operator()
reference_type operator()(ELT &e) const
Fetch the variable for one element, as a non-const reference.
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::Accessor
Accessor(const std::string &name)
Constructor.
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::Accessor
Accessor(const SG::auxid_t auxid)
Constructor taking an auxid directly.
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::getEltArray
Elt_t * getEltArray(AuxVectorData &container) const
Get a pointer to the start of the array of JaggedVecElt objects.
AuxVectorData.h
Manage lookup of vectors of auxiliary data.
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::PayloadAlloc_t
typename std::allocator_traits< ALLOC >::template rebind_alloc< Payload_t > PayloadAlloc_t
Allocator to use for the payload vector.
Definition: JaggedVecAccessor.h:88
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Accessor.h
Helper class to provide type-safe access to aux data.
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::isAvailableWritable
bool isAvailableWritable(AuxElement &e) const
Test to see if this variable exists in the store and is writable.
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::isAvailableWritable
bool isAvailableWritable(AuxVectorData &c) const
Test to see if this variable exists in the store and is writable.
range_with_at.h
Add at() methods to a range class.
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.
JaggedVecConstAccessor.h
Helper class to provide constant type-safe access to aux data, specialized for JaggedVecElt.
SG::JaggedVecElt
Describe one element of a jagged vector.
Definition: JaggedVecImpl.h:132
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::getEltSpan
Elt_span getEltSpan(AuxVectorData &container) const
Get a span over the array of JaggedVecElt objects.
AuxTypeRegistry.h
Handle mappings between names and auxid_t.
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::container_pointer_type
void container_pointer_type
Not supported.
Definition: JaggedVecAccessor.h:112
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::getPayloadArray
Payload_t * getPayloadArray(AuxVectorData &container) const
Get a pointer to the start of the payload array.
SG::AuxVectorData
Manage lookup of vectors of auxiliary data.
Definition: AuxVectorData.h:168
ranges.h
C++20 range helpers.
checker_macros.h
Define macros for attributes used to control the static checker.
python.compressB64.c
def c
Definition: compressB64.py:93
SG::Accessor< JaggedVecElt< PAYLOAD_T >, ALLOC >::Payload_t
typename Base::Payload_t Payload_t
Payload type.
Definition: JaggedVecAccessor.h:85