ATLAS Offline Software
Loading...
Searching...
No Matches
xAOD::ByteStreamAuxContainer_v1 Class Referenceabstract

Base class for dynamic auxiliary stores saved into ByteStream. More...

#include <ByteStreamAuxContainer_v1.h>

Inheritance diagram for xAOD::ByteStreamAuxContainer_v1:

Public Types

typedef SG::auxid_t auxid_t
 The aux ID type definition from IConstAuxStore.
typedef SG::auxid_set_t auxid_set_t
 The aux ID set type definition from IConstAuxStore.
template<class T, class ALLOC = std::allocator<T>>
using AuxVariable_t = std::vector<T, ALLOC>
 Declare how to wrap variables for this sort of base.

Public Member Functions

 ByteStreamAuxContainer_v1 ()
 Default constructor.
 ByteStreamAuxContainer_v1 (const ByteStreamAuxContainer_v1 &parent)
 Copy constructor.
virtual ~ByteStreamAuxContainer_v1 ()
 Destructor.
ByteStreamAuxContainer_v1operator= (const ByteStreamAuxContainer_v1 &rhs)
 Assignment operator.
void reset ()
 Function resetting the internal (cached) state of the object.
template<typename T>
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.
template<typename T>
void regAuxVar (auxid_t auxid, const std::string &name, std::vector< T > &vec)
 Register one of the user defined persistent variables internally.
virtual bool insertMove (size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore=SG::auxid_set_t())=0
 Move all elements from other to this store.
virtual bool setOption (auxid_t, const AuxDataOption &)
 Set an option for a given auxiliary variable.
virtual IAuxTypeVector * linkedVector (SG::auxid_t)
virtual const IAuxTypeVector * linkedVector (SG::auxid_t) const
 Return interface for a linked variable.
Functions implementing the SG::IConstAuxStore interface
virtual const void * getData (auxid_t auxid) const override
 Get a pointer to a given array.
virtual const SG::IAuxTypeVectorgetVector (auxid_t auxid) const override final
 Return vector interface for one aux data item.
virtual const auxid_set_tgetAuxIDs () const override
 Get the types(names) of variables handled by this container.
virtual const auxid_set_tgetDecorIDs () const override
 Get the types(names) of decorations handled by this container.
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 isDecoration (auxid_t auxid) const override
 Test if a variable is a decoration.
virtual void lock () override
 Lock the container.
virtual bool clearDecorations () override
 Clear all decorations.
virtual void lockDecoration (SG::auxid_t auxid) override
 Lock a decoration.
virtual size_t size () const override
 Get the size of the container.
Functions implementing the SG::IAuxStore interface
virtual void * getData (auxid_t auxid, size_t size, size_t capacity) override
 Get a pointer to a given array, creating the array if necessary.
virtual const auxid_set_tgetWritableAuxIDs () const override
 Return a set of writable data identifiers.
virtual bool resize (size_t size) override
 Resize the arrays to a given size.
virtual void reserve (size_t size) override
 Reserve a given size for the arrays.
virtual void shift (size_t pos, ptrdiff_t offs) override
 Shift the contents of the stored arrays.
