ATLAS Offline Software
Loading...
Searching...
No Matches
AuxInfoBase.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_AUXINFOBASE_H
6#define XAODCORE_AUXINFOBASE_H
7
8// System include(s):
9#include <vector>
10
11// EDM include(s):
17#include "SGCore/ILockable.h"
18
19// Local include(s):
21
22// Forward declaration(s):
23namespace SG {
24 class IAuxTypeVector;
25 class AuxDataOption;
26}
27
28namespace xAOD {
29
41 class AuxInfoBase : public SG::IAuxStore,
42 public SG::IAuxStoreIO,
44 public ILockable
45 {
46
47 public:
52
54 AuxInfoBase( bool allowDynamicVars = true );
56 AuxInfoBase( const AuxInfoBase& parent );
58 AuxInfoBase( SG::IAuxStore* store );
61
63 AuxInfoBase& operator=( const AuxInfoBase& rhs );
64
67
69 virtual SG::IAuxStore* getStore() override;
71 virtual const SG::IAuxStore* getStore() const override;
73 virtual void setStore( SG::IAuxStore* store ) override;
75 virtual AuxStoreType getStoreType() const override { return AST_ObjectStore; }
76
78
81
83 virtual const void* getData( auxid_t auxid ) const override;
84
86 virtual const SG::IAuxTypeVector* getVector (SG::auxid_t auxid) const override final;
87
89 virtual const auxid_set_t& getAuxIDs() const override;
90
92 virtual const auxid_set_t& getDecorIDs() const override;
93
95 virtual bool isDecoration (auxid_t auxid) const override;
96
98 virtual void* getDecoration( auxid_t auxid, size_t size,
99 size_t capacity ) override;
100
102 virtual void lock() override;
103
105 virtual bool clearDecorations() override;
106
108 virtual size_t size() const override;
109
111 virtual void lockDecoration (SG::auxid_t auxid) override;
112
114 virtual const SG::IAuxTypeVector* linkedVector (SG::auxid_t auxid) const override;
115
117
120
122 virtual void* getData( auxid_t auxid, size_t size,
123 size_t capacity ) override;
124
126 virtual const auxid_set_t& getWritableAuxIDs() const override;
127
129 virtual bool resize( size_t size ) override;
131 virtual void reserve( size_t size ) override;
133 virtual void shift( size_t pos, ptrdiff_t offs ) override;
135 virtual bool insertMove (size_t pos,
136 IAuxStore& other,
137 const SG::auxid_set_t& ignore) override;
139 virtual bool setOption( auxid_t id, const SG::AuxDataOption& option ) override;
140
142 virtual SG::IAuxTypeVector* linkedVector (SG::auxid_t auxid) override;
143
145
148
150 virtual const void* getIOData( auxid_t auxid ) const override;
151
153 virtual const std::type_info* getIOType( auxid_t auxid ) const override;
154
156 virtual const auxid_set_t& getDynamicAuxIDs() const override;
157
159 virtual SG::auxid_set_t getSelectedAuxIDs() const override;
160
162
165
167 const char* name() const;
169 void setName( const char* name );
170
172
174 template <class T, class ALLOC = std::allocator<T> >
175 using AuxVariable_t = T;
176 template <class T, class ALLOC = std::allocator<T> >
177 using LinkedVariable_t = std::vector<T, ALLOC>;
178
180 template< typename T >
181 auxid_t getAuxID( const std::string& name,
182 T& /*info*/,
183 SG::AuxVarFlags flags =
185 const SG::auxid_t linkedVariable = SG::null_auxid );
187 template< typename T >
188 void regAuxVar( auxid_t auxid, const std::string& name,
189 T& info );
190
191 private:
195 std::vector< SG::IAuxTypeVector* > m_vecs;
196
205
207 typedef AthContainers_detail::mutex mutex_t;
208 typedef AthContainers_detail::lock_guard< mutex_t > guard_t;
210
212 std::string m_name;
213
214 }; // class AuxInfoBase
215
216} // namespace xAOD
217
218// Declare a class ID for the class:
219#include "xAODCore/CLASS_DEF.h"
220CLASS_DEF( xAOD::AuxInfoBase, 226113180, 1 )
221
222// Describe the inheritance of the class:
223#include "xAODCore/BaseInfo.h"
226
227// Include the template implementation:
228#include "AuxInfoBase.icc"
229
230#endif // XAODCORE_AUXINFOBASE_H
Handle mappings between names and auxid_t.
#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.
Interface to allow an object to lock itself when made const in SG.
Definition ILockable.h:32
Hold information about an option setting request.
Interface for objects taking part in direct ROOT I/O.
AuxStoreType
Type of the auxiliary store.
@ AST_ObjectStore
The store describes a single object.
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:48
Abstract interface for manipulating vectors of arbitrary types.
A set of aux data identifiers.
Definition AuxTypes.h:47
Common base class for auxiliary info objects.
Definition AuxInfoBase.h:45
virtual const auxid_set_t & getDecorIDs() const override
Get the types(names) of decorations handled by this container.
virtual SG::IAuxStore * getStore() override
Get the currently used internal store object.
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.
bool m_ownsStore
Flag deciding if the object owns the dynamic store or not.
const char * name() const
Get the name of the container instance.
std::vector< T, ALLOC > LinkedVariable_t
auxid_t getAuxID(const std::string &name, 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 void lockDecoration(SG::auxid_t auxid) override
Lock a decoration.
virtual void setStore(SG::IAuxStore *store) override
Set a different internal store object.
~AuxInfoBase()
Destructor.
auxid_set_t m_auxids
Internal list of all available variables.
T AuxVariable_t
Declare how to wrap variables for this sort of base.
void setName(const char *name)
Set the name of the container instance.
SG::IAuxStoreIO * m_storeIO
The IO interface to the internal auxiliary store.
AuxInfoBase & operator=(const AuxInfoBase &rhs)
Assignment operator.
std::vector< SG::IAuxTypeVector * > m_vecs
Internal list of all managed variables.
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override
Insert contents of another store via move.
virtual void lock() override
Lock the container.
virtual size_t size() const override
Get the size of the container.
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
AuxInfoBase(bool allowDynamicVars=true)
Default constructor.
virtual void reserve(size_t size) override
Reserve a given size for the arrays.
virtual bool setOption(auxid_t id, const SG::AuxDataOption &option) override
Make an option setting on an aux variable.
virtual const SG::IAuxTypeVector * getVector(SG::auxid_t auxid) const override final
Return vector interface for one aux data item.
SG::auxid_t auxid_t
The aux ID type definition.
Definition AuxInfoBase.h:49
AthContainers_detail::lock_guard< mutex_t > guard_t
virtual bool isDecoration(auxid_t auxid) const override
Test if a variable is a decoration.
bool m_locked
Has the container been locked?
virtual const auxid_set_t & getDynamicAuxIDs() const override
Get the types(names) of variables created dynamically.
void regAuxVar(auxid_t auxid, const std::string &name, T &info)
Register one of the persistent variables internally.
virtual SG::auxid_set_t getSelectedAuxIDs() const override
Get the IDs of the selected dynamic Aux variables (for writing)
virtual bool resize(size_t size) override
Resize the arrays to a given size.
virtual const SG::IAuxTypeVector * linkedVector(SG::auxid_t auxid) const override
Return interface for a linked variable.
virtual const void * getData(auxid_t auxid) const override
Get a pointer to a given array.
virtual const auxid_set_t & getWritableAuxIDs() const override
Return a set of writable data identifiers.
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the contents of the stored arrays.
std::string m_name
Name of the container in memory. Set externally.
virtual const void * getIOData(auxid_t auxid) const override
Get a pointer to the data being stored for one aux data item.
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Get a pointer to a given array, as a decoration.
virtual bool clearDecorations() override
Clear all decorations.
SG::IAuxStore * m_store
Internal dynamic auxiliary store object.
AthContainers_detail::mutex mutex_t
Mutex for multithread synchronization.
SG::auxid_set_t auxid_set_t
The aux ID set type definition.
Definition AuxInfoBase.h:51
virtual AuxStoreType getStoreType() const override
Return the type of the store object.
Definition AuxInfoBase.h:75
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
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Threading definitions.