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

Class creating a shallow copy of an existing auxiliary container. More...

#include <ShallowAuxContainer.h>

Inheritance diagram for xAOD::ShallowAuxContainer:
Collaboration diagram for xAOD::ShallowAuxContainer:

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...
 
enum  AuxStoreType { AST_ObjectStore = 0, AST_ContainerStore = 1 }
 Type of the auxiliary store. More...
 

Public Member Functions

 ShallowAuxContainer (bool standalone=false)
 Default constructor. More...
 
 ShallowAuxContainer (const ShallowAuxContainer &parent)
 Copy constructor. More...
 
 ShallowAuxContainer (const DataLink< SG::IConstAuxStore > &parent, bool standalone=false)
 Constructor with a parent object. More...
 
 ~ShallowAuxContainer ()
 Destructor. More...
 
ShallowAuxContaineroperator= (const ShallowAuxContainer &rhs)
 Assignment operator. More...
 
const DataLink< SG::IConstAuxStore > & parent () const
 Get the parent store. More...
 
void setParent (const DataLink< SG::IConstAuxStore > &link)
 Set the parent store. More...
 
bool shallowIO () const
 Check whether only the overriden parameters will be written out or not. More...
 
void setShallowIO (bool value)
 Set whether only the overriden parameters should be written out. 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...
 

Static Public Attributes

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

Private Types

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

Private Member Functions

void remakeAuxIDs () const
 

Private Attributes

AuxSelection m_selection
 Dynamic attributes selection implementation. 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
 Flag keeping track of whether this object is locked or not. More...
 
DataLink< SG::IConstAuxStorem_parentLink
 Link to the parent object. More...
 
const SG::IAuxStoreIOm_parentIO
 Optional pointer to the IO interface of the parent object. More...
 
bool m_shallowIO
 Flag for whether to do "shallow IO" or not. More...
 
mutex_t m_mutex
 
auxid_set_t m_auxids ATLAS_THREAD_SAFE
 
bool m_auxidsValid ATLAS_THREAD_SAFE
 
std::string m_name
 Name of the container in memory. Set externally. More...
 

Functions implementing the SG::IAuxStoreHolder interface

virtual SG::IAuxStoregetStore () override
 Get the currently used internal store object. More...
 
virtual const SG::IAuxStoregetStore () const override
 
virtual void setStore (SG::IAuxStore *store) override
 Set a different internal store object. More...
 
virtual AuxStoreType getStoreType () const override
 Return the type of the store object. More...
 

Detailed Description

Class creating a shallow copy of an existing auxiliary container.

During analysis, in order to create objects that override just some of the properties of an original, it's wasteful to make full copies of the objects. Not to mention that the full copies have generally issues with dynamic variables.

The behaviour of this class is that it takes all the properties that it doesn't know about from the parent auxiliary store, but the ones that it has an override for, it provides itself.

The object is persistifiable. The user can choose whether to only write out the variables that were modified wrt. the original container, or possibly all the variables. (In case the original container is not getting written out.)

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
Revision
793737
Date
2017-01-24 21:11:10 +0100 (Tue, 24 Jan 2017)

Definition at line 48 of file ShallowAuxContainer.h.

Member Typedef Documentation

◆ auxid_set_t

The aux ID set type definition.

Definition at line 60 of file ShallowAuxContainer.h.

◆ auxid_t

The aux ID type definition.

Definition at line 58 of file ShallowAuxContainer.h.

◆ guard_t

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

Definition at line 196 of file ShallowAuxContainer.h.

◆ mutex_t

typedef AthContainers_detail::recursive_mutex xAOD::ShallowAuxContainer::mutex_t
private

Mutex for multithread synchronization.

Definition at line 195 of file ShallowAuxContainer.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

◆ ShallowAuxContainer() [1/3]

xAOD::ShallowAuxContainer::ShallowAuxContainer ( bool  standalone = false)

Default constructor.

Parameters
standalonetrue if the store will be used for a standalone object, false for a container

Definition at line 31 of file ShallowAuxContainer.cxx.

32  : m_selection(),
33  m_store( new SG::AuxStoreInternal( standalone ) ),
34  m_storeIO( nullptr ), m_ownsStore( true ), m_locked( false ),
35  m_parentLink(), m_parentIO( nullptr ), m_shallowIO( true ),
36  m_auxids (),
37  m_auxidsValid (false),
38  m_name( "UNKNOWN" ) {
39 
40  m_storeIO = dynamic_cast< SG::IAuxStoreIO* >( m_store );
41  }

