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 SG::auxid_set_t getCopyIDs (bool warnUnlocked = false) const override;
79
81 virtual bool isDecoration (auxid_t auxid) const override;
82
84 virtual void lock() override;
85
87 virtual bool clearDecorations() override;
88
90 virtual void lockDecoration (SG::auxid_t auxid) override;
91
93 virtual size_t size() const override;
94
96
99
101 virtual void* getData( auxid_t auxid, size_t size,
102 size_t capacity ) override;
103
105 virtual const auxid_set_t& getWritableAuxIDs() const override;
106
108 virtual bool resize( size_t size ) override;
110 virtual void reserve( size_t size ) override;
112 virtual void shift( size_t pos, ptrdiff_t offs ) override;
114 virtual bool insertMove (size_t pos,
115 IAuxStore& other,
116 const SG::auxid_set_t& ignore) override;
117
119
121 void reset();
122
125
127 const char* name() const;
129 void setName( const char* name );
130
132
134 template <class T, class ALLOC = std::allocator<T> >
135 using AuxVariable_t = std::vector<T, ALLOC>;
136
138 template< typename T >
139 auxid_t getAuxID( const std::string& name,
140 std::vector< T >& /*vec*/,
141 SG::AuxVarFlags flags =
144 template< typename T >
145 void regAuxVar( auxid_t auxid, const std::string& name,
146 std::vector< T >& vec );
147
148 private:
150 size_t size_noLock() const;
151
154 template< typename T >
156 std::map< std::string, std::vector< T > >& pers,
157 size_t size, size_t capacity, bool quiet,
158 bool forDecor) const;
159
161 size_t size, size_t capacity, bool quiet,
162 bool forDecor ) const;
163
166
168 mutable std::map< std::string, std::vector< int > > m_int ATLAS_THREAD_SAFE;
170 mutable std::map< std::string, std::vector< float > > m_float ATLAS_THREAD_SAFE;
172 mutable std::map< std::string, std::vector< std::vector< int > > > m_vecInt ATLAS_THREAD_SAFE;
174 mutable std::map< std::string, std::vector< std::vector< float > > > m_vecFloat ATLAS_THREAD_SAFE;
175
177
180
184 std::vector< SG::IAuxTypeVector* > m_staticVecs;
186 mutable std::vector< SG::IAuxTypeVector* > m_dynamicVecs ATLAS_THREAD_SAFE;
191
193 typedef AthContainers_detail::mutex mutex_t;
194 typedef AthContainers_detail::lock_guard<mutex_t> guard_t;
196
198
200 std::string m_name;
201
202 }; // class ByteStreamAuxContainer_v1
203
204} // namespace xAOD
205
206// Declare the inheritace of the container:
207#include "xAODCore/BaseInfo.h"
209
212
213// Include the template implementation:
215
216#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 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.
virtual SG::auxid_set_t getCopyIDs(bool warnUnlocked=false) const override
Get the set of variables that we should deep copy.
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.