ATLAS Offline Software
Public Types | Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
DMTest::CInfoAuxContainer_v1 Class Referenceabstract

#include <CInfoAuxContainer_v1.h>

Inheritance diagram for DMTest::CInfoAuxContainer_v1:
Collaboration diagram for DMTest::CInfoAuxContainer_v1:

Public Types

typedef SG::auxid_t auxid_t
 The aux ID type definition. More...
 
typedef SG::auxid_set_t auxid_set_t
 The aux ID set type definition. More...
 
template<class T , class ALLOC = std::allocator<T>>
using AuxVariable_t = T
 Declare how to wrap variables for this sort of base. More...
 
template<class T , class ALLOC = std::allocator<T>>
using LinkedVariable_t = std::vector< T, ALLOC >
 
enum  AuxStoreType { AST_ObjectStore = 0, AST_ContainerStore = 1 }
 Type of the auxiliary store. More...
 

Public Member Functions

 CInfoAuxContainer_v1 ()
 
virtual const void * getData (SG::auxid_t auxid) const=0
 Pick up the const version from the base class. More...
 
virtual const IAuxTypeVector * linkedVector (SG::auxid_t) const
 Return interface for a linked variable. 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...
 
template<typename T >
auxid_t getAuxID (const std::string &name, T &, SG::AuxVarFlags flags=SG::AuxVarFlags::None, const SG::auxid_t linkedVariable=SG::null_auxid)
 Get the auxiliary ID for one of the persistent variables. More...
 
template<typename T >
void regAuxVar (auxid_t auxid, const std::string &name, T &info)
 Register one of the persistent variables internally. More...
 

Static Public Attributes

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

Private Types

typedef AthContainers_detail::mutex mutex_t
 Mutex for multithread synchronization. More...
 
typedef AthContainers_detail::lock_guard< mutex_tguard_t
 

Private Member Functions

 AUXVAR_DECL (int, anInt)
 
 AUXVAR_DECL (float, aFloat)
 

Private Attributes

auxid_set_t m_auxids
 Internal list of all available variables. More...
 
std::vector< SG::IAuxTypeVector * > m_vecs
 Internal list of all managed variables. More...
 
SG::IAuxStorem_store
 Internal dynamic auxiliary store object. More...
 
SG::IAuxStoreIOm_storeIO
 The IO interface to the internal auxiliary store. More...
 
bool m_ownsStore
 Flag deciding if the object owns the dynamic store or not. More...
 
bool m_locked
 Has the container been locked? More...
 
mutex_t m_mutex
 
std::string m_name
 Name of the container in memory. Set externally. More...
 

Detailed Description

Definition at line 27 of file CInfoAuxContainer_v1.h.

Member Typedef Documentation

◆ auxid_set_t

The aux ID set type definition.

Definition at line 55 of file AuxInfoBase.h.

◆ auxid_t

The aux ID type definition.

Definition at line 53 of file AuxInfoBase.h.

◆ AuxVariable_t

template<class T , class ALLOC = std::allocator<T>>
using xAOD::AuxInfoBase::AuxVariable_t = T
inherited

Declare how to wrap variables for this sort of base.

Definition at line 173 of file AuxInfoBase.h.

◆ guard_t

typedef AthContainers_detail::lock_guard< mutex_t > xAOD::AuxInfoBase::guard_t
privateinherited

Definition at line 206 of file AuxInfoBase.h.

◆ LinkedVariable_t

template<class T , class ALLOC = std::allocator<T>>
using xAOD::AuxInfoBase::LinkedVariable_t = std::vector<T, ALLOC>
inherited

Definition at line 175 of file AuxInfoBase.h.

◆ mutex_t

typedef AthContainers_detail::mutex xAOD::AuxInfoBase::mutex_t
privateinherited

Mutex for multithread synchronization.

Definition at line 205 of file AuxInfoBase.h.

Member Enumeration Documentation

◆ AuxStoreType

Type of the auxiliary store.

In the xAOD EDM we use auxiliary store objects in some cases to describe a single object, and in most cases to describe a container of objects. This enumeration declares which type the object implementing this interface is.

Enumerator
AST_ObjectStore 

The store describes a single object.

AST_ContainerStore 

The store describes a container.

Definition at line 66 of file IAuxStoreHolder.h.

66  {
67  AST_ObjectStore = 0,
69  };