◆ ShallowAuxContainer() [2/3]

xAOD::ShallowAuxContainer::ShallowAuxContainer ( const ShallowAuxContainer parent)

Copy constructor.

Definition at line 43 of file ShallowAuxContainer.cxx.

45  m_store( parent.m_store ), m_storeIO( parent.m_storeIO ),
46  m_ownsStore( false ), m_locked( parent.m_locked ),
47  m_parentLink( parent.m_parentLink ),
48  m_parentIO( parent.m_parentIO ), m_shallowIO( parent.m_shallowIO ),
49  m_auxids (),
50  m_auxidsValid (false)
51  {
52  // Keep the source unmutable during copy
53  guard_t guard( parent.m_mutex );
54  m_selection = parent.m_selection;
55  m_name = parent.m_name;
56  }

◆ ShallowAuxContainer() [3/3]

xAOD::ShallowAuxContainer::ShallowAuxContainer ( const DataLink< SG::IConstAuxStore > &  parent,
bool  standalone = false 
)

Constructor with a parent object.

Parameters
parentThe parent object to make a shallow copy of
standalonetrue if the store will be used for a standalone object, false for a container

Definition at line 62 of file ShallowAuxContainer.cxx.

65  : m_selection(),
66  m_store( new SG::AuxStoreInternal( standalone ) ),
67  m_storeIO( nullptr ), m_ownsStore( true ), m_locked( false ),
68  m_parentLink( parent ), m_parentIO( nullptr ), m_shallowIO( true ),
69  m_auxids (),
70  m_auxidsValid (false),
71  m_name( "UNKNOWN" ) {
72 
73  m_storeIO = dynamic_cast< SG::IAuxStoreIO* >( m_store );
74  m_parentIO = dynamic_cast< const SG::IAuxStoreIO* >( m_parentLink.cptr() );
75  }

◆ ~ShallowAuxContainer()

xAOD::ShallowAuxContainer::~ShallowAuxContainer ( )

Destructor.

Definition at line 77 of file ShallowAuxContainer.cxx.

77  {
78 
79  if( m_ownsStore && m_store ) {
80  delete m_store;
81  }
82  }

Member Function Documentation

◆ clearDecorations()

bool xAOD::ShallowAuxContainer::clearDecorations ( )
overridevirtual

Clear all decorations.

Implements SG::IConstAuxStore.

Definition at line 354 of file ShallowAuxContainer.cxx.

355  {
356  guard_t guard (m_mutex);
357  bool ret = m_store->clearDecorations();
358  if (ret) {
359  remakeAuxIDs();
360  }
361  return ret;
362  }

◆ getAuxIDs()

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

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

Implements SG::IConstAuxStore.

Definition at line 218 of file ShallowAuxContainer.cxx.

218  {
219 
220  guard_t guard( m_mutex );
221  if (!m_auxidsValid) {
222  remakeAuxIDs();
223  }
224  return m_auxids;
225  }

◆ getData() [1/3]

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

Get a pointer to a given array.

Implements SG::IConstAuxStore.

Definition at line 187 of file ShallowAuxContainer.cxx.

187  {
188 
189  guard_t guard( m_mutex );
190 
191  // Check if we have this variable ourselves. I use getData(...)
192  // instead of getAuxIDs(), as a dynamic store may not have connected
193  // to all the variables yet that it has available...
194  size_t nids = m_store->getAuxIDs().size();
195  const void* result = m_store->getData( auxid );
196  if( result ) {
197  if( nids != m_store->getAuxIDs().size() ) {
198  remakeAuxIDs();
199  }
200  return result;
201  }
202 
203  // If not, then leave it up to the parent object do deal with this:
204  if( m_parentLink.isValid() ) {
205  nids = m_parentLink->getAuxIDs().size();
206  result = m_parentLink->getData( auxid );
207  if( result && ( nids != m_parentLink->getAuxIDs().size() ) ) {
208  remakeAuxIDs();
209  }
210  return result;
211  }
212 
213  // Apparently the variable wasn't found:
214  return nullptr;
215  }

◆ getData() [2/3]

