ATLAS Offline Software
ConstAccessor.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  */
17 #ifndef ATHCONTAINERS_CONSTACCESSOR_H
18 #define ATHCONTAINERS_CONSTACCESSOR_H
19 
20 
26 #include <string>
27 #include <typeinfo>
28 
29 
30 namespace SG {
31 
32 
53 template <class T, class ALLOC = AuxAllocator_t<T> >
55 {
56 public:
59 
63 
67 
70 
71 
78  ConstAccessor (const std::string& name);
79 
80 
88  ConstAccessor (const std::string& name, const std::string& clsname);
89 
90 
98 
99 
104  template <IsConstAuxElement ELT>
105  const_reference_type operator() (const ELT& e) const;
106 
107 
118  operator() (const AuxVectorData& container, size_t index) const;
119 
120 
129  template <IsConstAuxElement ELT>
130  const_reference_type withDefault (const ELT& e, const T& deflt) const;
131 
132 
145  withDefault (const AuxVectorData& container, size_t index, const T& deflt) const;
146 
147 
153  getDataArray (const AuxVectorData& container) const;
154 
155 
160  const_span
161  getDataSpan (const AuxVectorData& container) const;
162 
163 
168  template <IsConstAuxElement ELT>
169  bool isAvailable (const ELT& e) const;
170 
171 
176  bool isAvailable (const AuxVectorData& c) const;
177 
178 
183 
184 
185 protected:
194  ConstAccessor (const std::string& name,
195  const std::string& clsname,
196  const SG::AuxVarFlags flags);
197 
198 
207  const SG::AuxVarFlags flags);
208 
209 
212 };
213 
214 
215 } // namespace SG
216 
217 
219 
220 
221 #endif // not ATHCONTAINERS_CONSTACCESSOR_H
SG::ConstAccessor< PackedLink< CONT >, ALLOC >::element_type
typename AuxDataTraits< PackedLink< CONT >, ALLOC >::element_type element_type
Type the user sees.
Definition: ConstAccessor.h:58
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
AuxElementConcepts.h
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
IAuxElement.h
Flag that a class may have auxiliary data associated with it.
SG::ConstAccessor::getDataSpan
const_span getDataSpan(const AuxVectorData &container) const
Get a span over the auxilary data array.
index
Definition: index.py:1
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
SG::ConstAccessor< PackedLink< CONT >, ALLOC >::const_container_pointer_type
typename AuxDataTraits< PackedLink< CONT >, ALLOC >::const_container_pointer_type const_container_pointer_type
Pointer into the container holding this item.
Definition: ConstAccessor.h:66
SG::ConstAccessor::auxid
SG::auxid_t auxid() const
Return the aux id for this variable.
SG::AuxDataTraits::const_reference_type
const element_type & const_reference_type
Definition: AuxDataTraits.h:47
SG::ConstAccessor< PackedLink< CONT >, ALLOC >::const_span
typename AuxDataTraits< PackedLink< CONT >, ALLOC >::const_span const_span
A span over elements in the container.
Definition: ConstAccessor.h:69
SG::ConstAccessor::ConstAccessor
ConstAccessor(const std::string &name)
Constructor.
SG::ConstAccessor::ConstAccessor
ConstAccessor(const SG::auxid_t auxid)
Constructor taking an auxid directly.
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
SG::AuxDataTraits::const_container_pointer_type
typename vector_type::const_pointer const_container_pointer_type
Definition: AuxDataTraits.h:58
CxxUtils::span
Simplified version of the C++20 std::span.
Definition: span.h:61
SG::ConstAccessor< PackedLink< CONT >, ALLOC >::const_reference_type
typename AuxDataTraits< PackedLink< CONT >, ALLOC >::const_reference_type const_reference_type
Type referencing an item.
Definition: ConstAccessor.h:62
SG::ConstAccessor::ConstAccessor
ConstAccessor(const std::string &name, const std::string &clsname, const SG::AuxVarFlags flags)
Constructor.
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
SG::ConstAccessor::withDefault
const_reference_type withDefault(const AuxVectorData &container, size_t index, const T &deflt) const
Fetch the variable for one element, as a const reference.
SG::ConstAccessor::ConstAccessor
ConstAccessor(const SG::auxid_t auxid, const SG::AuxVarFlags flags)
Constructor taking an auxid directly.
SG::ConstAccessor::m_auxid
SG::auxid_t m_auxid
The cached auxid.
Definition: ConstAccessor.h:211
SG::AuxVarFlags
AuxVarFlags
Additional flags to qualify an auxiliary variable.
Definition: AuxTypes.h:58
AuxVectorData.h
Manage lookup of vectors of auxiliary data.
SG::AuxDataTraits::element_type
T element_type
The type the user sees.
Definition: AuxDataTraits.h:43
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SG::ConstAccessor::isAvailable
bool isAvailable(const AuxVectorData &c) const
Test to see if this variable exists in the store.
AuxTypes.h
Basic definitions for auxiliary types.
SG::ConstAccessor::operator()
const_reference_type operator()(const ELT &e) const
Fetch the variable for one element, as a const reference.
SG::ConstAccessor::ConstAccessor
ConstAccessor(const std::string &name, const std::string &clsname)
Constructor.
AuxTypeRegistry.h
Handle mappings between names and auxid_t.
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
SG::ConstAccessor::getDataArray
const_container_pointer_type getDataArray(const AuxVectorData &container) const
Get a pointer to the start of the auxiliary data array.
SG::AuxVectorData
Manage lookup of vectors of auxiliary data.
Definition: AuxVectorData.h:168
python.compressB64.c
def c
Definition: compressB64.py:93
ConstAccessor.icc
SG::ConstAccessor::withDefault
const_reference_type withDefault(const ELT &e, const T &deflt) const
Fetch the variable for one element, as a const reference, with a default.