virtual bool insertMove (size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override
 Insert contents of another store via move.
Functions managing the instance name of the container
const charname () const
 Get the name of the container instance.
void setName (const char *name)
 Set the name of the container instance.

Static Public Attributes

static constexpr bool supportsThinning = true
 Mark that this type supports thinning operations.

Private Member Functions

size_t size_noLock () const
 Internal method: return size without taking out the lock.
template<typename T>
SG::IAuxTypeVectorgetVector1 (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.
SG::IAuxTypeVectorgetVector1 (auxid_t auxid, size_t size, size_t capacity, bool quiet, bool forDecor) const

Private Attributes

std::string m_name
 Name of the container in memory. Set externally.
Variables persisified into the ByteStream
std::map< std::string, std::vector< int > > m_int ATLAS_THREAD_SAFE
 Variable holding integer auxiliary variables.
std::map< std::string, std::vector< float > > m_float ATLAS_THREAD_SAFE
 Variable holding float auxiliary variables.
std::map< std::string, std::vector< std::vector< int > > > m_vecInt ATLAS_THREAD_SAFE
 Variable holding vector of integer auxiliary variables.
std::map< std::string, std::vector< std::vector< float > > > m_vecFloat ATLAS_THREAD_SAFE
 Variable holding vector of float auxiliary variables.

Transient variables used to implement the IAuxStore interface

typedef AthContainers_detail::mutex mutex_t
 Mutex for multithread synchronization.
typedef AthContainers_detail::lock_guard< mutex_tguard_t
auxid_set_t m_auxids ATLAS_THREAD_SAFE
 Internal list of auxiliary variables.
std::vector< SG::IAuxTypeVector * > m_staticVecs
 Internal list of static managed variables.
std::vector< SG::IAuxTypeVector * > m_dynamicVecs ATLAS_THREAD_SAFE
 Internal list of dynamic managed variables.
bool m_locked
 Has the container been locked?
SG::auxid_set_t m_decorations
 Record which variables are decorations.
mutex_t m_mutex

Detailed Description

Base class for dynamic auxiliary stores saved into ByteStream.

The point of this class is to behave similarly to xAOD::AuxContainerBase. The trigger developers can develop their specific auxiliary store classes on top of this class. The base class can manage the storage of simple variable types, while the classes inheriting from it need to manage any specific variables that they want to store.

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h

Definition at line 37 of file ByteStreamAuxContainer_v1.h.

Member Typedef Documentation

◆ auxid_set_t

The aux ID set type definition from IConstAuxStore.

Definition at line 46 of file ByteStreamAuxContainer_v1.h.

◆ auxid_t

The aux ID type definition from IConstAuxStore.

Definition at line 44 of file ByteStreamAuxContainer_v1.h.

◆ AuxVariable_t

template<class T, class ALLOC = std::allocator<T>>
using xAOD::ByteStreamAuxContainer_v1::AuxVariable_t = std::vector<T, ALLOC>

Declare how to wrap variables for this sort of base.

Definition at line 132 of file ByteStreamAuxContainer_v1.h.

◆ guard_t

◆ mutex_t

Mutex for multithread synchronization.

Definition at line 190 of file ByteStreamAuxContainer_v1.h.

Constructor & Destructor Documentation

◆ ByteStreamAuxContainer_v1() [1/2]

xAOD::ByteStreamAuxContainer_v1::ByteStreamAuxContainer_v1 ( )

Default constructor.

Definition at line 19 of file ByteStreamAuxContainer_v1.cxx.

20 : SG::IAuxStore(),
21 m_int(), m_float(), m_vecInt(), m_vecFloat(),
22 m_staticVecs(), m_dynamicVecs(),
23 m_locked( false ),
24 m_name( "UNKNOWN" ) {
25
26 }
std::vector< SG::IAuxTypeVector * > m_staticVecs
Internal list of static managed variables.
bool m_locked
Has the container been locked?
std::string m_name
Name of the container in memory. Set externally.

◆ ByteStreamAuxContainer_v1() [2/2]

xAOD::ByteStreamAuxContainer_v1::ByteStreamAuxContainer_v1 ( const ByteStreamAuxContainer_v1 & parent)

Copy constructor.

Definition at line 28 of file ByteStreamAuxContainer_v1.cxx.

30 : SG::IAuxStore( parent ),
31 m_int( parent.m_int ), m_float( parent.m_float ),
32 m_vecInt( parent.m_vecInt ), m_vecFloat( parent.m_vecFloat ),
33 // The auxiliary IDs are copied:
34 m_auxids( parent.m_auxids ),
35 // But the internal pointers are not:
37 m_dynamicVecs(), m_locked( false ),
38 m_name( parent.m_name ) {
39
40 }

◆ ~ByteStreamAuxContainer_v1()

xAOD::ByteStreamAuxContainer_v1::~ByteStreamAuxContainer_v1 ( )
virtual

Destructor.

Definition at line 42 of file ByteStreamAuxContainer_v1.cxx.

42 {
43
44 // Clean up the helper objects:
45 std::vector< SG::IAuxTypeVector* >::iterator itr = m_dynamicVecs.begin();
46 std::vector< SG::IAuxTypeVector* >::iterator end = m_dynamicVecs.end();
47 for( ; itr != end; ++itr ) {
48 if( *itr ) delete *itr;
49 }
50 itr = m_staticVecs.begin();
51 end = m_staticVecs.end();
52 for( ; itr != end; ++itr ) {
53 if( *itr ) delete *itr;
54 }
55 }

Member Function Documentation

◆ clearDecorations()

bool xAOD::ByteStreamAuxContainer_v1::clearDecorations ( )
overridevirtual

Clear all decorations.

Implements SG::IConstAuxStore.

Definition at line 195 of file ByteStreamAuxContainer_v1.cxx.

196 {
197 guard_t guard (m_mutex);
198
199 const SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
200
201 bool anycleared = false;
202 for (auxid_t auxid : m_decorations) {
203 if (m_dynamicVecs[auxid]) {
204 delete m_dynamicVecs[auxid];
205 m_dynamicVecs[auxid] = nullptr;
206 m_auxids.erase( auxid );
207 anycleared = true;
208
209 const std::string name = r.getName( auxid );
210 const std::type_info* ti = r.getType( auxid );
211 if (ti == &typeid(int))
212 m_int.erase (name);
213 else if (ti == &typeid(float))
214 m_float.erase (name);
215 else if (ti == &typeid(std::vector<int>))
216 m_vecInt.erase (name);
217 else if (ti == &typeid(std::vector<float>))
218 m_vecFloat.erase (name);
219 }
220 }
221 m_decorations.clear();
222
223 return anycleared;
224 }
static AuxTypeRegistry & instance()
Return the singleton registry instance.
SG::auxid_set_t m_decorations
Record which variables are decorations.
const char * name() const
Get the name of the container instance.
SG::auxid_t auxid_t
The aux ID type definition from IConstAuxStore.
AthContainers_detail::lock_guard< mutex_t > guard_t
int r
Definition globals.cxx:22

◆ getAuxID()

template<typename T>
auxid_t xAOD::ByteStreamAuxContainer_v1::getAuxID ( const std::string & name,
std::vector< T > & ,
SG::AuxVarFlags flags = SG::AuxVarFlags::None )

Get the auxiliary ID for one of the persistent variables.

◆ getAuxIDs()

const ByteStreamAuxContainer_v1::auxid_set_t & xAOD::ByteStreamAuxContainer_v1::getAuxIDs ( ) const
overridevirtual

Get the types(names) of variables handled by this container.

Implements SG::IConstAuxStore.

Definition at line 118 of file ByteStreamAuxContainer_v1.cxx.

118 {
119
120 // Return the full list of IDs:
121 return getWritableAuxIDs();
122 }
virtual const auxid_set_t & getWritableAuxIDs() const override
Return a set of writable data identifiers.

◆ getData() [1/2]

const void * xAOD::ByteStreamAuxContainer_v1::getData ( auxid_t auxid) const
overridevirtual

Get a pointer to a given array.

Implements SG::IConstAuxStore.

Definition at line 86 of file ByteStreamAuxContainer_v1.cxx.

86 {
87
88 const SG::IAuxTypeVector* v = getVector( auxid );
89 if( v ) {
90 return v->toPtr();
91 }
92 return nullptr;
93 }
virtual const SG::IAuxTypeVector * getVector(auxid_t auxid) const override final
Return vector interface for one aux data item.

◆ getData() [2/2]

void * xAOD::ByteStreamAuxContainer_v1::getData ( auxid_t auxid,
size_t size,
size_t capacity )
overridevirtual

Get a pointer to a given array, creating the array if necessary.

Implements SG::IAuxStore.

Definition at line 260 of file ByteStreamAuxContainer_v1.cxx.

261 {
262
263 guard_t guard (m_mutex);
264
265 // Check if we have such a static variable:
266 if( ( auxid < m_staticVecs.size() ) && ( m_staticVecs[ auxid ] ) ) {
267 // Set it to the right size:
268 m_staticVecs[ auxid ]->reserve( capacity );
269 m_staticVecs[ auxid ]->resize( size );
270 // We're done already:
271 return m_staticVecs[ auxid ]->toPtr();
272 }
273 // Check if we already know about this dynamic variable:
274 else if( ( auxid < m_dynamicVecs.size() ) &&
275 ( m_dynamicVecs[ auxid ] ) ) {
276 // Set it to the right size:
277 m_dynamicVecs[ auxid ]->reserve( capacity );
278 m_dynamicVecs[ auxid ]->resize( size );
279 // We're done already:
280 return m_dynamicVecs[ auxid ]->toPtr();
281 }
282
283 SG::IAuxTypeVector* v = getVector1 (auxid, size, capacity, false, false);
284 if( v ) {
285 return v->toPtr();
286 }
287 return nullptr;
288 }
virtual size_t size() const override
Get the size of the container.
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.

◆ getDecoration()

void * xAOD::ByteStreamAuxContainer_v1::getDecoration ( auxid_t auxid,
size_t size,
size_t capacity )
overridevirtual

Get a pointer to a given array, as a decoration.

Implements SG::IConstAuxStore.

Definition at line 132 of file ByteStreamAuxContainer_v1.cxx.

135 {
136 guard_t guard (m_mutex);
137
138 // Does this variable already exist?
139 void* ret = nullptr;
140 if( ( auxid < m_staticVecs.size() ) && ( m_staticVecs[ auxid ] ) ) {
141 ret = m_staticVecs[ auxid ]->toPtr();
142 }
143 // If it's a dynamic one:
144 else if( ( auxid < m_dynamicVecs.size() ) &&
145 ( m_dynamicVecs[ auxid ] ) ) {
146 ret = m_dynamicVecs[ auxid ]->toPtr();
147 }
148
149 if (!ret) {
150 SG::IAuxTypeVector* v = getVector1 (auxid, 0, 0, true, true);
151 if( v ) {
152 ret = v->toPtr();
153 }
154 }
155
156 if (ret) {
157 // Raise exception if locked and not a decoration.
158 if (m_locked) {
159 if ( ! m_decorations.test (auxid) ) {
160 throw SG::ExcStoreLocked (auxid);
161 }
162 }
163 return ret;
164 }
165
166 // Make a new variable.
167 // If locked, mark as a decoration.
168 if (m_locked) {
169 m_decorations.insert (auxid);
170 std::atomic_thread_fence (std::memory_order_seq_cst);
171 }
172 SG::IAuxTypeVector* v = getVector1 (auxid, size, capacity, false, true);
173 if( v ) {
174 ret = v->toPtr();
175 }
176
177 return ret;
178 }

◆ getDecorIDs()

const ByteStreamAuxContainer_v1::auxid_set_t & xAOD::ByteStreamAuxContainer_v1::getDecorIDs ( ) const
overridevirtual

Get the types(names) of decorations handled by this container.

Implements SG::IConstAuxStore.

Definition at line 125 of file ByteStreamAuxContainer_v1.cxx.

125 {
126
127 // Return the full list of IDs:
128 return m_decorations;
129 }

◆ getVector()

const SG::IAuxTypeVector * xAOD::ByteStreamAuxContainer_v1::getVector ( auxid_t auxid) const
finaloverridevirtual

Return vector interface for one aux data item.

Implements SG::IConstAuxStore.

Definition at line 95 of file ByteStreamAuxContainer_v1.cxx.

95 {
96
97 guard_t guard (m_mutex);
98
99 // If it's a static auxiliary property:
100 if( ( auxid < m_staticVecs.size() ) && ( m_staticVecs[ auxid ] ) ) {
101 // We're done already:
102 return m_staticVecs[ auxid ];
103 }
104 // If it's a dynamic one:
105 else if( ( auxid < m_dynamicVecs.size() ) &&
106 ( m_dynamicVecs[ auxid ] ) ) {
107 // We're done already:
108 return m_dynamicVecs[ auxid ];
109 }
110
111 // Try to retrieve the dynamic variable:
112 // quiet on because this method may be called from isAccessible
113 // and that shouldn't generate any output.
114 return getVector1 (auxid, 0, 0, true, false);
115 }

◆ getVector1() [1/2]

SG::IAuxTypeVector * xAOD::ByteStreamAuxContainer_v1::getVector1 ( auxid_t auxid,
size_t size,
size_t capacity,
bool quiet,
bool forDecor ) const
private

Definition at line 537 of file ByteStreamAuxContainer_v1.cxx.

540 {
541
542 // Private method --- should hold lock before calling this.
543
544 if( *( SG::AuxTypeRegistry::instance().getType( auxid ) ) ==
545 typeid( int ) ) {
546
547 return getVector1( auxid, m_int, size, capacity, quiet, forDecor );
548 }
549 else if( *( SG::AuxTypeRegistry::instance().getType( auxid ) ) ==
550 typeid( float ) ) {
551
552 return getVector1( auxid, m_float, size, capacity, quiet, forDecor );
553 }
554 else if( *( SG::AuxTypeRegistry::instance().getType( auxid ) ) ==
555 typeid( std::vector< int > ) ) {
556
557 return getVector1( auxid, m_vecInt, size, capacity, quiet, forDecor );
558 }
559 else if( *( SG::AuxTypeRegistry::instance().getType( auxid ) ) ==
560 typeid( std::vector< float > ) ) {
561
562 return getVector1( auxid, m_vecFloat, size, capacity, quiet, forDecor );
563 }
564
565 // The object can't handle this variable type...
566 std::cerr << "ERROR xAOD::ByteStreamAuxContainer_v1::getData "
567 << "Unknown variable type ("
568 << SG::AuxTypeRegistry::instance().getType( auxid )->name()
569 << ") requested" << std::endl;
570
571 return nullptr;
572 }
const std::type_info * getType(SG::auxid_t auxid) const
Return the type of an aux data item.
T getType(const char *cStr)
Return Ringer enumeration of type T identifying string type:

◆ getVector1() [2/2]

template<typename T>
SG::IAuxTypeVector * xAOD::ByteStreamAuxContainer_v1::getVector1 ( auxid_t auxid,
std::map< std::string, std::vector< T > > & pers,
size_t size,
size_t capacity,
bool quiet,
bool forDecor ) const
private

Function retrieving a simple dynamic variable.

Look for variable auxid in pers.

If capacity > 0, a new variable will be created if necessary.

If not found, create it if capacity != 0.

Definition at line 465 of file ByteStreamAuxContainer_v1.cxx.

470 {
471
472 // Private method --- should hold lock before calling this.
473
474 // Look up the name of the variable:
475 const SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
476 const std::string name = r.getName( auxid );
477
478 // Try to find the variable:
479 typename std::map< std::string, std::vector< T > >::iterator itr =
480 pers.find( name );
481 if( itr == pers.end() ) {
482 // Variable isn't there. Fail if capacity==0.
483 if (capacity == 0) {
484 if (!quiet) {
485 std::cerr << "ERROR xAOD::ByteStreamAuxContainer_v1::getData (const) "
486 << "Variable with unknown name (" << name << ") requested"
487 << std::endl;
488 }
489 return nullptr;
490 }
491
492 if (m_locked && !forDecor)
493 throw SG::ExcStoreLocked ("getData");
494
495 if (r.isLinked(auxid)) {
496 std::cerr << "ERROR xAOD::ByteStreamAuxContainer_v1 doesn't implement linked variables"
497 << std::endl;
498 return nullptr;
499 }
500
501 // Create the variable.
502 itr = pers.insert (std::make_pair (name, std::vector<T>())).first;
503 }
504
505 // Get hold of the variable.
506 std::vector< T >& var = itr->second;
507
508 // Make sure that the internal vector is big enough:
509 if( m_dynamicVecs.size() <= auxid ) {
510 m_dynamicVecs.resize( auxid + 1 );
511 }
512
513 // Just an internal check...
514 if( m_dynamicVecs[ auxid ] ) {
515 std::cerr << "ERROR xAOD::ByteStreamAuxContainer_v1::getData "
516 << "Internal inconsistency detected!" << std::endl;
517 return m_dynamicVecs[ auxid ];
518 }
519
520 // Register the variable:
521 m_dynamicVecs[ auxid ] = new AuxPersVector< T >( auxid, var, false, nullptr );
522
523 if (capacity > 0) {
524 // Set it to the right size:
525 m_dynamicVecs[ auxid ]->reserve( capacity );
526 m_dynamicVecs[ auxid ]->resize( size );
527 }
528
529 // Remember that we are now handling this variable:
530 m_auxids.insert( auxid );
531
532 // Return the pointer to the array:
533 return m_dynamicVecs[ auxid ];
534 }
JetConstituentVector::iterator iterator

◆ getWritableAuxIDs()

const ByteStreamAuxContainer_v1::auxid_set_t & xAOD::ByteStreamAuxContainer_v1::getWritableAuxIDs ( ) const
overridevirtual

Return a set of writable data identifiers.

Implements SG::IAuxStore.

Definition at line 291 of file ByteStreamAuxContainer_v1.cxx.

291 {
292
293 return m_auxids;
294 }

◆ insertMove() [1/2]

virtual bool SG::IAuxStore::insertMove ( size_t pos,
IAuxStore & other,
const SG::auxid_set_t & ignore = SG::auxid_set_t() )
pure virtualinherited

Move all elements from other to this store.

Parameters
posThe starting index of the insertion.
otherStore from which to do the move.
ignoreSet of variables that should not be added to the store.

Let len be the size of other. The store will be increased in size by len elements, with the elements at pos being copied to pos+len. Then, for each auxiliary variable, the entire contents of that variable for other will be moved to this store at index pos. This will be done via move semantics if possible; otherwise, it will be done with a copy. Variables present in this store but not in other will have the corresponding elements default-initialized. Variables in other but not in this store will be added unless they are in ignore.

Returns true if it is known that none of the vectors' memory moved, false otherwise.

Implemented in SG::AuxStoreInternal.

◆ insertMove() [2/2]

bool xAOD::ByteStreamAuxContainer_v1::insertMove ( size_t pos,
IAuxStore & other,
const SG::auxid_set_t & ignore )
overridevirtual

Insert contents of another store via move.

Definition at line 363 of file ByteStreamAuxContainer_v1.cxx.

365 {
366
367 guard_t guard( m_mutex );
368
369 // This operation is not allowed on a locked container:
370 if( m_locked ) {
371 throw SG::ExcStoreLocked( "insertMove" );
372 }
373
374 bool nomove = true;
375 size_t other_size = other.size();
376
377 SG::auxid_set_t ignore = ignore_in;
378
379 // Do the operation on the static variables:
380 for (SG::auxid_t id : m_auxids) {
381 SG::IAuxTypeVector* v_dst = nullptr;
382 if (id < m_dynamicVecs.size())
383 v_dst = m_dynamicVecs[id];
384 if (!v_dst && id < m_staticVecs.size())
385 v_dst = m_staticVecs[id];
386 if (v_dst) {
387 ignore.insert (id);
388 if (other.getData (id)) {
389 void* src_ptr = other.getData (id, other_size, other_size);
390 if (src_ptr) {
391 if (!v_dst->insertMove (pos, src_ptr, 0, other_size,
392 other))
393 nomove = false;
394 }
395 }
396 else {
397 const void* orig = v_dst->toPtr();
398 v_dst->shift (pos, other_size);
399 if (orig != v_dst->toPtr())
400 nomove = false;
401 }
402 }
403 }
404
405 // Add any new variables not present in the original container.
406 for (SG::auxid_t id : other.getAuxIDs()) {
407 if (!m_auxids.test(id) &&
408 !ignore.test(id))
409 {
410 if (other.getData (id)) {
411 void* src_ptr = other.getData (id, other_size, other_size);
412 if (src_ptr) {
413 size_t sz = size_noLock();
414 getVector1 (id, sz, sz, true, false);
415 m_dynamicVecs[id]->resize (sz - other_size);
416 (void)m_dynamicVecs[id]->insertMove (pos, src_ptr, 0, other_size,
417 other);
418 nomove = false;
419 }
420 }
421 }
422 }
423
424 return nomove;
425 }
static Double_t sz
virtual void * toPtr()=0
Return a pointer to the start of the vector's data.
virtual bool insertMove(size_t pos, void *src, size_t src_pos, size_t src_n, IAuxStore &srcStore)=0
Insert elements into the vector via move semantics.
virtual bool shift(size_t pos, ptrdiff_t offs)=0
Shift the elements of the vector.
size_t size_noLock() const
Internal method: return size without taking out the lock.
virtual bool insertMove(size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore) override
Insert contents of another store via move.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27

◆ isDecoration()

bool xAOD::ByteStreamAuxContainer_v1::isDecoration ( auxid_t auxid) const
overridevirtual

Test if a variable is a decoration.

Implements SG::IConstAuxStore.

Definition at line 182 of file ByteStreamAuxContainer_v1.cxx.

183 {
184 guard_t guard (m_mutex);
185 return m_locked && m_decorations.test (auxid);
186 }

◆ linkedVector() [1/2]

virtual IAuxTypeVector * SG::IAuxStore::linkedVector ( SG::auxid_t )
inlinevirtualinherited

Reimplemented in SG::AuxStoreInternal, xAOD::AuxContainerBase, xAOD::AuxInfoBase, and xAOD::details::AuxStoreBase.

Definition at line 187 of file IAuxStore.h.

188 { return nullptr; }

◆ linkedVector() [2/2]

virtual const IAuxTypeVector * SG::IConstAuxStore::linkedVector ( SG::auxid_t ) const
inlinevirtualinherited

Return interface for a linked variable.

Parameters
auxidThe ID of the parent variable.

If auxid has a linked variable, then return the IAuxTypeVector describing it. Otherwise, return nullptr. May return nullptr unconditionally if this store does not support linked variables.

Reimplemented from SG::IConstAuxStore.

Definition at line 189 of file IConstAuxStore.h.

190 { return nullptr; }

◆ lock()

void xAOD::ByteStreamAuxContainer_v1::lock ( )
overridevirtual

Lock the container.

Implements SG::IConstAuxStore.

Definition at line 189 of file ByteStreamAuxContainer_v1.cxx.

190 {
191 guard_t guard (m_mutex);
192 m_locked = true;
193 }

◆ lockDecoration()

void xAOD::ByteStreamAuxContainer_v1::lockDecoration ( SG::auxid_t auxid)
overridevirtual

Lock a decoration.

Implements SG::IConstAuxStore.

Definition at line 228 of file ByteStreamAuxContainer_v1.cxx.

229 {
230 guard_t guard (m_mutex);
231 m_decorations.reset (auxid);
232 }

◆ name()

const char * xAOD::ByteStreamAuxContainer_v1::name ( ) const

Get the name of the container instance.

Definition at line 450 of file ByteStreamAuxContainer_v1.cxx.

450 {
451
452 return m_name.c_str();
453 }

◆ operator=()

ByteStreamAuxContainer_v1 & xAOD::ByteStreamAuxContainer_v1::operator= ( const ByteStreamAuxContainer_v1 & rhs)

Assignment operator.

Definition at line 58 of file ByteStreamAuxContainer_v1.cxx.

59 {
60
61 if (this != &rhs) {
62 // Copy the persistent variables:
63 m_int = rhs.m_int;
64 m_float = rhs.m_float;
65 m_vecInt = rhs.m_vecInt;
66 m_vecFloat = rhs.m_vecFloat;
67
68 // Also copy the list of auxiliary IDs handled:
69 m_auxids = rhs.m_auxids;
70
71 // The static variables should be left alone. Those should still
72 // point to the correct places in memory. But the dynamic variables
73 // need to be cleared out. Those will be re-created when/if needed.
74 for( auto* ptr : m_dynamicVecs ) {
75 delete ptr;
76 }
77 m_dynamicVecs.clear();
78
79 // Copy the container's name:
80 m_name = rhs.m_name;
81 }
82
83 return *this;
84 }
void * ptr(T *p)
Definition SGImplSvc.cxx:74

◆ regAuxVar()

template<typename T>
void xAOD::ByteStreamAuxContainer_v1::regAuxVar ( auxid_t auxid,
const std::string & name,
std::vector< T > & vec )

Register one of the user defined persistent variables internally.

◆ reserve()

void xAOD::ByteStreamAuxContainer_v1::reserve ( size_t size)
overridevirtual

Reserve a given size for the arrays.

Implements SG::IAuxStore.

Definition at line 321 of file ByteStreamAuxContainer_v1.cxx.

321 {
322
323 guard_t guard (m_mutex);
324
325 if (m_locked)
326 throw SG::ExcStoreLocked ("reserve");
327
328 std::vector< SG::IAuxTypeVector* >::iterator itr = m_dynamicVecs.begin();
329 std::vector< SG::IAuxTypeVector* >::iterator end = m_dynamicVecs.end();
330 for( ; itr != end; ++itr ) {
331 if( *itr ) ( *itr )->reserve( size );
332 }
333 itr = m_staticVecs.begin();
334 end = m_staticVecs.end();
335 for( ; itr != end; ++itr ) {
336 if( *itr ) ( *itr )->reserve( size );
337 }
338
339 return;
340 }

◆ reset()

void xAOD::ByteStreamAuxContainer_v1::reset ( )

Function resetting the internal (cached) state of the object.

Definition at line 428 of file ByteStreamAuxContainer_v1.cxx.

428 {
429
430 guard_t guard (m_mutex);
431
432 for (SG::IAuxTypeVector* p : m_dynamicVecs)
433 delete p;
434 m_dynamicVecs.clear();
435
436 SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
437#define ADD_IDS(VAR, TYP) \
438 do { typedef std::map< std::string, std::vector< TYP > > CONT; \
439 for (CONT::value_type& p : VAR) \
440 m_auxids.insert (r.getAuxID< TYP > (p.first, "", SG::AuxVarFlags::SkipNameCheck)); } while(0)
441 ADD_IDS(m_int, int);
442 ADD_IDS(m_float, float);
443 ADD_IDS(m_vecInt, std::vector<int>);
444 ADD_IDS(m_vecFloat, std::vector<float>);
445#undef ADD_IDS
446
447 return;
448 }
#define ADD_IDS(VAR, TYP)

◆ resize()

bool xAOD::ByteStreamAuxContainer_v1::resize ( size_t size)
overridevirtual

Resize the arrays to a given size.

Implements SG::IAuxStore.

Definition at line 296 of file ByteStreamAuxContainer_v1.cxx.

296 {
297
298 guard_t guard (m_mutex);
299
300 if (m_locked)
301 throw SG::ExcStoreLocked ("resize");
302
303 bool nomoves = true;
304 for (SG::IAuxTypeVector* v : m_dynamicVecs) {
305 if(v) {
306 if (!v->resize( size ))
307 nomoves = false;
308 }
309 }
310
311 for (SG::IAuxTypeVector* v : m_staticVecs) {
312 if(v) {
313 if (!v->resize( size ))
314 nomoves = false;
315 }
316 }
317
318 return nomoves;
319 }

◆ setName()

void xAOD::ByteStreamAuxContainer_v1::setName ( const char * name)

Set the name of the container instance.

Definition at line 455 of file ByteStreamAuxContainer_v1.cxx.

455 {
456
457 m_name = name;
458 return;
459 }

◆ setOption()

virtual bool SG::IAuxStore::setOption ( auxid_t ,
const AuxDataOption &  )
inlinevirtualinherited

Set an option for a given auxiliary variable.

Parameters
auxidThe identifier of the desired aux data item.
optionThe option to set.

The interpretation of the option depends on the particular representation of the variable.

Returns true if the option setting was successful; false otherwise.

Reimplemented in SG::AuxStoreInternal, xAOD::AuxContainerBase, and xAOD::AuxInfoBase.

Definition at line 173 of file IAuxStore.h.

174 { return false; }

◆ shift()

void xAOD::ByteStreamAuxContainer_v1::shift ( size_t pos,
ptrdiff_t offs )
overridevirtual

Shift the contents of the stored arrays.

Implements SG::IAuxStore.

Definition at line 342 of file ByteStreamAuxContainer_v1.cxx.

342 {
343
344 guard_t guard (m_mutex);
345
346 if (m_locked)
347 throw SG::ExcStoreLocked ("shift");
348
349 std::vector< SG::IAuxTypeVector* >::iterator itr = m_dynamicVecs.begin();
350 std::vector< SG::IAuxTypeVector* >::iterator end = m_dynamicVecs.end();
351 for( ; itr != end; ++itr ) {
352 if( *itr ) ( *itr )->shift( pos, offs );
353 }
354 itr = m_staticVecs.begin();
355 end = m_staticVecs.end();
356 for( ; itr != end; ++itr ) {
357 if( *itr ) ( *itr )->shift( pos, offs );
358 }
359
360 return;
361 }

◆ size()

size_t xAOD::ByteStreamAuxContainer_v1::size ( ) const
overridevirtual

Get the size of the container.

Implements SG::IConstAuxStore.

Definition at line 253 of file ByteStreamAuxContainer_v1.cxx.

254 {
255 guard_t guard (m_mutex);
256 return size_noLock();
257 }

◆ size_noLock()

size_t xAOD::ByteStreamAuxContainer_v1::size_noLock ( ) const
private

Internal method: return size without taking out the lock.

Definition at line 235 of file ByteStreamAuxContainer_v1.cxx.

236 {
237 for (SG::auxid_t i : m_auxids) {
238 if (i < m_staticVecs.size() && m_staticVecs[i]) {
239 size_t sz = m_staticVecs[i]->size();
240 if (sz > 0)
241 return sz;
242 }
243 if (i < m_dynamicVecs.size() && m_dynamicVecs[i]) {
244 size_t sz = m_dynamicVecs[i]->size();
245 if (sz > 0)
246 return sz;
247 }
248 }
249
250 return 0;
251 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/6]

std::map< std::string, std::vector< int > > m_int xAOD::ByteStreamAuxContainer_v1::ATLAS_THREAD_SAFE
mutableprivate

Variable holding integer auxiliary variables.

Definition at line 165 of file ByteStreamAuxContainer_v1.h.

◆ ATLAS_THREAD_SAFE [2/6]

std::map< std::string, std::vector< float > > m_float xAOD::ByteStreamAuxContainer_v1::ATLAS_THREAD_SAFE
mutableprivate

Variable holding float auxiliary variables.

Definition at line 167 of file ByteStreamAuxContainer_v1.h.

◆ ATLAS_THREAD_SAFE [3/6]

std::map< std::string, std::vector< std::vector< int > > > m_vecInt xAOD::ByteStreamAuxContainer_v1::ATLAS_THREAD_SAFE
mutableprivate

Variable holding vector of integer auxiliary variables.

Definition at line 169 of file ByteStreamAuxContainer_v1.h.

◆ ATLAS_THREAD_SAFE [4/6]

std::map< std::string, std::vector< std::vector< float > > > m_vecFloat xAOD::ByteStreamAuxContainer_v1::ATLAS_THREAD_SAFE
mutableprivate

Variable holding vector of float auxiliary variables.

Definition at line 171 of file ByteStreamAuxContainer_v1.h.

◆ ATLAS_THREAD_SAFE [5/6]

auxid_set_t m_auxids xAOD::ByteStreamAuxContainer_v1::ATLAS_THREAD_SAFE
mutableprivate

Internal list of auxiliary variables.

Definition at line 179 of file ByteStreamAuxContainer_v1.h.

◆ ATLAS_THREAD_SAFE [6/6]

std::vector< SG::IAuxTypeVector* > m_dynamicVecs xAOD::ByteStreamAuxContainer_v1::ATLAS_THREAD_SAFE
mutableprivate

Internal list of dynamic managed variables.

Definition at line 183 of file ByteStreamAuxContainer_v1.h.

◆ m_decorations

SG::auxid_set_t xAOD::ByteStreamAuxContainer_v1::m_decorations
private

Record which variables are decorations.

Definition at line 187 of file ByteStreamAuxContainer_v1.h.

◆ m_locked

bool xAOD::ByteStreamAuxContainer_v1::m_locked
private

Has the container been locked?

Definition at line 185 of file ByteStreamAuxContainer_v1.h.

◆ m_mutex

mutex_t xAOD::ByteStreamAuxContainer_v1::m_mutex
mutableprivate

Definition at line 192 of file ByteStreamAuxContainer_v1.h.

◆ m_name

std::string xAOD::ByteStreamAuxContainer_v1::m_name
private

Name of the container in memory. Set externally.

Definition at line 197 of file ByteStreamAuxContainer_v1.h.

◆ m_staticVecs

std::vector< SG::IAuxTypeVector* > xAOD::ByteStreamAuxContainer_v1::m_staticVecs
private

Internal list of static managed variables.

Definition at line 181 of file ByteStreamAuxContainer_v1.h.

◆ supportsThinning

bool SG::IAuxStore::supportsThinning = true
staticconstexprinherited

Mark that this type supports thinning operations.

See AthContainers/supportsThinning.h and AthenaPoolCnvSvc/T_AthenaPoolCnv.h. Helps guide which pool converter template will be used. If false, the default pool converter will be used rather than the aux store-specific one. Ordinary xAOD type should not touch this, but may be overridden in a derived class to handle certain special cases.

Definition at line 199 of file IAuxStore.h.


The documentation for this class was generated from the following files: