ATLAS Offline Software
Control/AthContainers/AthContainers/Accessor.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  */
17 #ifndef ATHCONTAINERS_ACCESSOR_H
18 #define ATHCONTAINERS_ACCESSOR_H
19 
20 
27 #include <string>
28 #include <typeinfo>
29 
30 
31 namespace SG {
32 
33 
63 template <class T, class ALLOC = AuxAllocator_t<T> >
64 class Accessor
65  : public ConstAccessor<T, ALLOC>
66 {
67 public:
70 
73 
77 
80 
84 
85 
92  Accessor (const std::string& name);
93 
94 
102  Accessor (const std::string& name, const std::string& clsname);
103 
104 
112 
113 
118  template <class ELT>
119  ATH_REQUIRES( IsAuxElement<ELT> )
120  reference_type operator() (ELT& e) const;
121 
122 
132  reference_type operator() (AuxVectorData& container, size_t index) const;
133 
134 
140  template <class ELT>
141  ATH_REQUIRES( IsAuxElement<ELT> )
142  void set (ELT& e, const element_type& x) const;
143 
144 
150 
151 
156  span
158 
159 
164  template <class ELT>
165  ATH_REQUIRES( IsAuxElement<ELT> )
167 };
168 
169 
170 } // namespace SG
171 
172 
173 #include "AthContainers/Accessor.icc"
174 
175 
176 #endif // not ATHCONTAINERS_ACCESSOR_H
SG::AuxDataTraits::container_pointer_type
typename vector_type::pointer container_pointer_type
Pointers to the data within the container.
Definition: AuxDataTraits.h:57
SG::AuxDataTraits::reference_type
element_type & reference_type
Reference types returned by aux data accessors.
Definition: AuxDataTraits.h:46
AuxElementConcepts.h
SG::Accessor::set
void set(ELT &e, const element_type &x) const
Set the variable for one element.
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:66
index
Definition: index.py:1
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::Accessor
Accessor(const std::string &name, const std::string &clsname)
Constructor.
ATH_REQUIRES
#define ATH_REQUIRES(...)
Definition: concepts.h:104
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
x
#define x
SG::Accessor::Accessor
Accessor(const std::string &name)
Constructor.
CxxUtils::span
Simplified version of the C++20 std::span.
Definition: span.h:67
SG::Accessor::getDataSpan
span getDataSpan(AuxVectorData &container) const
Get a span over the auxilary data array.
SG::Accessor< ATYPE1 >::container_pointer_type
typename AuxDataTraits< ATYPE1, AuxAllocator_t< ATYPE1 > >::container_pointer_type container_pointer_type
Pointer into the container holding this item.
Definition: Control/AthContainers/AthContainers/Accessor.h:76
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
SG::Accessor::Accessor
Accessor(const SG::auxid_t auxid)
Constructor taking an auxid directly.
SG::Accessor< ATYPE1 >::reference_type
typename AuxDataTraits< ATYPE1, AuxAllocator_t< ATYPE1 > >::reference_type reference_type
Type referencing an item.
Definition: Control/AthContainers/AthContainers/Accessor.h:69
AuxVectorData.h
Manage lookup of vectors of auxiliary data.
SG::Accessor< ATYPE1 >::element_type
typename AuxDataTraits< ATYPE1, AuxAllocator_t< ATYPE1 > >::element_type element_type
Type the user sees.
Definition: Control/AthContainers/AthContainers/Accessor.h:72
SG::AuxDataTraits::element_type
T element_type
The type the user sees.
Definition: AuxDataTraits.h:43
SG::Accessor::getDataArray
container_pointer_type getDataArray(AuxVectorData &container) const
Get a pointer to the start of the auxiliary data array.
SG::Accessor< ATYPE1 >::span
typename AuxDataTraits< ATYPE1, AuxAllocator_t< ATYPE1 > >::span span
A span over elements in the container.
Definition: Control/AthContainers/AthContainers/Accessor.h:79
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
AuxTypes.h
Basic definitions for auxiliary types.
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
SG::Accessor::isAvailableWritable
bool isAvailableWritable(ELT &e) const
Test to see if this variable exists in the store and is writable.
AuxTypeRegistry.h
Handle mappings between names and auxid_t.
SG::AuxVectorData
Manage lookup of vectors of auxiliary data.
Definition: AuxVectorData.h:167
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.