ATLAS Offline Software
Loading...
Searching...
No Matches
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#include "SGCore/ILockable.h"
18
19// Forward declaration(s):
20namespace SG {
21 class IAuxTypeVector;
22}
23
25namespace xAOD {
26
38 : public SG::IAuxStore,
39 public ILockable
40 {
41
42 public:
47
54
58
61
63 virtual const void* getData( auxid_t auxid ) const override;
64
66 virtual const SG::IAuxTypeVector* getVector( auxid_t auxid ) const override final;
67
69 virtual const auxid_set_t& getAuxIDs() const override;
70
72 virtual const auxid_set_t& getDecorIDs() const override;
73
75 virtual void* getDecoration (auxid_t auxid, size_t size, size_t capacity) override;
76
78 virtual bool isDecoration (auxid_t auxid) const override;
79
81 virtual void lock() override;
82
84 virtual bool clearDecorations() override;
85
87 virtual void lockDecoration (SG::auxid_t auxid) override;
88
90 virtual size_t size() const override;
91
93
96
98 virtual void* getData( auxid_t auxid, size_t size,
99 size_t capacity ) override;
100
102 virtual const auxid_set_t& getWritableAuxIDs() const override;
103
105 virtual bool resize( size_t size ) override;
107 virtual void reserve( size_t size ) override;
109 virtual void shift( size_t pos, ptrdiff_t offs ) override;
111 virtual bool insertMove (size_t pos,
112 IAuxStore& other,
113 const SG::auxid_set_t& ignore) override;
114
116
118 void reset();
119
122
124 const char* name() const;
126 void setName( const char* name );
127
129
131 template <class T, class ALLOC = std::allocator<T> >
132 using AuxVariable_t = std::vector<T, ALLOC>;
133
135 template< typename T >
136 auxid_t getAuxID( const std::string& name,
137 std::vector< T >& /*vec*/,
138 SG::AuxVarFlags flags =
141 template< typename T >
142 void regAuxVar( auxid_t auxid, const std::string& name,
143 std::vector< T >& vec );
144
145 private:
147 size_t size_noLock() const;
148
151 template< typename T >
153 std::map< std::string, std::vector< T > >& pers,
154 size_t size, size_t capacity, bool quiet,
155 bool forDecor) const;
156
158 size_t size, size_t capacity, bool quiet,
159 bool forDecor ) const;
160
163
165 mutable std::map< std::string, std::vector< int > > m_int ATLAS_THREAD_SAFE;
167 mutable std::map< std::string, std::vector< float > > m_float ATLAS_THREAD_SAFE;
169 mutable std::map< std::string, std::vector< std::vector< int > > > m_vecInt ATLAS_THREAD_SAFE;
171 mutable std::map< std::string, std::vector< std::vector< float > > > m_vecFloat ATLAS_THREAD_SAFE;
172
174
177
181 std::vector< SG::IAuxTypeVector* > m_staticVecs;
183 mutable std::vector< SG::IAuxTypeVector* > m_dynamicVecs ATLAS_THREAD_SAFE;
188
190 typedef AthContainers_detail::mutex mutex_t;
191 typedef AthContainers_detail::lock_guard<mutex_t> guard_t;
193
195
197 std::string m_name;
198
199 }; // class ByteStreamAuxContainer_v1
200
201} // namespace xAOD
202
203// Declare the inheritace of the container:
204#include "xAODCore/BaseInfo.h"
206
209
210// Include the template implementation:
212
213#endif // XAODTRIGGER_VERSIONS_BYTESTREAMAUXCONTAINER_V1_H
std::vector< size_t > vec
#define SG_BASE(D, B)
Declare that class D derives from class B.
Interface for non-const operations on an auxiliary store.
Define macros for attributes used to control the static checker.
Interface to allow an object to lock itself when made const in SG.
Definition ILockable.h:32
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
Base class for dynamic auxiliary stores saved into ByteStream.
SG::auxid_set_t m_decorations
Record which variables are decorations.
SG::auxid_set_t auxid_set_t
The aux ID set type definition from IConstAuxStore.
virtual const SG::IAuxTypeVector * getVector(auxid_t auxid) const override final
Return vector interface for one aux data item.
virtual size_t size() const override
Get the size of the container.
size_t size_noLock() const
Internal method: return size without taking out the lock.
virtual const auxid_set_t & getDecorIDs() const override
Get the types(names) of decorations handled by this container.
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
void setName(const char *name)
Set the name of the container instance.
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity) override
Get a pointer to a given array, as a decoration.
const char * name() const
Get the name of the container instance.
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override
Insert contents of another store via move.
ByteStreamAuxContainer_v1 & operator=(const ByteStreamAuxContainer_v1 &rhs)
Assignment operator.
virtual bool resize(size_t size) override
Resize the arrays to a given size.
std::vector< SG::IAuxTypeVector * > m_staticVecs
Internal list of static managed variables.
void regAuxVar(auxid_t auxid, const std::string &name, std::vector< T > &vec)
Register one of the user defined persistent variables internally.
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.
bool m_locked
Has the container been locked?
virtual const auxid_set_t & getWritableAuxIDs() const override
Return a set of writable data identifiers.
virtual bool clearDecorations() override
Clear all decorations.
virtual bool isDecoration(auxid_t auxid) const override
Test if a variable is a decoration.
virtual void lock() override
Lock the container.
std::string m_name
Name of the container in memory. Set externally.
std::map< std::string, std::vector< int > > m_int ATLAS_THREAD_SAFE
Variable holding integer auxiliary variables.
void reset()
Function resetting the internal (cached) state of the object.
AthContainers_detail::mutex mutex_t
Mutex for multithread synchronization.
std::vector< T, ALLOC > AuxVariable_t
Declare how to wrap variables for this sort of base.
virtual void reserve(size_t size) override
Reserve a given size for the arrays.
SG::auxid_t auxid_t
The aux ID type definition from IConstAuxStore.
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the contents of the stored arrays.
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.
virtual const void * getData(auxid_t auxid) const override
Get a pointer to a given array.
AthContainers_detail::lock_guard< mutex_t > guard_t
virtual void lockDecoration(SG::auxid_t auxid) override
Lock a decoration.
Forward declaration.
AuxVarFlags
Additional flags to qualify an auxiliary variable.
Definition AuxTypes.h:58
@ None
No special flags set.
Definition AuxTypes.h:60
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.