Constructor & Destructor Documentation

◆ CInfoAuxContainer_v1()

DMTest::CInfoAuxContainer_v1::CInfoAuxContainer_v1 ( )

Definition at line 18 of file CInfoAuxContainer_v1.cxx.

20 {
21 }

Member Function Documentation

◆ AUXVAR_DECL() [1/2]

DMTest::CInfoAuxContainer_v1::AUXVAR_DECL ( float  ,
aFloat   
)
private

◆ AUXVAR_DECL() [2/2]

DMTest::CInfoAuxContainer_v1::AUXVAR_DECL ( int  ,
anInt   
)
private

◆ clearDecorations()

bool xAOD::AuxInfoBase::clearDecorations ( )
overridevirtualinherited

Clear all decorations.

Implements SG::IConstAuxStore.

Definition at line 303 of file AuxInfoBase.cxx.

303  {
304 
305  // Guard against multi-threaded execution:
306  guard_t guard( m_mutex );
307 
308  // Clear the decorations that are in the dynamic store:
309  bool anycleared = false;
310  if( m_store ) {
311  anycleared = m_store->clearDecorations();
312  }
313  // Early exit if there were no decorations.
314  if (!anycleared) return false;
315 
316  // Reconstruct the list of managed auxiliary IDs from scratch:
318  for( auxid_t auxid = 0; auxid < m_vecs.size(); ++auxid ) {
319  if( m_vecs[ auxid ] ) {
320  ids.insert( auxid );
321  }
322  }
323  if( m_store ) {
324  ids.insert (m_store->getAuxIDs());
325  }
326  m_auxids = ids;
327 
328  return true;
329  }

◆ getAuxID()

template<typename T >
auxid_t xAOD::AuxInfoBase::getAuxID ( const std::string &  name,
T &  ,
SG::AuxVarFlags  flags = SG::AuxVarFlags::None,
const SG::auxid_t  linkedVariable = SG::null_auxid 
)
inherited

Get the auxiliary ID for one of the persistent variables.

◆ getAuxIDs()

const AuxInfoBase::auxid_set_t & xAOD::AuxInfoBase::getAuxIDs ( ) const
overridevirtualinherited

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

Implements SG::IConstAuxStore.

Definition at line 240 of file AuxInfoBase.cxx.

240  {
241 
242  // Return the full list of IDs:
243  return getWritableAuxIDs();
244  }

◆ getData() [1/3]

const void * xAOD::AuxInfoBase::getData ( auxid_t  auxid) const
overridevirtualinherited

Get a pointer to a given array.

Implements SG::IConstAuxStore.

Definition at line 195 of file AuxInfoBase.cxx.

195  {
196 
197  // Guard against multi-threaded execution:
198  guard_t guard( m_mutex );
199 
200  if( ( auxid >= m_vecs.size() ) || ( ! m_vecs[ auxid ] ) ) {
201  if( m_store ) {
202  const void* result = m_store->getData( auxid );
203  if( result ) {
204  auxid_set_t& auxids_nc ATLAS_THREAD_SAFE =
205  const_cast<auxid_set_t&> (m_auxids);
206  auxids_nc.insert( auxid );
208  auxid_t linked_id = r.linkedVariable( auxid );
209  if (linked_id != SG::null_auxid) {
210  auxids_nc.insert( linked_id );
211  }
212  }
213  return result;
214  } else {
215  std::cout << "ERROR xAOD::AuxInfoBase::getData "
216  << "Unknown variable ("
218  << ") requested" << std::endl;
219  return nullptr;
220  }
221  }
222 
223  // Update the statistics for this variable. The dynamic store registers
224  // its own variable accesses.
226 
227  return m_vecs[ auxid ]->toPtr();
228  }

◆ getData() [2/3]

void * xAOD::AuxInfoBase::getData ( auxid_t  auxid,
size_t  size,
size_t  capacity 
)
overridevirtualinherited

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

Implements SG::IAuxStore.

Definition at line 405 of file AuxInfoBase.cxx.