void * xAOD::ShallowAuxContainer::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 373 of file ShallowAuxContainer.cxx.

374  {
375 
376  guard_t guard (m_mutex);
377 
378  // Check if we already have this variable by any chance.
379  const void* cptr = m_store->getData( auxid );
380 
381  // Create the variable in the dynamic store:
382  void* ptr = m_store->getData( auxid, size, capacity );
383 
384  remakeAuxIDs();
385 
386  // If in some weird way we already had this variable before, then don't
387  // try to overwrite it with the parent's payload, and finish here already.
388  if( cptr != nullptr ) {
389  return ptr;
390  }
391 
392  // If the parent doesn't have this variable, then we're done already:
393  if( ! m_parentLink.isValid() ) {
394  return ptr;
395  }
396  const void* pptr = m_parentLink->getData( auxid );
397  if( ! pptr ) {
398  return ptr;
399  }
400 
401  // If the variable does exist in the parent, then copy it over to this
402  // store before returning.
403 
404  // Get the registry:
406 
407  // Get the type of this variable:
408  const std::type_info* type = reg.getType( auxid );
409  if( type == nullptr ) {
410  std::ostringstream message;
411  message << "Couldn't find the type of auxiliary ID " << auxid;
412  throw std::runtime_error( message.str() );
413  }
414 
415  // And the allocator type for this variable.
416  const std::type_info* allocType = reg.getAllocType( auxid );
417  if( allocType == nullptr ) {
418  std::ostringstream message;
419  message << "Couldn't find the allocator type of auxiliary ID " << auxid;
420  throw std::runtime_error( message.str() );
421  }
422 
423  // First let's get the vector factory of this variable:
424  const SG::IAuxTypeVectorFactory* factory =
426  if( factory == nullptr ) {
427  std::ostringstream message;
428  message << "Couldn't find a factory for type " << type->name();
429  throw std::runtime_error( message.str() );
430  }
431 
432  // Copy each element of the parent's decoration:
433  factory->copy( auxid,
434  SG::AuxVectorInterface( *this ), 0,
436 
437  // Now we're done:
438  return ptr;
439  }

◆ getData() [3/3]

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

Pick up the const version from the base class.

◆ getDecoration()

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

Return the data vector for one aux data decoration item.

Implements SG::IConstAuxStore.

Definition at line 239 of file ShallowAuxContainer.cxx.

241  {
242 
243  guard_t guard( m_mutex );
244 
245  // Check if we already have this variable by any chance.
246  const void* cptr = m_store->getData( auxid );
247 
248  // If the parent has such a variable, then we need to check one more
249  // thing. If it's a decoration on the parent, then we should be allowed
250  // to override it in this (possibly locked) shallow copy. But let's leave
251  // the logic of this up to the parent.
252  if( m_locked && m_parentLink.isValid() &&
253  ( m_parentLink->getAuxIDs().count( auxid ) > 0 ) )
254  {
255  if (!m_parentLink->isDecoration (auxid)) {
256  throw SG::ExcStoreLocked (auxid);
257  }
258  }
259 
260  // If we got this far without any exception, then let the internal store
261  // try to provide the decoration for us:
262  const size_t nids = m_store->getAuxIDs().size();
263  void* result = m_store->getDecoration( auxid, size, capacity );
264  if( result && ( nids != m_store->getAuxIDs().size() ) ) {
265  remakeAuxIDs();
266  }
267 
268  // If we already had this variable before, then don't try to overwrite it
269  // with the parent's payload, and finish here already.
270  if( cptr != nullptr ) {
271  return result;
272  }
273 
274  // If the parent doesn't have this variable, then we're done.
275  if( ! m_parentLink.isValid() ) {
276  return result;
277  }
278  const void* pptr = m_parentLink->getData( auxid );
279  if( pptr == nullptr ) {
280  return result;
281  }
282 
283  // If the variable does exist in the parent, then copy it over to this
284  // store before returning.
285 
286  // Get the registry.
288 
289  // Get the type of this variable.
290  const std::type_info* type = reg.getType( auxid );
291  if( type == nullptr ) {
292  std::ostringstream message;
293  message << "Couldn't find the type of auxiliary ID " << auxid;
294  throw std::runtime_error( message.str() );
295  }
296 
297  // And the allocator type for this variable.
298  const std::type_info* allocType = reg.getAllocType( auxid );
299  if( allocType == nullptr ) {
300  std::ostringstream message;
301  message << "Couldn't find the allocator type of auxiliary ID " << auxid;
302  throw std::runtime_error( message.str() );
303  }
304 
305  // Get the vector factory of this variable.
306  const SG::IAuxTypeVectorFactory* factory =
308  if( factory == nullptr ) {
309  std::ostringstream message;
310  message << "Couldn't find a factory for type " << type->name();
311  throw std::runtime_error( message.str() );
312  }
313 
314  // Copy each element of the parent's decoration.
315  factory->copy( auxid,
316  SG::AuxVectorInterface( *this ), 0,
318 
319  // Now we're done.
320  return result;
321  }

◆ getDynamicAuxIDs()

const ShallowAuxContainer::auxid_set_t & xAOD::ShallowAuxContainer::getDynamicAuxIDs ( ) const
overridevirtual

Get the types(names) of variables created dynamically.

Implements SG::IAuxStoreIO.

Definition at line 543 of file ShallowAuxContainer.cxx.

543  {
544 
545  if( m_shallowIO ) {
546  if( m_storeIO ) {
547  return m_store->getAuxIDs();
548  } else {
549  static const auxid_set_t dummy (0);
550  return dummy;
551  }
552  } else {
553  return getAuxIDs();
554  }
555  }

◆ getIOData()

const void * xAOD::ShallowAuxContainer::getIOData ( auxid_t  auxid) const
overridevirtual

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

Implements SG::IAuxStoreIO.

Definition at line 490 of file ShallowAuxContainer.cxx.

490  {
491 
492  guard_t guard (m_mutex);
493  // Do we have it?
494  if( m_storeIO && m_store->getAuxIDs().test (auxid)) {
495  return m_storeIO->getIOData( auxid );
496  }
497 
498  // Do we have a parent that has it?
499  const SG::IAuxStoreIO* parentIO = m_parentIO;
500  if( ( parentIO == nullptr ) && m_parentLink.isValid() ) {
501  parentIO =
502  dynamic_cast< const SG::IAuxStoreIO* >( m_parentLink.cptr() );
503  }
504  if( parentIO ) {
505  return parentIO->getIOData( auxid );
506  }
507 
508  // If not, then where did this variable come from?!?
509  std::cerr << "ERROR xAOD::ShallowAuxContainer::getIOData Unknown "
510  << "variable ("
512  << ") requested" << std::endl;
513  return nullptr;
514  }

◆ getIOType()

const std::type_info * xAOD::ShallowAuxContainer::getIOType ( auxid_t  auxid) const
overridevirtual

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

Implements SG::IAuxStoreIO.

Definition at line 516 of file ShallowAuxContainer.cxx.

516  {
517 
518  guard_t guard (m_mutex);
519  // Do we have it?
520  if( m_storeIO && m_store->getAuxIDs().test (auxid)) {
521  return m_storeIO->getIOType( auxid );
522  }
523 
524  // Do we have a parent that has it?
525  const SG::IAuxStoreIO* parentIO = m_parentIO;
526  if( ( parentIO == nullptr ) && m_parentLink.isValid() ) {
527  parentIO =
528  dynamic_cast< const SG::IAuxStoreIO* >( m_parentLink.cptr() );
529  }
530  if( parentIO ) {
531  return parentIO->getIOType( auxid );
532  }
533 
534  // If not, then where did this variable come from?!?
535  std::cerr << "ERROR xAOD::ShallowAuxContainer::getIOType Unknown "
536  << "variable ("
538  << ") requested" << std::endl;
539  return nullptr;
540  }

◆ getSelectedAuxIDs()

ShallowAuxContainer::auxid_set_t xAOD::ShallowAuxContainer::getSelectedAuxIDs ( ) const
overridevirtual

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

Reimplemented from SG::IAuxStoreIO.

Definition at line 558 of file ShallowAuxContainer.cxx.

558  {
559 
560  if( m_shallowIO ) {
561  if( m_storeIO ) {
563  } else {
564  return auxid_set_t();
565  }
566  } else {
568  }
569  }

◆ getStore() [1/2]

const SG::IAuxStore * xAOD::ShallowAuxContainer::getStore ( ) const
overridevirtual

Implements SG::IAuxStoreHolder.

Definition at line 154 of file ShallowAuxContainer.cxx.

155  {
156  return m_store;
157  }

◆ getStore() [2/2]

SG::IAuxStore * xAOD::ShallowAuxContainer::getStore ( )
overridevirtual

Get the currently used internal store object.

Implements SG::IAuxStoreHolder.

Definition at line 149 of file ShallowAuxContainer.cxx.

150  {
151  return m_store;
152  }

◆ getStoreType()

virtual AuxStoreType xAOD::ShallowAuxContainer::getStoreType ( ) const
inlineoverridevirtual

Return the type of the store object.

Implements SG::IAuxStoreHolder.

Reimplemented in xAOD::ShallowAuxInfo.

Definition at line 94 of file ShallowAuxContainer.h.

94 { return AST_ContainerStore; }

◆ getWritableAuxIDs()

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

Return a set of writable data identifiers.

Implements SG::IAuxStore.

Definition at line 442 of file ShallowAuxContainer.cxx.

442  {
443 
444  // Only the variables in the dynamic store are writable. Maybe not
445  // even all of those...
446  return m_store->getWritableAuxIDs();
447  }

◆ insertMove() [1/2]

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

Insert contents of another store via move.

Definition at line 473 of file ShallowAuxContainer.cxx.

475  {
476 
477  // Nope, not allowed...
478  throw std::runtime_error( "Trying to call insertMove on a shallow copy "
479  "container" );
480  }

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

Test if a variable is a decoration.

Implements SG::IConstAuxStore.

Definition at line 227 of file ShallowAuxContainer.cxx.

228  {
229  guard_t guard( m_mutex );
230  if (m_parentLink.isValid()) {
231  if (m_parentLink->isDecoration (auxid)) {
232  return true;
233  }
234  }
235  return m_store->isDecoration (auxid);
236  }

◆ lock()

void xAOD::ShallowAuxContainer::lock ( )
overridevirtual

Lock the container.

Implements ILockable.

Definition at line 325 of file ShallowAuxContainer.cxx.

326  {
327  guard_t guard (m_mutex);
328  m_locked = true;
329  m_store->lock();
330  }

◆ lockDecoration()

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

Lock a decoration.

Implements SG::IConstAuxStore.

Definition at line 334 of file ShallowAuxContainer.cxx.

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

◆ name()

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

Get the name of the container instance.

Definition at line 575 of file ShallowAuxContainer.cxx.

575  {
576 
577  return m_name.c_str();
578  }

◆ operator=()

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

Assignment operator.

Definition at line 85 of file ShallowAuxContainer.cxx.

85  {
86 
87  // Check if anything needs to be done:
88  if( this == &rhs ) {
89  return *this;
90  }
91 
92  // Keep the source unmutable during copy
93  std::scoped_lock lck{m_mutex, rhs.m_mutex};
94 
95  // Clean up if necessary:
96  if( m_ownsStore && m_store ) {
97  delete m_store;
98  m_store = nullptr;
99  }
100 
101  m_selection = rhs.m_selection;
102  m_ownsStore = false;
103  m_store = rhs.m_store;
104  m_storeIO = rhs.m_storeIO;
105  m_locked = rhs.m_locked;
106  m_parentLink = rhs.m_parentLink;
107  m_parentIO = rhs.m_parentIO;
108  m_shallowIO = rhs.m_shallowIO;
109  m_name = rhs.m_name;
110  m_auxids = rhs.m_auxids;
111  m_auxidsValid= rhs.m_auxidsValid;
112 
113  // Return this object:
114  return *this;
115  }

◆ parent()

const DataLink< SG::IConstAuxStore > & xAOD::ShallowAuxContainer::parent ( ) const

Get the parent store.

Definition at line 117 of file ShallowAuxContainer.cxx.

117  {
118 
119  return m_parentLink;
120  }

◆ remakeAuxIDs()

void xAOD::ShallowAuxContainer::remakeAuxIDs ( ) const
private

Definition at line 586 of file ShallowAuxContainer.cxx.

586  {
588  if( m_parentLink.isValid() ) {
589  ids.insert (m_parentLink->getAuxIDs());
590  }
591  m_auxids = ids;
592  m_auxidsValid = true;
593  }

◆ reserve()

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

Reserve a given size for the arrays.

Implements SG::IAuxStore.

Definition at line 459 of file ShallowAuxContainer.cxx.

459  {
460 
461  // Nope, not allowed...
462  throw std::runtime_error( "Trying to call reserve on a shallow copy "
463  "container" );
464  }

◆ resize()

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

Resize the arrays to a given size.

Implements SG::IAuxStore.

Definition at line 449 of file ShallowAuxContainer.cxx.

450  {
451  if (size == this->size()) {
452  return false;
453  }
454  // Nope, not allowed...
455  throw std::runtime_error( "Trying to call resize on a shallow copy "
456  "container" );
457  }

◆ setName()

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

Set the name of the container instance.

Definition at line 580 of file ShallowAuxContainer.cxx.

580  {
581 
582  m_name = name;
583  return;
584  }

◆ 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 176 of file IAuxStore.h.

177  { return false; }

◆ setParent()

void xAOD::ShallowAuxContainer::setParent ( const DataLink< SG::IConstAuxStore > &  link)

Set the parent store.

Definition at line 122 of file ShallowAuxContainer.cxx.

123  {
124 
125  guard_t guard (m_mutex);
126  m_parentLink = link;
127  m_parentIO = dynamic_cast< const SG::IAuxStoreIO* >( m_parentLink.cptr() );
128  m_auxidsValid = false;
129  return;
130  }

◆ setShallowIO()

void xAOD::ShallowAuxContainer::setShallowIO ( bool  value)

Set whether only the overriden parameters should be written out.

Definition at line 137 of file ShallowAuxContainer.cxx.

137  {
138 
139  guard_t guard (m_mutex);
140  m_shallowIO = value;
141  return;
142  }

◆ setStore()

void xAOD::ShallowAuxContainer::setStore ( SG::IAuxStore store)
overridevirtual

Set a different internal store object.

Implements SG::IAuxStoreHolder.

Definition at line 159 of file ShallowAuxContainer.cxx.

159  {
160 
161  // Check if anything needs to be done:
162  guard_t guard (m_mutex);
163  if( store == m_store ) return;
164 
165  if( m_ownsStore && m_store ) {
166  delete m_store;
167  m_store = nullptr;
168  }
169 
170  // Do the assignment:
171  m_store = store;
172  m_storeIO = dynamic_cast< SG::IAuxStoreIO* >( m_store );
173  m_ownsStore = true;
174  m_auxidsValid = false;
175 
176  return;
177  }

◆ shallowIO()

bool xAOD::ShallowAuxContainer::shallowIO ( ) const

Check whether only the overriden parameters will be written out or not.

Definition at line 132 of file ShallowAuxContainer.cxx.

132  {
133 
134  return m_shallowIO;
135  }

◆ shift()

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

Shift the contents of the stored arrays.

Implements SG::IAuxStore.

Definition at line 466 of file ShallowAuxContainer.cxx.

466  {
467 
468  // Nope, not allowed...
469  throw std::runtime_error( "Trying to call shift on a shallow copy "
470  "container" );
471  }

◆ size()

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

Get the size of the container.

Implements SG::IConstAuxStore.

Definition at line 340 of file ShallowAuxContainer.cxx.

340  {
341 
342  guard_t guard( m_mutex );
343  size_t sz = m_store->size();
344  if( sz > 0 ) {
345  return sz;
346  }
347  if( m_parentLink.isValid() ) {
348  return m_parentLink->size();
349  }
350  return 0;
351  }

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/2]

auxid_set_t m_auxids xAOD::ShallowAuxContainer::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 201 of file ShallowAuxContainer.h.

◆ ATLAS_THREAD_SAFE [2/2]

bool m_auxidsValid xAOD::ShallowAuxContainer::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 202 of file ShallowAuxContainer.h.

◆ m_locked

bool xAOD::ShallowAuxContainer::m_locked
private

Flag keeping track of whether this object is locked or not.

Definition at line 185 of file ShallowAuxContainer.h.

◆ m_mutex

mutex_t xAOD::ShallowAuxContainer::m_mutex
mutableprivate

Definition at line 197 of file ShallowAuxContainer.h.

◆ m_name

std::string xAOD::ShallowAuxContainer::m_name
private

Name of the container in memory. Set externally.

Definition at line 205 of file ShallowAuxContainer.h.

◆ m_ownsStore

bool xAOD::ShallowAuxContainer::m_ownsStore
private

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

Definition at line 183 of file ShallowAuxContainer.h.

◆ m_parentIO

const SG::IAuxStoreIO* xAOD::ShallowAuxContainer::m_parentIO
private

Optional pointer to the IO interface of the parent object.

Definition at line 190 of file ShallowAuxContainer.h.

◆ m_parentLink

DataLink< SG::IConstAuxStore > xAOD::ShallowAuxContainer::m_parentLink
private

Link to the parent object.

Definition at line 188 of file ShallowAuxContainer.h.

◆ m_selection

AuxSelection xAOD::ShallowAuxContainer::m_selection
private

Dynamic attributes selection implementation.

Definition at line 176 of file ShallowAuxContainer.h.

◆ m_shallowIO

bool xAOD::ShallowAuxContainer::m_shallowIO
private

Flag for whether to do "shallow IO" or not.

Definition at line 192 of file ShallowAuxContainer.h.

◆ m_store

SG::IAuxStore* xAOD::ShallowAuxContainer::m_store
private

Internal dynamic auxiliary store object.

Definition at line 179 of file ShallowAuxContainer.h.

◆ m_storeIO

SG::IAuxStoreIO* xAOD::ShallowAuxContainer::m_storeIO
private

The IO interface to the internal auxiliary store.

Definition at line 181 of file ShallowAuxContainer.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 189 of file IAuxStore.h.


The documentation for this class was generated from the following files:
SG::AuxTypeRegistry::getFactory
const IAuxTypeVectorFactory * getFactory(const std::type_info &ti, const std::type_info &ti_alloc)
Return the vector factory for a given vector element type.
Definition: AuxTypeRegistry.cxx:457
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:69
beamspotPlotBcids.sz
sz
Definition: beamspotPlotBcids.py:521
SG::IConstAuxStore::getData
virtual const void * getData(SG::auxid_t auxid) const =0
Return the data vector for one aux data item.
SG::IConstAuxStore::lockDecoration
virtual void lockDecoration(SG::auxid_t auxid)=0
Lock a decoration.
get_generator_info.result
result
Definition: get_generator_info.py:21
CxxUtils::ConcurrentBitset::count
bit_t count() const
Count the number of 1 bits in the set.
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:49
xAOD::ShallowAuxContainer::parent
const DataLink< SG::IConstAuxStore > & parent() const
Get the parent store.
Definition: ShallowAuxContainer.cxx:117
SG::AuxTypeRegistry::getName
std::string getName(SG::auxid_t auxid) const
Return the name of an aux data item.
Definition: AuxTypeRegistry.cxx:262
SG::ExcStoreLocked
Exception — Attempted to modify auxiliary data in a locked store.
Definition: Control/AthContainers/AthContainers/exceptions.h:183
xAOD::ShallowAuxContainer::guard_t
AthContainers_detail::lock_guard< mutex_t > guard_t
Definition: ShallowAuxContainer.h:196
athena.value
value
Definition: athena.py:122
xAOD::ShallowAuxContainer::name
const char * name() const
Get the name of the container instance.
Definition: ShallowAuxContainer.cxx:575
xAOD::ShallowAuxContainer::m_selection
AuxSelection m_selection
Dynamic attributes selection implementation.
Definition: ShallowAuxContainer.h:176
xAOD::ShallowAuxContainer::m_shallowIO
bool m_shallowIO
Flag for whether to do "shallow IO" or not.
Definition: ShallowAuxContainer.h:192
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.
python.DomainsRegistry.reg
reg
globals -----------------------------------------------------------------—
Definition: DomainsRegistry.py:343
xAOD::ShallowAuxContainer::size
virtual size_t size() const override
Get the size of the container.
Definition: ShallowAuxContainer.cxx:340
ReweightUtils.message
message
Definition: ReweightUtils.py:15
SG::IConstAuxStore::size
virtual size_t size() const =0
Return the number of elements in the store.
xAOD::ShallowAuxContainer::m_ownsStore
bool m_ownsStore
Flag deciding if the object owns the dynamic store or not.
Definition: ShallowAuxContainer.h:183
SG::IAuxStoreIO
Interface providing I/O for a generic auxiliary store.
Definition: IAuxStoreIO.h:44
SG::AuxTypeRegistry
Handle mappings between names and auxid_t.
Definition: AuxTypeRegistry.h:62
xAOD::ShallowAuxContainer::m_name
std::string m_name
Name of the container in memory. Set externally.
Definition: ShallowAuxContainer.h:205
xAOD::ShallowAuxContainer::m_parentLink
DataLink< SG::IConstAuxStore > m_parentLink
Link to the parent object.
Definition: ShallowAuxContainer.h:188
CxxUtils::ConcurrentBitset::size
bit_t size() const
Count the number of 1 bits in the set.
SG::IConstAuxStore::clearDecorations
virtual bool clearDecorations()=0
Clear all decorations.
xAOD::ShallowAuxContainer::m_mutex
mutex_t m_mutex
Definition: ShallowAuxContainer.h:197
ret
T ret(T t)
Definition: rootspy.cxx:260
SG::IAuxTypeVectorFactory
Interface for factory objects that create vectors.
Definition: IAuxTypeVectorFactory.h:50
xAOD::ShallowAuxContainer::m_storeIO
SG::IAuxStoreIO * m_storeIO
The IO interface to the internal auxiliary store.
Definition: ShallowAuxContainer.h:181
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::IAuxTypeVectorFactory::copy
virtual void copy(SG::auxid_t auxid, AuxVectorData &dst, size_t dst_index, const AuxVectorData &src, size_t src_index, size_t n) const =0
Copy elements between vectors.
xAOD::ShallowAuxContainer::getAuxIDs
virtual const auxid_set_t & getAuxIDs() const override
Get the types(names) of variables handled by this container.
Definition: ShallowAuxContainer.cxx:218
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
xAOD::ShallowAuxContainer::m_parentIO
const SG::IAuxStoreIO * m_parentIO
Optional pointer to the IO interface of the parent object.
Definition: ShallowAuxContainer.h:190
xAOD::ShallowAuxContainer::m_locked
bool m_locked
Flag keeping track of whether this object is locked or not.
Definition: ShallowAuxContainer.h:185
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.
SG::IAuxStore::getWritableAuxIDs
virtual const SG::auxid_set_t & getWritableAuxIDs() const =0
Return a set of identifiers for writable data items in this store.
SG::IAuxStore
Interface for non-const operations on an auxiliary store.
Definition: IAuxStore.h:51
SG::AuxStoreInternal
An auxiliary data store that holds data internally.
Definition: AuxStoreInternal.h:43
SG::AuxVectorInterface
Make an AuxVectorData object from either a raw array or an aux store.
Definition: AuxVectorInterface.h:33
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.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SG::IConstAuxStore::lock
virtual void lock()=0
Lock the container.
xAOD::ShallowAuxContainer::auxid_set_t
SG::auxid_set_t auxid_set_t
The aux ID set type definition.
Definition: ShallowAuxContainer.h:60
xAOD::ShallowAuxContainer::m_store
SG::IAuxStore * m_store
Internal dynamic auxiliary store object.
Definition: ShallowAuxContainer.h:179
SG::IConstAuxStore::isDecoration
virtual bool isDecoration(auxid_t auxid) const =0
Test if a particular variable is tagged as a decoration.
xAOD::AuxSelection::getSelectedAuxIDs
virtual SG::auxid_set_t getSelectedAuxIDs(const SG::auxid_set_t &fullset) const
Return which variables were selected to be written out.
Definition: AuxSelection.cxx:62
SG::IAuxStoreHolder::AST_ObjectStore
@ AST_ObjectStore
The store describes a single object.
Definition: IAuxStoreHolder.h:67
SG::IAuxStoreHolder
Interface for objects taking part in direct ROOT I/O.
Definition: IAuxStoreHolder.h:36
xAOD::ShallowAuxContainer::remakeAuxIDs
void remakeAuxIDs() const
Definition: ShallowAuxContainer.cxx:586
SG::IConstAuxStore::getAuxIDs
virtual const SG::auxid_set_t & getAuxIDs() const =0
Return a set of identifiers for existing data items in this store.
SG::IAuxStoreHolder::AST_ContainerStore
@ AST_ContainerStore
The store describes a container.
Definition: IAuxStoreHolder.h:68
CxxUtils::ConcurrentBitset::test
bool test(bit_t bit) const
Test to see if a bit is set.