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-2024 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 
52 template <class T, class ALLOC = AuxAllocator_t<T> >
54 {
55 public:
58 
62 
66 
69 
70 
77  ConstAccessor (const std::string& name);
78 
79 
87  ConstAccessor (const std::string& name, const std::string& clsname);
88 
89 
97 
98 
103  template <class ELT>
104  ATH_REQUIRES( 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 <class ELT>
130  ATH_REQUIRES( IsConstAuxElement<ELT> )
132 
133 
146  withDefault (const AuxVectorData& container, size_t index, const T& deflt) const;
147 
148 
155 
156 
161  const_span
163 
164 
169  template <class ELT>
170  ATH_REQUIRES( IsConstAuxElement<ELT> )
171  bool isAvailable (const ELT& e) const;
172 
173 
178 
179 
180 protected:
189  ConstAccessor (const std::string& name,
190  const std::string& clsname,
192 
193 
203 
204 
207 };
208 
209 
210 } // namespace SG
211 
212 
213 #include "AthContainers/ConstAccessor.icc"
214 
215 
216 #endif // not ATHCONTAINERS_CONSTACCESSOR_H
SG::ConstAccessor< ATYPE1, AuxAllocator_t< ATYPE1 > >::element_type
typename AuxDataTraits< ATYPE1, AuxAllocator_t< ATYPE1 > >::element_type element_type
Type the user sees.
Definition: ConstAccessor.h:57
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< ATYPE1, AuxAllocator_t< ATYPE1 > >::const_container_pointer_type
typename AuxDataTraits< ATYPE1, AuxAllocator_t< ATYPE1 > >::const_container_pointer_type const_container_pointer_type
Pointer into the container holding this item.
Definition: ConstAccessor.h:65
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< ATYPE1, AuxAllocator_t< ATYPE1 > >::const_span
typename AuxDataTraits< ATYPE1, AuxAllocator_t< ATYPE1 > >::const_span const_span
A span over elements in the container.
Definition: ConstAccessor.h:68
taskman.template
dictionary template
Definition: taskman.py:317
SG::ConstAccessor::ConstAccessor
ConstAccessor(const std::string &name)
Constructor.
SG::ConstAccessor::ConstAccessor
ConstAccessor(const SG::auxid_t auxid)
Constructor taking an auxid directly.
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
SG::AuxDataTraits::const_container_pointer_type
typename vector_type::const_pointer const_container_pointer_type
Definition: AuxDataTraits.h:58
protected
#define protected
Definition: DetDescrConditionsDict_dict_fixes.cxx:14
CxxUtils::span
Simplified version of the C++20 std::span.
Definition: span.h:67
SG::ConstAccessor< ATYPE1, AuxAllocator_t< ATYPE1 > >::const_reference_type
typename AuxDataTraits< ATYPE1, AuxAllocator_t< ATYPE1 > >::const_reference_type const_reference_type
Type referencing an item.
Definition: ConstAccessor.h:61
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
SG::ConstAccessor::m_auxid
SG::auxid_t m_auxid
The cached auxid.
Definition: ConstAccessor.h:206
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:192
AuxTypes.h
Basic definitions for auxiliary types.
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
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:167
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.