ATLAS Offline Software
Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
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:
Collaboration diagram for xAOD::ByteStreamAuxContainer_v1:

Public Types

typedef SG::auxid_t auxid_t
 The aux ID type definition from IConstAuxStore. More...
 
typedef SG::auxid_set_t auxid_set_t
 The aux ID set type definition from IConstAuxStore. More...
 
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. More...
 

Public Member Functions

 ByteStreamAuxContainer_v1 ()
 Default constructor. More...
 
 ByteStreamAuxContainer_v1 (const ByteStreamAuxContainer_v1 &parent)
 Copy constructor. More...
 
virtual ~ByteStreamAuxContainer_v1 ()
 Destructor. More...
 
ByteStreamAuxContainer_v1operator= (const ByteStreamAuxContainer_v1 &rhs)
 Assignment operator. More...
 
void reset ()
 Function resetting the internal (cached) state of the object. More...
 
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. More...
 
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. More...
 
virtual const void * getData (SG::auxid_t auxid) const=0
 Pick up the const version from the base class. More...
 
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. More...
 
virtual bool setOption (auxid_t, const AuxDataOption &)
 Set an option for a given auxiliary variable. More...
 
virtual IAuxTypeVector * linkedVector (SG::auxid_t)
 
virtual const IAuxTypeVector * linkedVector (SG::auxid_t) const
 Return interface for a linked variable. More...
 
virtual const IAuxTypeVector * linkedVector (SG::auxid_t) const
 Return interface for a linked variable. More...
 

Static Public Attributes

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

Private Member Functions

size_t size_noLock () const
 Internal method: return size without taking out the lock. More...
 
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. More...
 
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. More...
 

Transient variables used to implement the IAuxStore interface

typedef AthContainers_detail::mutex mutex_t
 Mutex for multithread synchronization. More...
 
typedef AthContainers_detail::lock_guard< mutex_tguard_t
 
auxid_set_t m_auxids ATLAS_THREAD_SAFE
 Internal list of auxiliary variables. More...
 
std::vector< SG::IAuxTypeVector * > m_staticVecs
 Internal list of static managed variables. More...
 
std::vector< SG::IAuxTypeVector * > m_dynamicVecs ATLAS_THREAD_SAFE
 Internal list of dynamic managed variables. More...
 
bool m_locked
 Has the container been locked? More...
 
SG::auxid_set_t m_decorations
 Record which variables are decorations. More...
 
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 39 of file ByteStreamAuxContainer_v1.h.

Member Typedef Documentation

◆ auxid_set_t

The aux ID set type definition from IConstAuxStore.

Definition at line 50 of file ByteStreamAuxContainer_v1.h.

◆ auxid_t

The aux ID type definition from IConstAuxStore.

Definition at line 48 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 136 of file ByteStreamAuxContainer_v1.h.

◆ guard_t

typedef AthContainers_detail::lock_guard<mutex_t> xAOD::ByteStreamAuxContainer_v1::guard_t
private

Definition at line 195 of file ByteStreamAuxContainer_v1.h.

◆ mutex_t

typedef AthContainers_detail::mutex xAOD::ByteStreamAuxContainer_v1::mutex_t
private

Mutex for multithread synchronization.

Definition at line 194 of file ByteStreamAuxContainer_v1.h.

Constructor & Destructor Documentation

◆ ByteStreamAuxContainer_v1() [1/2]

xAOD::ByteStreamAuxContainer_v1::ByteStreamAuxContainer_v1 ( )

Default constructor.

Definition at line 18 of file ByteStreamAuxContainer_v1.cxx.

19  : SG::IAuxStore(),
20  m_int(), m_float(), m_vecInt(), m_vecFloat(),
21  m_staticVecs(), m_dynamicVecs(),
22  m_locked( false ),
23  m_name( "UNKNOWN" ) {
24 
25  }

◆ ByteStreamAuxContainer_v1() [2/2]

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

Copy constructor.

Definition at line 27 of file ByteStreamAuxContainer_v1.cxx.

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

◆ ~ByteStreamAuxContainer_v1()

xAOD::ByteStreamAuxContainer_v1::~ByteStreamAuxContainer_v1 ( )
virtual

Destructor.

Definition at line 41 of file ByteStreamAuxContainer_v1.cxx.

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

Member Function Documentation

◆ clearDecorations()

bool xAOD::ByteStreamAuxContainer_v1::clearDecorations ( )
overridevirtual

Clear all decorations.

Implements SG::IConstAuxStore.

Definition at line 194 of file ByteStreamAuxContainer_v1.cxx.

195  {
196  guard_t guard (m_mutex);
197 
199 
200  bool anycleared = false;
201  for (auxid_t auxid : m_decorations) {
202  if (m_dynamicVecs[auxid]) {
203  delete m_dynamicVecs[auxid];
204  m_dynamicVecs[auxid] = nullptr;
205  m_auxids.erase( auxid );
206  anycleared = true;
207 
208  const std::string name = r.getName( auxid );
209  const std::type_info* ti = r.getType( auxid );
210  if (ti == &typeid(int))
211  m_int.erase (name);
212  else if (ti == &typeid(float))
213  m_float.erase (name);
214  else if (ti == &typeid(std::vector<int>))
215  m_vecInt.erase (name);
216  else if (ti == &typeid(std::vector<float>))
217  m_vecFloat.erase (name);
218  }
219  }
221 
222  return anycleared;
223  }

◆ 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 117 of file ByteStreamAuxContainer_v1.cxx.

117  {
118 
119  // Return the full list of IDs:
120  return getWritableAuxIDs();
121  }

◆ getData() [1/3]

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

Get a pointer to a given array.

Implements SG::IConstAuxStore.

Definition at line 85 of file ByteStreamAuxContainer_v1.cxx.

85  {
86 
87  const SG::IAuxTypeVector* v = getVector( auxid );
88  if( v ) {
89  return v->toPtr();
90  }
91  return nullptr;
92  }

◆ getData() [2/3]

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 259 of file ByteStreamAuxContainer_v1.cxx.

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

◆ getData() [3/3]

virtual const void* SG::IConstAuxStore::getData
inherited

Pick up the const version from the base class.

◆ 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 131 of file ByteStreamAuxContainer_v1.cxx.

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

◆ 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 124 of file ByteStreamAuxContainer_v1.cxx.

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

◆ 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 94 of file ByteStreamAuxContainer_v1.cxx.

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

◆ 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 536 of file ByteStreamAuxContainer_v1.cxx.

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

◆ 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 464 of file ByteStreamAuxContainer_v1.cxx.

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

◆ 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 290 of file ByteStreamAuxContainer_v1.cxx.

290  {
291 
292  return m_auxids;
293  }

◆ insertMove() [1/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 362 of file ByteStreamAuxContainer_v1.cxx.

364  {
365 
366  guard_t guard( m_mutex );
367 
368  // This operation is not allowed on a locked container:
369  if( m_locked ) {
370  throw SG::ExcStoreLocked( "insertMove" );
371  }
372 
373  bool nomove = true;
374  size_t other_size = other.size();
375 
376  SG::auxid_set_t ignore = ignore_in;
377 
378  // Do the operation on the static variables:
379  for (SG::auxid_t id : m_auxids) {
380  SG::IAuxTypeVector* v_dst = nullptr;
381  if (id < m_dynamicVecs.size())
382  v_dst = m_dynamicVecs[id];
383  if (!v_dst && id < m_staticVecs.size())
384  v_dst = m_staticVecs[id];
385  if (v_dst) {
386  ignore.insert (id);
387  if (other.getData (id)) {
388  void* src_ptr = other.getData (id, other_size, other_size);
389  if (src_ptr) {
390  if (!v_dst->insertMove (pos, src_ptr, 0, other_size,
391  other))
392  nomove = false;
393  }
394  }
395  else {
396  const void* orig = v_dst->toPtr();
397  v_dst->shift (pos, other_size);
398  if (orig != v_dst->toPtr())
399  nomove = false;
400  }
401  }
402  }
403 
404  // Add any new variables not present in the original container.
405  for (SG::auxid_t id : other.getAuxIDs()) {
406  if (!m_auxids.test(id) &&
407  !ignore.test(id))
408  {
409  if (other.getData (id)) {
410  void* src_ptr = other.getData (id, other_size, other_size);
411  if (src_ptr) {
412  size_t sz = size_noLock();
413  getVector1 (id, sz, sz, true, false);
414  m_dynamicVecs[id]->resize (sz - other_size);
415  m_dynamicVecs[id]->insertMove (pos, src_ptr, 0, other_size,
416  other);
417  nomove = false;
418  }
419  }
420  }
421  }
422 
423  return nomove;
424  }

◆ insertMove() [2/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.

◆ isDecoration()

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

Test if a variable is a decoration.

Implements SG::IConstAuxStore.

Definition at line 181 of file ByteStreamAuxContainer_v1.cxx.

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

◆ linkedVector() [1/3]

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

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

Definition at line 187 of file IAuxStore.h.

188  { return nullptr; }

◆ linkedVector() [2/3]

virtual const IAuxTypeVector* SG::IConstAuxStore::linkedVector
inlineinherited

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.

Definition at line 189 of file IConstAuxStore.h.

190  { return nullptr; }

◆ linkedVector() [3/3]

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 in SG::AuxStoreInternal, xAOD::TAuxStore, xAOD::AuxContainerBase, xAOD::AuxInfoBase, and xAOD::RAuxStore.

Definition at line 189 of file IConstAuxStore.h.

190  { return nullptr; }

◆ lock()

void xAOD::ByteStreamAuxContainer_v1::lock ( )
overridevirtual

Lock the container.

Implements ILockable.

Definition at line 188 of file ByteStreamAuxContainer_v1.cxx.

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

◆ lockDecoration()

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

Lock a decoration.

Implements SG::IConstAuxStore.

Definition at line 227 of file ByteStreamAuxContainer_v1.cxx.

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

◆ name()

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

Get the name of the container instance.

Definition at line 449 of file ByteStreamAuxContainer_v1.cxx.

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

◆ operator=()

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

Assignment operator.

Definition at line 57 of file ByteStreamAuxContainer_v1.cxx.

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

◆ 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 320 of file ByteStreamAuxContainer_v1.cxx.

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

◆ reset()

void xAOD::ByteStreamAuxContainer_v1::reset ( )

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

Definition at line 427 of file ByteStreamAuxContainer_v1.cxx.

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

◆ resize()

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

Resize the arrays to a given size.

Implements SG::IAuxStore.

Definition at line 295 of file ByteStreamAuxContainer_v1.cxx.

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

◆ setName()

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

Set the name of the container instance.

Definition at line 454 of file ByteStreamAuxContainer_v1.cxx.

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

◆ 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 xAOD::AuxContainerBase, xAOD::AuxInfoBase, and SG::AuxStoreInternal.

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 341 of file ByteStreamAuxContainer_v1.cxx.

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

◆ size()

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

Get the size of the container.

Implements SG::IConstAuxStore.

Definition at line 252 of file ByteStreamAuxContainer_v1.cxx.

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

◆ size_noLock()

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

Internal method: return size without taking out the lock.

Definition at line 234 of file ByteStreamAuxContainer_v1.cxx.

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

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 169 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 171 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 173 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 175 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 183 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 187 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 191 of file ByteStreamAuxContainer_v1.h.

◆ m_locked

bool xAOD::ByteStreamAuxContainer_v1::m_locked
private

Has the container been locked?

Definition at line 189 of file ByteStreamAuxContainer_v1.h.

◆ m_mutex

mutex_t xAOD::ByteStreamAuxContainer_v1::m_mutex
mutableprivate

Definition at line 196 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 201 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 185 of file ByteStreamAuxContainer_v1.h.

◆ supportsThinning

constexpr 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:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
SG::IAuxTypeVector::shift
virtual bool shift(size_t pos, ptrdiff_t offs)=0
Shift the elements of the vector.
beamspotman.r
def r
Definition: beamspotman.py:676
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
fitman.sz
sz
Definition: fitman.py:527
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:639
quiet
bool quiet
Definition: TrigGlobEffCorrValidation.cxx:190
SG::ExcStoreLocked
Exception — Attempted to modify auxiliary data in a locked store.
Definition: Control/AthContainers/AthContainers/exceptions.h:183
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
SG::IAuxTypeVector::insertMove
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.
xAOD::ByteStreamAuxContainer_v1::m_staticVecs
std::vector< SG::IAuxTypeVector * > m_staticVecs
Internal list of static managed variables.
Definition: ByteStreamAuxContainer_v1.h:185
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
CxxUtils::ConcurrentBitset::clear
ConcurrentBitset & clear()
Clear all bits in the set.
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
SG::AuxTypeRegistry
Handle mappings between names and auxid_t.
Definition: AuxTypeRegistry.h:61
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
SG::AuxTypeRegistry::getType
const std::type_info * getType(SG::auxid_t auxid) const
Return the type of an aux data item.
Definition: AuxTypeRegistry.cxx:908
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
xAOD::ByteStreamAuxContainer_v1::auxid_t
SG::auxid_t auxid_t
The aux ID type definition from IConstAuxStore.
Definition: ByteStreamAuxContainer_v1.h:48
lumiFormat.i
int i
Definition: lumiFormat.py:85
CxxUtils::ConcurrentBitset::insert
ConcurrentBitset & insert(bit_t bit, bit_t new_nbits=0)
Set a bit to 1.
CxxUtils::ConcurrentBitset::reset
ConcurrentBitset & reset(bit_t bit)
Turn off one bit.
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::ByteStreamAuxContainer_v1::m_locked
bool m_locked
Has the container been locked?
Definition: ByteStreamAuxContainer_v1.h:189
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
xAOD::ByteStreamAuxContainer_v1::getWritableAuxIDs
virtual const auxid_set_t & getWritableAuxIDs() const override
Return a set of writable data identifiers.
Definition: ByteStreamAuxContainer_v1.cxx:290
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::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
python.PyAthena.v
v
Definition: PyAthena.py:154
SG::IAuxTypeVector
Abstract interface for manipulating vectors of arbitrary types.
Definition: IAuxTypeVector.h:42
SG::auxid_set_t
A set of aux data identifiers.
Definition: AuxTypes.h:47
xAOD::ByteStreamAuxContainer_v1::m_decorations
SG::auxid_set_t m_decorations
Record which variables are decorations.
Definition: ByteStreamAuxContainer_v1.h:191
xAOD::ByteStreamAuxContainer_v1::size_noLock
size_t size_noLock() const
Internal method: return size without taking out the lock.
Definition: ByteStreamAuxContainer_v1.cxx:234
Ringer::getType
T getType(const char *cStr)
Return Ringer enumeration of type T identifying string type:
ADD_IDS
#define ADD_IDS(VAR, TYP)
SG::IAuxTypeVector::toPtr
virtual void * toPtr()=0
Return a pointer to the start of the vector's data.
CxxUtils::ConcurrentBitset::test
bool test(bit_t bit) const
Test to see if a bit is set.
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