406  {
407 
408  // Guard against multi-threaded execution:
409  guard_t guard( m_mutex );
410 
411  if( ( auxid >= m_vecs.size() ) || ( ! m_vecs[ auxid ] ) ) {
412 
413  if( m_store ) {
414  void* result = m_store->getData( auxid, size, capacity );
415  if( result ) {
416  m_auxids.insert( auxid );
418  auxid_t linked_id = r.linkedVariable( auxid );
419  if (linked_id != SG::null_auxid) {
420  m_auxids.insert( linked_id );
421  }
422  }
423  return result;
424  } else {
425  std::cout << "ERROR xAOD::AuxInfoBase::getData "
426  << "Unknown variable ("
428  << ") requested" << std::endl;
429  return nullptr;
430  }
431  }
432  m_vecs[ auxid ]->reserve( capacity );
433  if (m_vecs[ auxid ]->size() < size) {
434  m_vecs[ auxid ]->resize( size );
435  }
436 
437  return m_vecs[ auxid ]->toPtr();
438  }

◆ getData() [3/3]

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

Pick up the const version from the base class.

◆ getDecoration()

void * xAOD::AuxInfoBase::getDecoration ( auxid_t  auxid,
size_t  size,
size_t  capacity 
)
overridevirtualinherited

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

Implements SG::IConstAuxStore.

Reimplemented in xAOD::EventAuxInfo_v1, xAOD::EventAuxInfo_v2, and xAOD::EventAuxInfo_v3.

Definition at line 246 of file AuxInfoBase.cxx.

247  {
248  {
249  // Guard against multi-threaded execution:
250  guard_t guard( m_mutex );
251 
252  // Check if we have it as a static variable:
253  if( ( auxid >= m_vecs.size() ) || ( ! m_vecs[ auxid ] ) ) {
254  // If not, but we have a dynamic store, push it in there:
255  if( m_store ) {
256  void* result = m_store->getDecoration( auxid, size, capacity );
257  if( result ) {
258  m_auxids.insert( auxid );
260  auxid_t linked_id = r.linkedVariable( auxid );
261  if (linked_id != SG::null_auxid) {
262  m_auxids.insert( linked_id );
263  }
264  }
265  return result;
266  }
267  // If we don't have a dynamic store, complain:
268  else {
269  std::cout << "ERROR xAOD::AuxInfoBase::getDecoration "
270  << "Can't provide variable "
272  << std::endl;
273  return nullptr;
274  }
275  }
276 
277  // If the container is locked, static variables can't be accessed this
278  // way:
279  if( m_locked ) {
280  throw SG::ExcStoreLocked( auxid );
281  }
282  }
283 
284  // If the container is not locked, then fall back on the normal accessor
285  // function:
286  return getData( auxid, size, capacity );
287  }

◆ getDynamicAuxIDs()

const AuxInfoBase::auxid_set_t & xAOD::AuxInfoBase::getDynamicAuxIDs ( ) const
overridevirtualinherited

Get the types(names) of variables created dynamically.

Implements SG::IAuxStoreIO.

Definition at line 617 of file AuxInfoBase.cxx.

617  {
618 
619  // Guard against multi-threaded execution:
620  guard_t guard( m_mutex );
621 
622  // All the variables handled by the internal store are dynamic
623  // if such a store exists:
624  if( m_storeIO ) {
625  // I mean, all the variables. Not just the ones reported as dynamic
626  // by the internal object. Because the internal object may be something
627  // that was put into this one in order to achieve data slimming.
628  return m_store->getAuxIDs();
629  }
630 
631  // In case we don't use an internal store, there are no dynamic
632  // variables:
633  static const auxid_set_t dummy (0);
634  return dummy;
635  }

◆ getIOData()

const void * xAOD::AuxInfoBase::getIOData ( auxid_t  auxid) const
overridevirtualinherited

Get a pointer to the data being stored for one aux data item.

Implements SG::IAuxStoreIO.

Definition at line 566 of file AuxInfoBase.cxx.

566  {
567 
568  // Guard against multi-threaded execution:
569  guard_t guard( m_mutex );
570 
571  if( ( auxid >= m_vecs.size() ) || ( ! m_vecs[ auxid ] ) ) {
572  if( m_storeIO ) {
573  return m_storeIO->getIOData( auxid );
574  } else {
575  std::cout << "ERROR xAOD::AuxInfoBase::getIOData "
576  << "Unknown variable ("
578  << ") requested" << std::endl;
579  return nullptr;
580  }
581  }
582 
583  // Update the statistics for this variable. The dynamic store registers
584  // its own variable accesses.
586 
587  if( m_vecs[ auxid ]->isLinked() )
588  return m_vecs[ auxid ]->toVector();
589  else
590  return m_vecs[ auxid ]->toPtr();
591  }

