Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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-2025 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 
57 template <class T, class ALLOC = AuxAllocator_t<T> >
58 class Decorator
59 {
60 public:
63 
66 
72 
76 
77 
84  Decorator (const std::string& name);
85 
86 
94  Decorator (const std::string& name, const std::string& clsname);
95 
96 
104 
105 
114  template <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 <IsConstAuxElement ELT>
141  void set (const ELT& e, const element_type& x) const;
142 
143 
149 
150 
160 
161 
166  const_span
167  getDataSpan (const AuxVectorData& container) const;
168 
169 
178  span
179  getDecorationSpan (const AuxVectorData& container) const;
180 
181 
186  template <IsConstAuxElement ELT>
187  bool isAvailable (const ELT& e) const;
188 
189 
194  template <IsConstAuxElement ELT>
195  bool isAvailableWritable (const ELT& e) const;
196 
197 
202  bool isAvailable (const AuxVectorData& c) const;
203 
204 
209  bool isAvailableWritable (const AuxVectorData& c) const;
210 
211 
216 
217 
218 protected:
227  Decorator (const std::string& name,
228  const std::string& clsname,
229  const SG::AuxVarFlags flags);
230 
231 
240  const SG::AuxVarFlags flags);
241 
242 
243 private:
246 };
247 
248 
249 } // namespace SG
250 
251 
253 
254 
255 #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::Decorator::isAvailable
bool isAvailable(const AuxVectorData &c) const
Test to see if this variable exists in the store.
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
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:71
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.
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:74
SG::Decorator::getDecorationArray
container_pointer_type getDecorationArray(const AuxVectorData &container) const
Get a pointer to the start of the auxiliary data array.
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
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:61
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
SG::Decorator::operator()
reference_type operator()(const ELT &e) const
Fetch the variable for one element, as a non-const reference.
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
SG::Decorator::Decorator
Decorator(const SG::auxid_t auxid, const SG::AuxVarFlags flags)
Constructor taking an auxid directly.
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:69
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:62
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::Decorator::m_auxid
SG::auxid_t m_auxid
The cached auxid.
Definition: Decorator.h:245
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.
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:75
SG::Decorator::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
SG::Decorator::isAvailableWritable
bool isAvailableWritable(const AuxVectorData &c) 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:168
Decorator.icc
SG::Decorator::isAvailableWritable
bool isAvailableWritable(const ELT &e) const
Test to see if this variable exists in the store and is writable.
python.compressB64.c
def c
Definition: compressB64.py:93
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:65
SG::Decorator::Decorator
Decorator(const std::string &name, const std::string &clsname, const SG::AuxVarFlags flags)
Constructor.