ATLAS Offline Software
ByteStreamAuxContainer_v1.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 /*
3  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 */
5 #ifndef XAODTRIGGER_VERSIONS_BYTESTREAMAUXCONTAINER_V1_H
6 #define XAODTRIGGER_VERSIONS_BYTESTREAMAUXCONTAINER_V1_H
7 
8 // STL include(s):
9 #include <vector>
10 #include <map>
11 #include <string>
12 
13 // EDM include(s):
17 #ifndef XAOD_STANDALONE
18 # include "AthenaKernel/ILockable.h"
19 #endif
20 
21 // Forward declaration(s):
22 namespace SG {
23  class IAuxTypeVector;
24 }
25 
27 namespace xAOD {
28 
40  : public SG::IAuxStore
41 #ifndef XAOD_STANDALONE
42  , public ILockable
43 #endif
44  {
45 
46  public:
51 
58 
62 
65 
67  virtual const void* getData( auxid_t auxid ) const override;
68 
70  virtual const SG::IAuxTypeVector* getVector( auxid_t auxid ) const override final;
71 
73  virtual const auxid_set_t& getAuxIDs() const override;
74 
76  virtual const auxid_set_t& getDecorIDs() const override;
77 
79  virtual void* getDecoration (auxid_t auxid, size_t size, size_t capacity) override;
80 
82  virtual bool isDecoration (auxid_t auxid) const override;
83 
85  virtual void lock() override;
86 
88  virtual bool clearDecorations() override;
89 
91  virtual void lockDecoration (SG::auxid_t auxid) override;
92 
94  virtual size_t size() const override;
95 
97 
100 
102  virtual void* getData( auxid_t auxid, size_t size,
103  size_t capacity ) override;
104 
106  virtual const auxid_set_t& getWritableAuxIDs() const override;
107 
109  virtual bool resize( size_t size ) override;
111  virtual void reserve( size_t size ) override;
113  virtual void shift( size_t pos, ptrdiff_t offs ) override;
115  virtual bool insertMove (size_t pos,
116  IAuxStore& other,
117  const SG::auxid_set_t& ignore) override;
118 
120 
122  void reset();
123 
126 
128  const char* name() const;
130  void setName( const char* name );
131 
133 
135  template <class T, class ALLOC = std::allocator<T> >
136  using AuxVariable_t = std::vector<T, ALLOC>;
137 
139  template< typename T >
140  auxid_t getAuxID( const std::string& name,
141  std::vector< T >& /*vec*/,
145  template< typename T >
146  void regAuxVar( auxid_t auxid, const std::string& name,
147  std::vector< T >& vec );
148 
149  private:
151  size_t size_noLock() const;
152 
155  template< typename T >
157  std::map< std::string, std::vector< T > >& pers,
158  size_t size, size_t capacity, bool quiet,
159  bool forDecor) const;
160 
162  size_t size, size_t capacity, bool quiet,
163  bool forDecor ) const;
164 
167 
169  mutable std::map< std::string, std::vector< int > > m_int ATLAS_THREAD_SAFE;
171  mutable std::map< std::string, std::vector< float > > m_float ATLAS_THREAD_SAFE;
173  mutable std::map< std::string, std::vector< std::vector< int > > > m_vecInt ATLAS_THREAD_SAFE;
175  mutable std::map< std::string, std::vector< std::vector< float > > > m_vecFloat ATLAS_THREAD_SAFE;
176 
178 
181 
183  mutable auxid_set_t m_auxids ATLAS_THREAD_SAFE;
185  std::vector< SG::IAuxTypeVector* > m_staticVecs;
187  mutable std::vector< SG::IAuxTypeVector* > m_dynamicVecs ATLAS_THREAD_SAFE;
189  bool m_locked;
192 
195  typedef AthContainers_detail::lock_guard<mutex_t> guard_t;
196  mutable mutex_t m_mutex;
197 
199 
201  std::string m_name;
202 
203  }; // class ByteStreamAuxContainer_v1
204 
205 } // namespace xAOD
206 
207 // Declare the inheritace of the container:
208 #include "xAODCore/BaseInfo.h"
210 
213 
214 // Include the template implementation:
216 
217 #endif // XAODTRIGGER_VERSIONS_BYTESTREAMAUXCONTAINER_V1_H
xAOD::ByteStreamAuxContainer_v1::regAuxVar
void regAuxVar(auxid_t auxid, const std::string &name, std::vector< T > &vec)
Register one of the user defined persistent variables internally.
xAOD::ByteStreamAuxContainer_v1::lock
virtual void lock() override
Lock the container.
Definition: ByteStreamAuxContainer_v1.cxx:188
xAOD::ByteStreamAuxContainer_v1::resize
virtual bool resize(size_t size) override
Resize the arrays to a given size.
Definition: ByteStreamAuxContainer_v1.cxx:295
xAOD::ByteStreamAuxContainer_v1::ATLAS_THREAD_SAFE
std::map< std::string, std::vector< std::vector< float > > > m_vecFloat ATLAS_THREAD_SAFE
Variable holding vector of float auxiliary variables.
Definition: ByteStreamAuxContainer_v1.h:175
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
xAOD::ByteStreamAuxContainer_v1::getAuxID
auxid_t getAuxID(const std::string &name, std::vector< T > &, SG::AuxVarFlags flags=SG::AuxVarFlags::None)
Get the auxiliary ID for one of the persistent variables.
quiet
bool quiet
Definition: TrigGlobEffCorrValidation.cxx:190
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
xAOD::ByteStreamAuxContainer_v1::lockDecoration
virtual void lockDecoration(SG::auxid_t auxid) override
Lock a decoration.
Definition: ByteStreamAuxContainer_v1.cxx:227
ByteStreamAuxContainer_v1.icc
xAOD::ByteStreamAuxContainer_v1::getDecorIDs
virtual const auxid_set_t & getDecorIDs() const override
Get the types(names) of decorations handled by this container.
Definition: ByteStreamAuxContainer_v1.cxx:124
SG_BASE
SG_BASE(xAOD::ByteStreamAuxContainer_v1, SG::IAuxStore)
ILockable.h
Interface to allow an object to lock itself when made const in SG.
BaseInfo.h
xAOD::ByteStreamAuxContainer_v1::getVector
virtual const SG::IAuxTypeVector * getVector(auxid_t auxid) const override final
Return vector interface for one aux data item.
Definition: ByteStreamAuxContainer_v1.cxx:94
xAOD::other
@ other
Definition: TrackingPrimitives.h:509
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
xAOD::ByteStreamAuxContainer_v1::m_staticVecs
std::vector< SG::IAuxTypeVector * > m_staticVecs
Internal list of static managed variables.
Definition: ByteStreamAuxContainer_v1.h:185
xAOD::ByteStreamAuxContainer_v1::ATLAS_THREAD_SAFE
std::map< std::string, std::vector< float > > m_float ATLAS_THREAD_SAFE
Variable holding float auxiliary variables.
Definition: ByteStreamAuxContainer_v1.h:171
xAOD::ByteStreamAuxContainer_v1::ATLAS_THREAD_SAFE
std::map< std::string, std::vector< std::vector< int > > > m_vecInt ATLAS_THREAD_SAFE
Variable holding vector of integer auxiliary variables.
Definition: ByteStreamAuxContainer_v1.h:173
xAOD::ByteStreamAuxContainer_v1::operator=
ByteStreamAuxContainer_v1 & operator=(const ByteStreamAuxContainer_v1 &rhs)
Assignment operator.
Definition: ByteStreamAuxContainer_v1.cxx:58
DiTauMassTools::ignore
void ignore(T &&)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:58
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
CaloCellPos2Ntuple.None
None
Definition: CaloCellPos2Ntuple.py:23
xAOD::ByteStreamAuxContainer_v1::auxid_t
SG::auxid_t auxid_t
The aux ID type definition from IConstAuxStore.
Definition: ByteStreamAuxContainer_v1.h:48
xAOD::ByteStreamAuxContainer_v1::reserve
virtual void reserve(size_t size) override
Reserve a given size for the arrays.
Definition: ByteStreamAuxContainer_v1.cxx:320
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::ByteStreamAuxContainer_v1::reset
void reset()
Function resetting the internal (cached) state of the object.
Definition: ByteStreamAuxContainer_v1.cxx:427
xAOD::ByteStreamAuxContainer_v1::auxid_set_t
SG::auxid_set_t auxid_set_t
The aux ID set type definition from IConstAuxStore.
Definition: ByteStreamAuxContainer_v1.h:50
SG::AuxVarFlags
AuxVarFlags
Additional flags to qualify an auxiliary variable.
Definition: AuxTypes.h:58
xAOD::ByteStreamAuxContainer_v1::m_locked
bool m_locked
Has the container been locked?
Definition: ByteStreamAuxContainer_v1.h:189
xAOD::ByteStreamAuxContainer_v1::ByteStreamAuxContainer_v1
ByteStreamAuxContainer_v1()
Default constructor.
Definition: ByteStreamAuxContainer_v1.cxx:18
xAOD::ByteStreamAuxContainer_v1::AuxVariable_t
std::vector< T, ALLOC > AuxVariable_t
Declare how to wrap variables for this sort of base.
Definition: ByteStreamAuxContainer_v1.h:136
xAOD::ByteStreamAuxContainer_v1::~ByteStreamAuxContainer_v1
virtual ~ByteStreamAuxContainer_v1()
Destructor.
Definition: ByteStreamAuxContainer_v1.cxx:41
xAOD::ByteStreamAuxContainer_v1::getWritableAuxIDs
virtual const auxid_set_t & getWritableAuxIDs() const override
Return a set of writable data identifiers.
Definition: ByteStreamAuxContainer_v1.cxx:290
threading.h
Threading definitions.
xAOD::ByteStreamAuxContainer_v1::guard_t
AthContainers_detail::lock_guard< mutex_t > guard_t
Definition: ByteStreamAuxContainer_v1.h:195
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
xAOD::ByteStreamAuxContainer_v1::m_mutex
mutex_t m_mutex
Definition: ByteStreamAuxContainer_v1.h:196
xAOD::ByteStreamAuxContainer_v1::ATLAS_THREAD_SAFE
std::map< std::string, std::vector< int > > m_int ATLAS_THREAD_SAFE
Variable holding integer auxiliary variables.
Definition: ByteStreamAuxContainer_v1.h:169
xAOD::ByteStreamAuxContainer_v1::getAuxIDs
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
Definition: ByteStreamAuxContainer_v1.cxx:117
xAOD::ByteStreamAuxContainer_v1::name
const char * name() const
Get the name of the container instance.
Definition: ByteStreamAuxContainer_v1.cxx:449
SG::IAuxStore
Interface for non-const operations on an auxiliary store.
Definition: IAuxStore.h:48
xAOD::ByteStreamAuxContainer_v1::size
virtual size_t size() const override
Get the size of the container.
Definition: ByteStreamAuxContainer_v1.cxx:252
xAOD::ByteStreamAuxContainer_v1::clearDecorations
virtual bool clearDecorations() override
Clear all decorations.
Definition: ByteStreamAuxContainer_v1.cxx:194
xAOD::ByteStreamAuxContainer_v1::setName
void setName(const char *name)
Set the name of the container instance.
Definition: ByteStreamAuxContainer_v1.cxx:454
SG::IAuxTypeVector
Abstract interface for manipulating vectors of arbitrary types.
Definition: IAuxTypeVector.h:42
xAOD::ByteStreamAuxContainer_v1::ATLAS_THREAD_SAFE
std::vector< SG::IAuxTypeVector * > m_dynamicVecs ATLAS_THREAD_SAFE
Internal list of dynamic managed variables.
Definition: ByteStreamAuxContainer_v1.h:187
IAuxStore.h
Interface for non-const operations on an auxiliary store.
ILockable
Interface to allow an object to lock itself when made const in SG.
Definition: ILockable.h:32
xAOD::ByteStreamAuxContainer_v1::ATLAS_THREAD_SAFE
auxid_set_t m_auxids ATLAS_THREAD_SAFE
Internal list of auxiliary variables.
Definition: ByteStreamAuxContainer_v1.h:183
SG::auxid_set_t
A set of aux data identifiers.
Definition: AuxTypes.h:47
xAOD::ByteStreamAuxContainer_v1::isDecoration
virtual bool isDecoration(auxid_t auxid) const override
Test if a variable is a decoration.
Definition: ByteStreamAuxContainer_v1.cxx:181
xAOD::ByteStreamAuxContainer_v1::m_decorations
SG::auxid_set_t m_decorations
Record which variables are decorations.
Definition: ByteStreamAuxContainer_v1.h:191
xAOD::ByteStreamAuxContainer_v1::mutex_t
AthContainers_detail::mutex mutex_t
Mutex for multithread synchronization.
Definition: ByteStreamAuxContainer_v1.h:194
xAOD::ByteStreamAuxContainer_v1::size_noLock
size_t size_noLock() const
Internal method: return size without taking out the lock.
Definition: ByteStreamAuxContainer_v1.cxx:234
xAOD::ByteStreamAuxContainer_v1::getData
virtual const void * getData(auxid_t auxid) const override
Get a pointer to a given array.
Definition: ByteStreamAuxContainer_v1.cxx:85
checker_macros.h
Define macros for attributes used to control the static checker.
xAOD::ByteStreamAuxContainer_v1::getDecoration
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Get a pointer to a given array, as a decoration.
Definition: ByteStreamAuxContainer_v1.cxx:131
xAOD::ByteStreamAuxContainer_v1
Base class for dynamic auxiliary stores saved into ByteStream.
Definition: ByteStreamAuxContainer_v1.h:44
xAOD::ByteStreamAuxContainer_v1::insertMove
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override
Insert contents of another store via move.
Definition: ByteStreamAuxContainer_v1.cxx:362
xAOD::ByteStreamAuxContainer_v1::shift
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the contents of the stored arrays.
Definition: ByteStreamAuxContainer_v1.cxx:341
xAOD::ByteStreamAuxContainer_v1::getVector1
SG::IAuxTypeVector * getVector1(auxid_t auxid, std::map< std::string, std::vector< T > > &pers, size_t size, size_t capacity, bool quiet, bool forDecor) const
Function retrieving a simple dynamic variable.
Definition: ByteStreamAuxContainer_v1.cxx:464
xAOD::ByteStreamAuxContainer_v1::m_name
std::string m_name
Name of the container in memory. Set externally.
Definition: ByteStreamAuxContainer_v1.h:201