◆ getIOType()

const std::type_info * xAOD::AuxInfoBase::getIOType ( auxid_t  auxid) const
overridevirtualinherited

Return the type of the data to be stored for one aux data item.

Implements SG::IAuxStoreIO.

Definition at line 593 of file AuxInfoBase.cxx.

593  {
594 
595  // Guard against multi-threaded execution:
596  guard_t guard( m_mutex );
597 
598  if( ( auxid >= m_vecs.size() ) || ( ! m_vecs[ auxid ] ) ) {
599  if( m_storeIO ) {
600  return m_storeIO->getIOType( auxid );
601  } else {
602  std::cout << "ERROR xAOD::AuxInfoBase::getIOType "
603  << "Unknown variable ("
605  << ") requested" << std::endl;
606  return nullptr;
607  }
608  }
609 
610  if( m_vecs[ auxid ]->isLinked() )
611  return SG::AuxTypeRegistry::instance().getType( auxid );
612  else
613  return SG::AuxTypeRegistry::instance().getVecType( auxid );
614  }

◆ getSelectedAuxIDs()

AuxInfoBase::auxid_set_t xAOD::AuxInfoBase::getSelectedAuxIDs ( ) const
overridevirtualinherited

Get the IDs of the selected dynamic Aux variables (for writing)

Reimplemented from SG::IAuxStoreIO.

Definition at line 638 of file AuxInfoBase.cxx.

638  {
639 
640  // Guard against multi-threaded execution:
641  guard_t guard( m_mutex );
642 
643  // All the variables handled by the internal store are dynamic
644  // if such a store exists:
645  if( m_storeIO ) {
646  // I mean, all the variables. Not just the ones reported as dynamic
647  // by the internal object. Because the internal object may be something
648  // that was put into this one in order to achieve data slimming.
649  return m_store->getAuxIDs();
650  }
651 
652  // In case we don't use an internal store, there are no dynamic
653  // variables:
654  return auxid_set_t();
655  }

◆ getStore() [1/2]

const SG::IAuxStore * xAOD::AuxInfoBase::getStore ( ) const
overridevirtualinherited

Get the currently used internal store object.

Implements SG::IAuxStoreHolder.

Definition at line 146 of file AuxInfoBase.cxx.

147  {
148  return m_store;
149  }

◆ getStore() [2/2]

SG::IAuxStore * xAOD::AuxInfoBase::getStore ( )
overridevirtualinherited

Get the currently used internal store object.

Implements SG::IAuxStoreHolder.

Definition at line 140 of file AuxInfoBase.cxx.

141  {
142  return m_store;
143  }

◆ getStoreType()

virtual AuxStoreType xAOD::AuxInfoBase::getStoreType ( ) const
inlineoverridevirtualinherited

Return the type of the store object.

Implements SG::IAuxStoreHolder.

Definition at line 79 of file AuxInfoBase.h.

79 { return AST_ObjectStore; }

◆ getWritableAuxIDs()

const AuxInfoBase::auxid_set_t & xAOD::AuxInfoBase::getWritableAuxIDs ( ) const
overridevirtualinherited

Return a set of writable data identifiers.

Implements SG::IAuxStore.

Definition at line 441 of file AuxInfoBase.cxx.

441  {
442 
443  // Return the full list of known IDs. The constness of this object's
444  // members comes from the object being const or not.
445  return m_auxids;
446  }

◆ insertMove() [1/2]

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

Insert contents of another store via move.

Definition at line 530 of file AuxInfoBase.cxx.

531  {
532 
533  // Guard against multi-threaded execution:
534  guard_t guard( m_mutex );
535 
536  // Check if the container is locked:
537  if( m_locked ) {
538  throw SG::ExcStoreLocked( "insertMove" );
539  }
540 
541  // We are just not allowed to do this...
542  throw std::runtime_error( "Calling insertMove on a non-vector" );
543 
544  return false;
545  }

◆ 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::AuxInfoBase::isDecoration ( auxid_t  auxid) const
overridevirtualinherited

Test if a variable is a decoration.

Implements SG::IConstAuxStore.

Reimplemented in xAOD::EventAuxInfo_v1, xAOD::EventAuxInfo_v2, and xAOD::EventAuxInfo_v3.

Definition at line 230 of file AuxInfoBase.cxx.

231  {
232  guard_t guard( m_mutex );
233  if (m_store) {
234  return m_store->isDecoration (auxid);
235  }
236  return false;
237  }

◆ linkedVector() [1/3]

const SG::IAuxTypeVector * xAOD::AuxInfoBase::linkedVector ( SG::auxid_t  auxid) const
overridevirtualinherited

Return interface for a linked variable.

Reimplemented from SG::IConstAuxStore.

Definition at line 340 of file AuxInfoBase.cxx.

341  {
343  auxid_t linked_id = r.linkedVariable( auxid );
344  if (linked_id != SG::null_auxid) {
345  guard_t guard( m_mutex );
346  if (linked_id < m_vecs.size() && m_vecs[ linked_id ]) {
347  return m_vecs[ linked_id ];
348  }
349  if (m_store) {
350  return CxxUtils::as_const_ptr(m_store)->linkedVector( auxid );
351  }
352  }
353  return nullptr;
354  }

◆ linkedVector() [2/3]

SG::IAuxTypeVector * xAOD::AuxInfoBase::linkedVector ( SG::auxid_t  auxid)
overridevirtualinherited

Return interface for a linked variable.

Reimplemented from SG::IAuxStore.

Definition at line 357 of file AuxInfoBase.cxx.

358  {
360  auxid_t linked_id = r.linkedVariable( auxid );
361  if (linked_id != SG::null_auxid) {
362  guard_t guard( m_mutex );
363  if (linked_id < m_vecs.size() && m_vecs[ linked_id ]) {
364  return m_vecs[ linked_id ];
365  }
366  if (m_store) {
367  return m_store->linkedVector( auxid );
368  }
369  }
370  return nullptr;
371  }

