ATLAS Offline Software
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-2024 CERN for the benefit of the ATLAS collaboration.
4  */
14 #ifndef ATHCONTAINERS_JAGGEDVECDECORATOR_H
15 #define ATHCONTAINERS_JAGGEDVECDECORATOR_H
16 
17 
28 #include "CxxUtils/concepts.h"
29 #include "CxxUtils/ranges.h"
31 #include "CxxUtils/range_with_at.h"
33 #include <string>
34 #include <typeinfo>
35 #include <iterator>
36 
37 
38 namespace SG {
39 
40 
76 template <class PAYLOAD_T, class ALLOC>
77 class Decorator<JaggedVecElt<PAYLOAD_T>, ALLOC>
79 {
80 public:
82  using Payload_t = PAYLOAD_T;
83 
85  using PayloadAlloc_t = typename std::allocator_traits<ALLOC>::template rebind_alloc<Payload_t>;
86 
89 
94 
97 
100 
106 
110 
113 
116 
120 
121 
128  Decorator (const std::string& name);
129 
130 
138  Decorator (const std::string& name, const std::string& clsname);
139 
140 
148 
149 
161  template <IsConstAuxElement ELT>
162  reference_type operator() (const ELT& e) const;
163 
164 
180  operator() (const AuxVectorData& container, size_t index) const;
181 
182 
188  template <IsConstAuxElement ELT,
189  CxxUtils::InputRangeOverT<PAYLOAD_T> RANGE>
190  void set (const ELT& e, const RANGE& x) const;
191 
192 
199  template <CxxUtils::InputRangeOverT<PAYLOAD_T> RANGE>
200  void set (const AuxVectorData& container, size_t index, const RANGE& x) const;
201 
202 
207  const Elt_t* getEltArray (const AuxVectorData& container) const;
208 
209 
214  const Payload_t* getPayloadArray (const AuxVectorData& container) const;
215 
216 
226  Elt_t* getEltDecorArray (const AuxVectorData& container) const;
227 
228 
238  Payload_t* getPayloadDecorArray (const AuxVectorData& container) const;
239 
240 
246  getEltSpan (const AuxVectorData& container) const;
247 
248 
254  getPayloadSpan (const AuxVectorData& container) const;
255 
256 
261  const_span
262  getDataSpan (const AuxVectorData& container) const;
263 
264 
274  Elt_span
275  getEltDecorSpan (const AuxVectorData& container) const;
276 
277 
288  getPayloadDecorSpan (const AuxVectorData& container) const;
289 
290 
300  span
301  getDecorationSpan (const AuxVectorData& container) const;
302 
303 
308  template <IsConstAuxElement ELT>
309  bool isAvailableWritable (const ELT& e) const;
310 
311 
316  bool isAvailableWritable (const AuxVectorData& c) const;
317 
318 
319 protected:
328  Decorator (const std::string& name,
329  const std::string& clsname,
330  const SG::AuxVarFlags flags);
331 };
332 
333 
334 } // namespace SG
335 
336 
338 
339 
340 #endif // not ATHCONTAINERS_JAGGEDVECDECORATOR_H
JaggedVecDecorator.icc
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
SG::detail::LinkedVarAccessorBase
Base class usable for accessors for variables with linked variables.
Definition: LinkedVarAccessorBase.h:29
SG::detail::JaggedVecProxyT
Proxy for jagged vectors.
Definition: JaggedVecConversions.h:251
JaggedVecVectorFactory.h
Factory object that creates vectors using AuxTypeVector, specialized for JaggedVec.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::Elt_span
typename AuxDataTraits< JaggedVecElt< Payload_t >, ALLOC >::span Elt_span
Definition: JaggedVecDecorator.h:104
AuxElementConcepts.h
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::Decorator
Decorator(const std::string &name)
Constructor.
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
IAuxElement.h
Flag that a class may have auxiliary data associated with it.
SG::detail::JaggedVecConstConverter
Helper: Make a span from a jagged vector element.
Definition: JaggedVecConversions.h:49
index
Definition: index.py:1
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::Decorator
Decorator(const SG::auxid_t auxid)
Constructor taking an auxid directly.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::getEltDecorSpan
Elt_span getEltDecorSpan(const AuxVectorData &container) const
Get a span over the array of JaggedVecElt objects, as a decoration.
taskman.template
dictionary template
Definition: taskman.py:317
SG::Decorator::span
typename AuxDataTraits< T, ALLOC >::span span
A span over elements in the container.
Definition: Decorator.h:74
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::element_type
typename ConstConverter_t::element_type element_type
Const span resulting from the conversion.
Definition: JaggedVecDecorator.h:112
SG::Decorator::auxid
SG::auxid_t auxid() const
Return the aux id for this variable.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::getEltSpan
const_Elt_span getEltSpan(const AuxVectorData &container) const
Get a span over the array of JaggedVecElt objects.
x
#define x
range_with_conv.h
Add to a range class conversions to containers.
CxxUtils::span
Simplified version of the C++20 std::span.
Definition: span.h:67
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::getDataSpan
const_span getDataSpan(const AuxVectorData &container) const
Get a span over spans representing the jagged vector.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::getDecorationSpan
span getDecorationSpan(const AuxVectorData &container) const
Get a span over spans representing the jagged vector, as a decoration.
SG::detail::JaggedVecConverter
Helper: Make a span — either read-only or writable — from a jagged vector element.
Definition: JaggedVecConversions.h:693
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::container_pointer_type
void container_pointer_type
Not supported.
Definition: JaggedVecDecorator.h:118
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::getPayloadDecorSpan
Payload_span getPayloadDecorSpan(const AuxVectorData &container) const
Get a span over the payload vector, as a decoration.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::Decorator
Decorator(const std::string &name, const std::string &clsname, const SG::AuxVarFlags flags)
Constructor.
SG::Decorator< 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: JaggedVecDecorator.h:85
SG::Decorator::operator()
reference_type operator()(const ELT &e) const
Fetch the variable for one element, as a non-const reference.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::const_Elt_span
typename AuxDataTraits< JaggedVecElt< Payload_t >, ALLOC >::const_span const_Elt_span
Spans over the objects that are actually stored.
Definition: JaggedVecDecorator.h:102
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::Payload_span
typename AuxDataTraits< Payload_t, PayloadAlloc_t >::span Payload_span
Definition: JaggedVecDecorator.h:105
SG::AuxDataTraits
Allow customizing how aux data types are treated.
Definition: AuxDataTraits.h:40
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::getPayloadArray
const Payload_t * getPayloadArray(const AuxVectorData &container) const
Get a pointer to the start of the payload array.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::isAvailableWritable
bool isAvailableWritable(const ELT &e) const
Test to see if this variable exists in the store and is writable.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::set
void set(const AuxVectorData &container, size_t index, const RANGE &x) const
Set the variable for one element.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::getEltArray
const Elt_t * getEltArray(const AuxVectorData &container) const
Get a pointer to the start of the array of JaggedVecElt objects.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::Decorator
Decorator(const std::string &name, const std::string &clsname)
Constructor.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::getPayloadDecorArray
Payload_t * getPayloadDecorArray(const AuxVectorData &container) const
Get a pointer to the start of the payload array, as a decoration.
SG::AuxVarFlags
AuxVarFlags
Additional flags to qualify an auxiliary variable.
Definition: AuxTypes.h:58
AuxVectorData.h
Manage lookup of vectors of auxiliary data.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::getPayloadSpan
const_Payload_span getPayloadSpan(const AuxVectorData &container) const
Get a span over the payload vector.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::Payload_t
PAYLOAD_T Payload_t
Payload type.
Definition: JaggedVecDecorator.h:82
range_with_at.h
Add at() methods to a range class.
AuxTypes.h
Basic definitions for auxiliary types.
JaggedVecImpl.h
Definition of JaggedVecElt.
CxxUtils::range_with_at
Add at() methods to a range class.
Definition: range_with_at.h:33
JaggedVecConversions.h
Conversions for accessing jagged vector variables.
concepts.h
Compatibility helpers for using some pieces of C++20 concepts with older compilers.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::isAvailableWritable
bool isAvailableWritable(const AuxVectorData &c) const
Test to see if this variable exists in the store and is writable.
SG::Decorator::const_span
typename AuxDataTraits< T, ALLOC >::const_span const_span
Definition: Decorator.h:75
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::getEltDecorArray
Elt_t * getEltDecorArray(const AuxVectorData &container) const
Get a pointer to the start of the array of JaggedVecElt objects, as a decoration.
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
AuxTypeRegistry.h
Handle mappings between names and auxid_t.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::set
void set(const ELT &e, const RANGE &x) const
Set the variable for one element.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::const_Payload_span
typename AuxDataTraits< Payload_t, PayloadAlloc_t >::const_span const_Payload_span
Definition: JaggedVecDecorator.h:103
CxxUtils::range_with_conv
Add to a range class conversions to containers.
Definition: range_with_conv.h:33
SG::AuxVectorData
Manage lookup of vectors of auxiliary data.
Definition: AuxVectorData.h:168
ranges.h
C++20 range helpers.
SG::Decorator< JaggedVecElt< PAYLOAD_T >, ALLOC >::const_container_pointer_type
void const_container_pointer_type
Definition: JaggedVecDecorator.h:119
checker_macros.h
Define macros for attributes used to control the static checker.
python.compressB64.c
def c
Definition: compressB64.py:93
Decorator.h
Helper class to provide type-safe access to aux data.