ATLAS Offline Software
Decorator.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_DECORATOR_H
18 #define ATHCONTAINERS_DECORATOR_H
19 
20 
26 #include <string>
27 #include <typeinfo>
28 
29 
30 namespace SG {
31 
32 
56 template <class T, class ALLOC = AuxAllocator_t<T> >
57 class Decorator
58 {
59 public:
62 
65 
71 
75 
76 
83  Decorator (const std::string& name);
84 
85 
93  Decorator (const std::string& name, const std::string& clsname);
94 
95 
103 
104 
113  template <class ELT>
114  ATH_REQUIRES( IsConstAuxElement<ELT> )
115  reference_type operator() (const ELT& e) const;
116 
117 
132  operator() (const AuxVectorData& container, size_t index) const;
133 
134 
140  template <class ELT>
141  ATH_REQUIRES( IsConstAuxElement<ELT> )
142  void set (const ELT& e, const element_type& x) const;
143 
144 
150 
151 
161 
162 
167  const_span
169 
170 
179  span
181 
182 
187  template <class ELT>
188  ATH_REQUIRES( IsConstAuxElement<ELT> )
189  bool isAvailable (const ELT& e) const;
190 
191 
196  template <class ELT>
197  ATH_REQUIRES( IsConstAuxElement<ELT> )
199 
200 
205 
206 
207 protected:
216  Decorator (const std::string& name,
217  const std::string& clsname,
219 
220 
230 
231 
232 private:
235 };
236 
237 
238 } // namespace SG
239 
240 
241 #include "AthContainers/Decorator.icc"
242 
243 
244 #endif // not ATHCONTAINERS_DECORATOR_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::Decorator< std::pair< float, std::string > >::const_container_pointer_type
typename AuxDataTraits< std::pair< float, std::string >, AuxAllocator_t< std::pair< float, std::string > > >::const_container_pointer_type const_container_pointer_type
Definition: Decorator.h:70
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::Decorator::getDataSpan
const_span getDataSpan(const AuxVectorData &container) const
Get a span over the auxilary data array.
IAuxElement.h
Flag that a class may have auxiliary data associated with it.
SG::Decorator::Decorator
Decorator(const SG::auxid_t auxid)
Constructor taking an auxid directly.
index
Definition: index.py:1
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
SG::Decorator::Decorator
Decorator(const std::string &name, const std::string &clsname)
Constructor.
taskman.template
dictionary template
Definition: taskman.py:317
SG::Decorator< std::pair< float, std::string > >::span
typename AuxDataTraits< std::pair< float, std::string >, AuxAllocator_t< std::pair< float, std::string > > >::span span
A span over elements in the container.
Definition: Decorator.h:73
SG::Decorator::getDecorationArray
container_pointer_type getDecorationArray(const AuxVectorData &container) const
Get a pointer to the start of the auxiliary data array.
ATH_REQUIRES
#define ATH_REQUIRES(...)
Definition: concepts.h:104
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
SG::Decorator::auxid
SG::auxid_t auxid() const
Return the aux id for this variable.
x
#define x
SG::Decorator::getDataArray
const_container_pointer_type getDataArray(const AuxVectorData &container) const
Get a pointer to the start of the auxiliary data array.
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
SG::Decorator::set
void set(const ELT &e, const element_type &x) const
Set the variable for one element.
CxxUtils::span
Simplified version of the C++20 std::span.
Definition: span.h:67
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:58
SG::AuxVarFlags
AuxVarFlags
Additional flags to qualify an auxiliary variable.
Definition: AuxTypes.h:58
SG::Decorator< std::pair< float, std::string > >::container_pointer_type
typename AuxDataTraits< std::pair< float, std::string >, AuxAllocator_t< std::pair< float, std::string > > >::container_pointer_type container_pointer_type
Pointer into the container holding this item.
Definition: Decorator.h:68
AuxVectorData.h
Manage lookup of vectors of auxiliary data.
SG::Decorator< std::pair< float, std::string > >::reference_type
typename AuxDataTraits< std::pair< float, std::string >, AuxAllocator_t< std::pair< float, std::string > > >::reference_type reference_type
Type referencing an item.
Definition: Decorator.h:61
SG::AuxDataTraits::element_type
T element_type
The type the user sees.
Definition: AuxDataTraits.h:43
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
SG::Decorator::m_auxid
SG::auxid_t m_auxid
The cached auxid.
Definition: Decorator.h:234
AuxTypes.h
Basic definitions for auxiliary types.
SG::Decorator::Decorator
Decorator(const std::string &name)
Constructor.
SG::Decorator::getDecorationSpan
span getDecorationSpan(const AuxVectorData &container) const
Get a span over the auxilary data array.
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
SG::Decorator< std::pair< float, std::string > >::const_span
typename AuxDataTraits< std::pair< float, std::string >, AuxAllocator_t< std::pair< float, std::string > > >::const_span const_span
Definition: Decorator.h:74
SG::Decorator::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
AuxTypeRegistry.h
Handle mappings between names and auxid_t.
SG::AuxVectorData
Manage lookup of vectors of auxiliary data.
Definition: AuxVectorData.h:167
SG::Decorator::isAvailableWritable
bool isAvailableWritable(const ELT &e) const
Test to see if this variable exists in the store and is writable.
SG::Decorator< std::pair< float, std::string > >::element_type
typename AuxDataTraits< std::pair< float, std::string >, AuxAllocator_t< std::pair< float, std::string > > >::element_type element_type
Type the user sees.
Definition: Decorator.h:64