◆ linkedVector() [3/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 174 of file IConstAuxStore.h.

175  { return nullptr; }

◆ lock()

void xAOD::AuxInfoBase::lock ( )
overridevirtualinherited

Lock the container.

Implements ILockable.

Definition at line 289 of file AuxInfoBase.cxx.

289  {
290 
291  // Guard against multi-threaded execution:
292  guard_t guard( m_mutex );
293 
294  // Lock the container and the dynamic store:
295  m_locked = true;
296  if( m_store ) {
297  m_store->lock();
298  }
299 
300  return;
301  }

◆ lockDecoration()

void xAOD::AuxInfoBase::lockDecoration ( SG::auxid_t  auxid)
overridevirtualinherited

Lock a decoration.

Implements SG::IConstAuxStore.

Reimplemented in xAOD::EventAuxInfo_v1, xAOD::EventAuxInfo_v2, and xAOD::EventAuxInfo_v3.

Definition at line 332 of file AuxInfoBase.cxx.

333  {
334  guard_t guard (m_mutex);
335  if (m_store) {
336  m_store->lockDecoration (auxid);
337  }
338  }

◆ name()

const char * xAOD::AuxInfoBase::name ( ) const
inherited

Get the name of the container instance.

Definition at line 660 of file AuxInfoBase.cxx.

660  {
661 
662  return m_name.c_str();
663  }

◆ regAuxVar()

template<typename T >
void xAOD::AuxInfoBase::regAuxVar ( auxid_t  auxid,
const std::string &  name,
T &  info 
)
inherited

Register one of the persistent variables internally.

◆ reserve()

void xAOD::AuxInfoBase::reserve ( size_t  size)
overridevirtualinherited

Reserve a given size for the arrays.

Implements SG::IAuxStore.

Definition at line 482 of file AuxInfoBase.cxx.

482  {
483 
484  // Guard against multi-threaded execution:
485  guard_t guard( m_mutex );
486 
487  // Check if the container is locked:
488  if( m_locked ) {
489  throw SG::ExcStoreLocked( "reserve" );
490  }
491 
492  // Do a test already here:
493  if( size != 1 ) {
494  throw std::runtime_error( "Calling reserve with != 1 on a "
495  "non-vector" );
496  }
497 
498  // Do the operation on the static variables:
499  for (SG::IAuxTypeVector* v : m_vecs) {
500  if(v && !v->isLinked()) {
501  v->reserve( size );
502  }
503  }
504 
505  // Do the operation on the dynamic variables:
506  if( m_store ) {
507  m_store->reserve( size );
508  }
509 
510  return;
511  }

◆ resize()

bool xAOD::AuxInfoBase::resize ( size_t  size)
overridevirtualinherited

Resize the arrays to a given size.

Implements SG::IAuxStore.

Definition at line 448 of file AuxInfoBase.cxx.

448  {
449 
450  // Guard against multi-threaded execution:
451  guard_t guard( m_mutex );
452 
453  // Check if the container is locked:
454  if( m_locked ) {
455  throw SG::ExcStoreLocked( "resize" );
456  }
457 
458  // Do a test already here:
459  if( size != 1 ) {
460  throw std::runtime_error( "Calling resize with != 1 on a "
461  "non-vector" );
462  }
463 
464  // Do the operation on the static variables:
465  bool nomoves = true;
466  for (SG::IAuxTypeVector* v : m_vecs) {
467  if(v && !v->isLinked()) {
468  if (!v->resize( size ))
469  nomoves = false;
470  }
471  }
472 
473  // Do the operation on the dynamic variables:
474  if( m_store ) {
475  if (!m_store->resize( size ))
476  nomoves = false;
477  }
478 
479  return nomoves;
480  }

◆ setName()

void xAOD::AuxInfoBase::setName ( const char name)
inherited

Set the name of the container instance.

Definition at line 665 of file AuxInfoBase.cxx.

665  {
666 
667  m_name = name;
668  return;
669  }

◆ setOption()

bool xAOD::AuxInfoBase::setOption ( auxid_t  id,
const SG::AuxDataOption option 
)
overridevirtualinherited

Make an option setting on an aux variable.

Reimplemented from SG::IAuxStore.

Definition at line 548 of file AuxInfoBase.cxx.

548  {
549 
550  if (id < m_vecs.size() && m_vecs[id] != nullptr)
551  return m_vecs[id]->setOption( option );
552  if (m_store)
553  return m_store->setOption( id, option );
554  return false;
555  }

◆ setStore()

void xAOD::AuxInfoBase::setStore ( SG::IAuxStore store)
overridevirtualinherited

Set a different internal store object.

This function is used by the I/O infrastructure to possibly put a store object into this one, which can interact with dynamic variables directly.

Note that the object takes ownership of the received store.

Parameters
storeThe store that should be used for dynamic variable handling inside the object from now on

Implements SG::IAuxStoreHolder.

Definition at line 160 of file AuxInfoBase.cxx.

160  {
161 
162  // Guard against multi-threaded execution:
163  guard_t guard( m_mutex );
164 
165  // Check that no funny business is going on:
166  if( m_store == store ) return;
167 
168  // Clean up the current store object:
169  if( m_store && m_ownsStore ) {
170  m_auxids -= m_store->getAuxIDs();
171  delete m_store;
172  }
173  m_store = nullptr;
174  m_storeIO = nullptr;
175 
176  // Take posession of the new object:
177  m_store = store;
178  m_storeIO = dynamic_cast< SG::IAuxStoreIO* >( m_store );
179  m_ownsStore = true;
180  if( m_store ) {
182  }
183 
184  return;
185  }

◆ shift()

void xAOD::AuxInfoBase::shift ( size_t  pos,
ptrdiff_t  offs 
)
overridevirtualinherited

Shift the contents of the stored arrays.

Implements SG::IAuxStore.

Definition at line 513 of file AuxInfoBase.cxx.

513  {
514 
515  // Guard against multi-threaded execution:
516  guard_t guard( m_mutex );
517 
518  // Check if the container is locked:
519  if( m_locked ) {
520  throw SG::ExcStoreLocked( "shift" );
521  }
522 
523  // We are just not allowed to do this...
524  throw std::runtime_error( "Calling shift on a non-vector" );
525 
526  return;
527  }

◆ size()

size_t xAOD::AuxInfoBase::size ( ) const
overridevirtualinherited

Get the size of the container.

Implements SG::IConstAuxStore.

Definition at line 374 of file AuxInfoBase.cxx.

374  {
375 
376  // Should really always be 1, but do the general thing anyway...
377 
378  // Guard against multi-threaded execution:
379  guard_t guard( m_mutex );
380 
381  // Try to find a variable:
382  for (SG::auxid_t i : m_auxids) {
383  if( ( i < m_vecs.size() ) && m_vecs[ i ] && !m_vecs[ i ]->isLinked()) {
384  size_t sz = m_vecs[ i ]->size();
385  if( sz > 0 ) {
386  return sz;
387  }
388  }
389  }
390 
391  // If we didn't find any statically defined variables, then we just
392  // need to claim 1. Because pool::AuxStoreAPR at the moment always
393  // returns 0 for the size.
394  return 1;
395  }

Member Data Documentation

◆ m_auxids

auxid_set_t xAOD::AuxInfoBase::m_auxids
privateinherited

Internal list of all available variables.

Definition at line 191 of file AuxInfoBase.h.

◆ m_locked

bool xAOD::AuxInfoBase::m_locked
privateinherited

Has the container been locked?

Definition at line 202 of file AuxInfoBase.h.

◆ m_mutex

mutex_t xAOD::AuxInfoBase::m_mutex
mutableprivateinherited

Definition at line 207 of file AuxInfoBase.h.

◆ m_name

std::string xAOD::AuxInfoBase::m_name
privateinherited

Name of the container in memory. Set externally.

Definition at line 210 of file AuxInfoBase.h.

◆ m_ownsStore

bool xAOD::AuxInfoBase::m_ownsStore
privateinherited

Flag deciding if the object owns the dynamic store or not.

Definition at line 200 of file AuxInfoBase.h.

◆ m_store

SG::IAuxStore* xAOD::AuxInfoBase::m_store
privateinherited

Internal dynamic auxiliary store object.

Definition at line 196 of file AuxInfoBase.h.

◆ m_storeIO

SG::IAuxStoreIO* xAOD::AuxInfoBase::m_storeIO
privateinherited

The IO interface to the internal auxiliary store.

Definition at line 198 of file AuxInfoBase.h.

◆ m_vecs

std::vector< SG::IAuxTypeVector* > xAOD::AuxInfoBase::m_vecs
privateinherited

Internal list of all managed variables.

Definition at line 193 of file AuxInfoBase.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::AuxInfoBase
Common base class for auxiliary info objects.
Definition: AuxInfoBase.h:49
beamspotman.r
def r
Definition: beamspotman.py:676
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:69
SG::IConstAuxStore::lockDecoration
virtual void lockDecoration(SG::auxid_t auxid)=0
Lock a decoration.
fitman.sz
sz
Definition: fitman.py:527
get_generator_info.result
result
Definition: get_generator_info.py:21
xAOD::AuxInfoBase::auxid_t
SG::auxid_t auxid_t
The aux ID type definition.
Definition: AuxInfoBase.h:53
xAOD::IOStats::stats
ReadStats & stats()
Access the object belonging to the current thread.
Definition: IOStats.cxx:17
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:49
SG::AuxTypeRegistry::getName
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
Definition: AuxTypeRegistry.cxx:277
xAOD::AuxInfoBase::m_vecs
std::vector< SG::IAuxTypeVector * > m_vecs
Internal list of all managed variables.
Definition: AuxInfoBase.h:193
SG::ExcStoreLocked
Exception — Attempted to modify auxiliary data in a locked store.
Definition: Control/AthContainers/AthContainers/exceptions.h:183
xAOD::AuxInfoBase::size
virtual size_t size() const override
Get the size of the container.
Definition: AuxInfoBase.cxx:374
xAOD::AuxInfoBase::getWritableAuxIDs
virtual const auxid_set_t & getWritableAuxIDs() const override
Return a set of writable data identifiers.
Definition: AuxInfoBase.cxx:441
xAOD::AuxInfoBase::m_ownsStore
bool m_ownsStore
Flag deciding if the object owns the dynamic store or not.
Definition: AuxInfoBase.h:200
xAOD::AuxInfoBase::name
const char * name() const
Get the name of the container instance.
Definition: AuxInfoBase.cxx:660
SG::IAuxStoreIO::getIOType
virtual const std::type_info * getIOType(SG::auxid_t auxid) const =0
Return the type of the data to be stored for one aux data item.
SG::IAuxStore::linkedVector
virtual IAuxTypeVector * linkedVector(SG::auxid_t)
Definition: IAuxStore.h:187
SG::IAuxStoreIO
Interface providing I/O for a generic auxiliary store.
Definition: IAuxStoreIO.h:44
xAOD::AuxInfoBase::getData
virtual const void * getData(auxid_t auxid) const override
Get a pointer to a given array.
Definition: AuxInfoBase.cxx:195
SG::AuxTypeRegistry
Handle mappings between names and auxid_t.
Definition: AuxTypeRegistry.h:62
SG::IAuxStore::setOption
virtual bool setOption(auxid_t, const AuxDataOption &)
Set an option for a given auxiliary variable.
Definition: IAuxStore.h:173
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:302
SG::IConstAuxStore::clearDecorations
virtual bool clearDecorations()=0
Clear all decorations.
xAOD::AuxInfoBase::m_store
SG::IAuxStore * m_store
Internal dynamic auxiliary store object.
Definition: AuxInfoBase.h:196
lumiFormat.i
int i
Definition: lumiFormat.py:92
CxxUtils::ConcurrentBitset::insert
ConcurrentBitset & insert(bit_t bit, bit_t new_nbits=0)
Set a bit to 1.
xAOD::AuxInfoBase::m_name
std::string m_name
Name of the container in memory. Set externally.
Definition: AuxInfoBase.h:210
python.xAODType.dummy
dummy
Definition: xAODType.py:4
SG::IConstAuxStore::getDecoration
virtual void * getDecoration(auxid_t auxid, size_t size, size_t capacity)=0
Return the data vector for one aux data decoration item.
SG::AuxTypeRegistry::getVecType
const std::type_info * getVecType(SG::auxid_t auxid) const
Return the type of the STL vector used to hold an aux data item.
Definition: AuxTypeRegistry.cxx:328
xAOD::IOStats::instance
static IOStats & instance()
Singleton object accessor.
Definition: IOStats.cxx:11
xAOD::AuxInfoBase::auxid_set_t
SG::auxid_set_t auxid_set_t
The aux ID set type definition.
Definition: AuxInfoBase.h:55
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
CxxUtils::as_const_ptr
const T * as_const_ptr(const T *p)
Helper for getting a const version of a pointer.
Definition: as_const_ptr.h:32
xAOD::AuxInfoBase::guard_t
AthContainers_detail::lock_guard< mutex_t > guard_t
Definition: AuxInfoBase.h:206
SG::IAuxStoreIO::getIOData
virtual const void * getIOData(SG::auxid_t auxid) const =0
Return a pointer to the data to be stored for one aux data item.
xAOD::ReadStats::readBranch
void readBranch(const std::string &prefix, SG::auxid_t auxid)
Function incrementing the read counter on a specific branch.
python.PyAthena.v
v
Definition: PyAthena.py:157
SG::IAuxStore::getData
virtual void * getData(auxid_t auxid, size_t size, size_t capacity)=0
Return the data vector for one aux data item.
xAOD::AuxInfoBase::m_storeIO
SG::IAuxStoreIO * m_storeIO
The IO interface to the internal auxiliary store.
Definition: AuxInfoBase.h:198
SG::IAuxTypeVector
Abstract interface for manipulating vectors of arbitrary types.
Definition: IAuxTypeVector.h:40
SG::IConstAuxStore::lock
virtual void lock()=0
Lock the container.
SG::IAuxStore::resize
virtual bool resize(size_t sz)=0
Change the size of all aux data vectors.
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
SG::IConstAuxStore::isDecoration
virtual bool isDecoration(auxid_t auxid) const =0
Test if a particular variable is tagged as a decoration.
SG::IAuxStoreHolder::AST_ObjectStore
@ AST_ObjectStore
The store describes a single object.
Definition: IAuxStoreHolder.h:67
xAOD::AuxInfoBase::m_auxids
auxid_set_t m_auxids
Internal list of all available variables.
Definition: AuxInfoBase.h:191
SG::IConstAuxStore::getAuxIDs
virtual const SG::auxid_set_t & getAuxIDs() const =0
Return a set of identifiers for existing data items in this store.
xAOD::AuxInfoBase::m_locked
bool m_locked
Has the container been locked?
Definition: AuxInfoBase.h:202
xAOD::AuxInfoBase::m_mutex
mutex_t m_mutex
Definition: AuxInfoBase.h:207
SG::IAuxStore::reserve
virtual void reserve(size_t sz)=0
Change the capacity of all aux data vectors.
SG::IAuxStoreHolder::AST_ContainerStore
@ AST_ContainerStore
The store describes a container.
Definition: IAuxStoreHolder.h:68