ATLAS Offline Software
Loading...
Searching...
No Matches
AuxContainerBase.h
Go to the documentation of this file.
1// Dear emacs, this is -*- c++ -*-
2/*
3 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4*/
5#ifndef XAODCORE_AUXCONTAINERBASE_H
6#define XAODCORE_AUXCONTAINERBASE_H
7
8// STL include(s):
9#include <vector>
10#include <string>
11#include <memory>
12
13// EDM include(s):
22#include "SGCore/ILockable.h"
23
24// Local include(s):
26
27// Forward declaration(s):
28namespace SG {
29 class IAuxTypeVector;
30}
32namespace std { namespace pmr {
33class memory_resource;
34}}
35
37namespace xAOD {
38
52 public SG::IAuxStoreIO,
54 public ILockable
55 {
56
57 public:
62
64 AuxContainerBase( bool allowDynamicVars = true );
66 AuxContainerBase( std::pmr::memory_resource* memResource,
67 bool allowDynamicVars = true );
69 AuxContainerBase( const AuxContainerBase& parent );
72 std::pmr::memory_resource* memResource = nullptr );
75
78
81
83 virtual SG::IAuxStore* getStore() override;
84 virtual const SG::IAuxStore* getStore() const override;
86 virtual void setStore( SG::IAuxStore* store ) override;
88 virtual AuxStoreType getStoreType() const override { return AST_ContainerStore; }
89
91 std::pmr::memory_resource* memResource();
92
94
97
99 virtual const void* getData( auxid_t auxid ) const override;
100
102 virtual const SG::IAuxTypeVector* getVector (SG::auxid_t auxid) const override final;
103
105 virtual const auxid_set_t& getAuxIDs() const override;
106
108 virtual const auxid_set_t& getDecorIDs() const override;
109
111 virtual SG::auxid_set_t getCopyIDs (bool warnUnlocked = false) const override;
112
114 virtual bool isDecoration (auxid_t auxid) const override;
115
117 virtual void* getDecoration( auxid_t auxid, size_t size,
118 size_t capacity ) override;
119
121 virtual void lock() override;
122
124 virtual bool clearDecorations() override;
125
127 virtual size_t size() const override;
128
130 virtual void lockDecoration (SG::auxid_t auxid) override;
131
133 virtual const SG::IAuxTypeVector* linkedVector (SG::auxid_t auxid) const override;
134
136
139
141 virtual void* getData( auxid_t auxid, size_t size,
142 size_t capacity ) override;
143
145 virtual const auxid_set_t& getWritableAuxIDs() const override;
146
148 virtual bool resize( size_t size ) override;
150 virtual void reserve( size_t size ) override;
152 virtual void shift( size_t pos, ptrdiff_t offs ) override;
154 virtual bool insertMove (size_t pos,
155 IAuxStore& other,
156 const SG::auxid_set_t& ignore) override;
158 virtual bool setOption( auxid_t id, const SG::AuxDataOption& option ) override;
159
161 virtual SG::IAuxTypeVector* linkedVector (SG::auxid_t auxid) override;
162
165 virtual void toTransient (const EventContext& ctx) override;
166
168
171
173 virtual const void* getIOData( auxid_t auxid ) const override;
174
176 virtual const std::type_info* getIOType( auxid_t auxid ) const override;
177
179 virtual const auxid_set_t& getDynamicAuxIDs() const override;
180
182 virtual SG::auxid_set_t getSelectedAuxIDs() const override;
183
185
188
190 const char* name() const;
192 void setName( const char* name );
193
195
197 template <class T, class ALLOC = std::allocator<T> >
198 using AuxVariable_t = std::vector<T, ALLOC>;
199 template <class T, class ALLOC = std::allocator<T> >
201
203 template< typename T, typename ALLOC >
204 auxid_t getAuxID( const std::string& name,
205 std::vector< T, ALLOC >& /*vec*/,
206 SG::AuxVarFlags flags =
208 const SG::auxid_t linkedVariable = SG::null_auxid );
210 template< typename T >
211 auxid_t getAuxID( const std::string& name,
213 SG::AuxVarFlags flags =
215 const SG::auxid_t linkedVariable = SG::null_auxid );
217 template< typename T, typename ALLOC >
218 void regAuxVar( auxid_t auxid, const std::string& name,
219 std::vector< T, ALLOC >& vec );
220
222 template< typename T >
223 void regAuxVar( auxid_t auxid, const std::string& name,
225
226 private:
227 friend class ::xAODAuxContainerBaseCnv;
228
230 template< typename ELT, typename CONT >
231 void regAuxVar1( auxid_t auxid, const std::string& name,
232 CONT& vec );
233
237 std::vector< SG::IAuxTypeVector* > m_vecs;
238
247
249 typedef AthContainers_detail::mutex mutex_t;
250 typedef AthContainers_detail::lock_guard< mutex_t > guard_t;
252
254 std::string m_name;
255
258
259 }; // class AuxContainerBase
260
261} // namespace xAOD
262
263// Declare a class ID for the class:
264#include "xAODCore/CLASS_DEF.h"
265CLASS_DEF( xAOD::AuxContainerBase, 1225080690, 3 )
266
267// Describe the inheritance of the class:
268#include "xAODCore/BaseInfo.h"
271
272// Include the template implementation:
273#include "AuxContainerBase.icc"
274
275#endif // XAODCORE_AUXCONTAINERBASE_H
Handle mappings between names and auxid_t.
Cached pointer with atomic update.
std::vector< size_t > vec
#define SG_BASES3(D, B1, B2, B3)
Declare that class D derives from classes B1, B2, and B3.
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
File providing the different SG_BASE macros.
Interface providing I/O for a generic auxiliary store.
Interface for non-const operations on an auxiliary store.
Container to hold aux data to be stored in a packed form.
size_t size() const
Number of registered mappings.
Define macros for attributes used to control the static checker.
Hold information about an option setting request.
Interface for objects taking part in direct ROOT I/O.
AuxStoreType
Type of the auxiliary store.
@ AST_ContainerStore
The store describes a container.
Interface providing I/O for a generic auxiliary store.
Definition IAuxStoreIO.h:44
Interface for non-const operations on an auxiliary store.
Definition IAuxStore.h:51
Abstract interface for manipulating vectors of arbitrary types.
Container to hold aux data to be stored in a packed form.
A set of aux data identifiers.
Definition AuxTypes.h:47
POOL converter for the xAOD::AuxContainerBase class.
Common base class for the auxiliary containers.
void regAuxVar1(auxid_t auxid, const std::string &name, CONT &vec)
Common code between regAuxVar cases.
SG::auxid_set_t auxid_set_t
The aux ID set type definition.
void regAuxVar(auxid_t auxid, const std::string &name, SG::PackedContainer< T > &vec)
Register one of the persistent variables internally.
virtual bool resize(size_t size) override
Resize the arrays to a given size.
void setName(const char *name)
Set the name of the container instance.
AthContainers_detail::mutex mutex_t
Mutex for multithread synchronization.
virtual const void * getIOData(auxid_t auxid) const override
Get a pointer to the data being stored for one aux data item.
CxxUtils::CachedPointer< std::pmr::memory_resource > m_memResource ATLAS_THREAD_SAFE
Memory resource to use for this container.
bool m_locked
Has the container been locked?
AuxVariable_t< T, ALLOC > LinkedVariable_t
virtual SG::auxid_set_t getCopyIDs(bool warnUnlocked=false) const override
Get the set of variables that we should deep copy.
virtual void toTransient(const EventContext &ctx) override
Perform processing on aux variable objects just after reading to make them usable as transient object...
virtual bool isDecoration(auxid_t auxid) const override
Test if a variable is a decoration.
virtual SG::IAuxStore * getStore() override
Get the currently used internal store object.
virtual void lockDecoration(SG::auxid_t auxid) override
Lock a decoration.
std::vector< T, ALLOC > AuxVariable_t
Declare how to wrap variables for this sort of base.
virtual const void * getData(auxid_t auxid) const override
Get a pointer to a given array.
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
virtual void setStore(SG::IAuxStore *store) override
Set a different internal store object.
SG::IAuxStore * m_store
Internal dynamic auxiliary store object.
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override
Insert contents of another store via move.
virtual size_t size() const override
Get the size of the container.
virtual const SG::IAuxTypeVector * getVector(SG::auxid_t auxid) const override final
Return vector interface for one aux data item.
AuxContainerBase(bool allowDynamicVars=true)
Default constructor.
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the contents of the stored arrays.
bool m_ownsStore
Flag deciding if the object owns the dynamic store or not.
auxid_t getAuxID(const std::string &name, SG::PackedContainer< T > &, SG::AuxVarFlags flags=SG::AuxVarFlags::None, const SG::auxid_t linkedVariable=SG::null_auxid)
Get the auxiliary ID for one of the persistent variables.
virtual SG::auxid_set_t getSelectedAuxIDs() const override
Get the IDs of the selected dynamic Aux variables (for writing).
virtual const auxid_set_t & getDynamicAuxIDs() const override
Get the types(names) of variables created dynamically.
AthContainers_detail::lock_guard< mutex_t > guard_t
std::string m_name
Name of the container in memory. Set externally.
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Get a pointer to a given array, as a decoration.
virtual AuxStoreType getStoreType() const override
Return the type of the store object.
virtual void lock() override
Lock the container.
std::pmr::memory_resource * memResource()
Return the memory resource to use.
virtual const auxid_set_t & getDecorIDs() const override
Get the types(names) of decorations handled by this container.
void regAuxVar(auxid_t auxid, const std::string &name, std::vector< T, ALLOC > &vec)
Register one of the persistent variables internally.
SG::IAuxStoreIO * m_storeIO
The IO interface to the internal auxiliary store.
auxid_t getAuxID(const std::string &name, std::vector< T, ALLOC > &, SG::AuxVarFlags flags=SG::AuxVarFlags::None, const SG::auxid_t linkedVariable=SG::null_auxid)
Get the auxiliary ID for one of the persistent variables.
virtual void reserve(size_t size) override
Reserve a given size for the arrays.
auxid_set_t m_auxids
Internal list of all available variables.
virtual const std::type_info * getIOType(auxid_t auxid) const override
Return the type of the data to be stored for one aux data item.
virtual const SG::IAuxTypeVector * linkedVector(SG::auxid_t auxid) const override
Return interface for a linked variable.
virtual const auxid_set_t & getWritableAuxIDs() const override
Return a set of writable data identifiers.
std::vector< SG::IAuxTypeVector * > m_vecs
Internal list of all managed variables.
const char * name() const
Get the name of the container instance.
virtual bool clearDecorations() override
Clear all decorations.
SG::auxid_t auxid_t
The aux ID type definition.
virtual bool setOption(auxid_t id, const SG::AuxDataOption &option) override
Make an option setting on an aux variable.
AuxContainerBase & operator=(const AuxContainerBase &rhs)
Assignment operator.
Forward declaration.
AuxVarFlags
Additional flags to qualify an auxiliary variable.
Definition AuxTypes.h:58
@ None
No special flags set.
Definition AuxTypes.h:60
static const auxid_t null_auxid
To signal no aux data item.
Definition AuxTypes.h:30
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27
STL namespace.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Threading definitions.
Cached pointer with atomic update.