ATLAS Offline Software
Loading...
Searching...
No Matches
SG::AuxElementData Class Reference

Internal data container. More...

Inheritance diagram for SG::AuxElementData:
Collaboration diagram for SG::AuxElementData:

Public Member Functions

virtual size_t size_v () const override
 Return the size of the container.
virtual size_t capacity_v () const override
 Return the capacity of the container.

Aux store management.

const SG::IConstAuxStore * getConstStore () const
 Return the current store, as a const interface.
const DataLink< SG::IConstAuxStore > getConstStoreLink () const
 Return the data link to the current store, as a const interface.
SG::IAuxStoregetStore ()
 Return the current store, as a non-const interface.
const SG::IAuxStoregetStore () const
 Return the current store, as a non-const interface.
bool hasStore () const
 Return true if this object has an associated store.
bool hasNonConstStore () const
 Return true if this object has an associated non-const store.
bool setOption (auxid_t id, const AuxDataOption &option)
 Set an option for an auxiliary data variable.
bool setOption (const std::string &name, const AuxDataOption &option)
 Set an option for an auxiliary data variable.
bool setOption (const std::string &name, const std::string &clsname, const AuxDataOption &option)
 Set an option for an auxiliary data variable.
template<class T>
bool setOption (auxid_t id, const std::string &optname, T arg)
 Set an option for an auxiliary data variable.
bool setOption (const std::string &name, const std::string &optname, int arg)
 Set an option for an auxiliary data variable.
bool setOption (const std::string &name, const std::string &optname, float arg)
bool setOption (const std::string &name, const std::string &optname, double arg)
template<class T>
bool setOption (const std::string &name, const std::string &clsname, const std::string &optname, T arg)
 Set an option for an auxiliary data variable.
void setStore (SG::IAuxStore *store)
 Set the store associated with this object.
void setStore (const SG::IConstAuxStore *store)
 Set the store associated with this object.
void setStore (const DataLink< SG::IConstAuxStore > &store)
 Set the store associated with this object.
void setNonConstStore (SG::IAuxStore *store)
 Set the store associated with this object.

Data access.

const SG::auxid_set_tgetAuxIDs () const
 Return a set of identifiers for existing data items in store associated with this object.
const SG::auxid_set_tgetDecorIDs () const
 Return a set of identifiers for decorations for this object.
SG::auxid_set_t getCopyIDs (bool warnUnlocked=false) const
 Return the set of variables to copy in a deep copy.
const SG::auxid_set_tgetWritableAuxIDs () const
 Return a set of identifiers for writable data items in this store.
bool isAvailable (auxid_t id) const
 Test to see if a variable exists in the store.
bool isAvailableWritable (auxid_t id)
 Test to see if a variable is available for writing.
bool isAvailableWritableAsDecoration (auxid_t id) const
 Test to see if a variable is available for writing as a decoration.
template<class T>
AuxDataTraits< T >::reference_type getData (SG::auxid_t auxid, size_t ndx)
 Return reference to an aux data item.
template<class T>
AuxDataTraits< T >::const_reference_type getData (SG::auxid_t auxid, size_t ndx) const
 Return const reference to an aux data item.
template<class T>
AuxDataTraits< T >::reference_type getDecoration (SG::auxid_t auxid, size_t ndx) const
 Return reference to an aux decoration item.
const void * getDataArray (SG::auxid_t auxid) const
 Return a const pointer to the start of an aux data vector.
void * getDataArray (SG::auxid_t auxid)
 Return a pointer to the start of an aux data vector.
const void * getDataArrayAllowMissing (SG::auxid_t auxid) const
 Return a const pointer to the start of an aux data vector.
void * getDecorationArray (SG::auxid_t auxid) const
 Return a pointer to the start of an aux data vector for a decoration.
const AuxDataSpanBasegetDataSpan (SG::auxid_t auxid) const
 Return a reference to a description of this vector's start+size.
static size_t s_minCacheLen ATLAS_THREAD_SAFE
 Minimum length to use for the cache vector.

Other operations.

void swap (AuxVectorData &other)
 Swap this instance with another.
void clearCache ()
 Clear the cached aux data pointers.
void clearCache (SG::auxid_t auxid)
 Clear the cached aux data pointers for a single variable.
void clearDecorCache (SG::auxid_t auxid)
 Clear the cached decoration pointer for a single variable.
virtual void lock () override
 Lock the container.
bool clearDecorations () const
 Clear all decorations.
void lockDecoration (SG::auxid_t auxid)
 Explicitly lock a decoration.
const SG::IConstAuxStore * getConstStoreOol () const
 Same as getConstStore.
typedef AthContainers_detail::mutex mutex_t
 Mutex used to synchronize modifications to the cache vector.
typedef AthContainers_detail::lock_guard< mutex_tguard_t
Cache m_cache ATLAS_THREAD_SAFE
 Cached pointers to the start of aux data vectors, non-const.
Cache m_constCache ATLAS_THREAD_SAFE
 Cached pointers to the start of aux data vectors, const.
Cache m_decorCache ATLAS_THREAD_SAFE
 Cached pointers to the start of aux data vectors, decorations.
Cache m_spanCache ATLAS_THREAD_SAFE
 Cached pointers to span descriptors.
SG::IAuxStorem_store
 Associated store, non-const.
const SG::IConstAuxStore * m_constStore
 Associated store, const.
DataLink< SG::IConstAuxStore > m_constStoreLink
 Associated store link, const.
mutex_t m_mutex
static const SG::auxid_set_t s_emptySet
 Empty auxid set, used for a return value when we have no associated store.
void setCache (SG::auxid_t auxid, void *ptr)
 Explicitly set a cache pointer.
void setCache (SG::auxid_t auxid, const void *ptr)
 Explicitly set a cache pointer.
bool isAvailableOol (auxid_t id) const
 Out-of-line portion of isAvailable.
bool isAvailableWritableOol (auxid_t id)
 Out-of-line portion of isAvailableWritable.
bool isAvailableWritableAsDecorationOol (auxid_t id) const
 Out-of-line portion of isAvailableWritableAsDecoration.
void * getDataOol (SG::auxid_t auxid, bool allowMissing)
 Out-of-line portion of data access.
const void * getDataOol (SG::auxid_t auxid, bool allowMissing) const
 Out-of-line portion of data access (const version).
void * getDecorationOol (SG::auxid_t auxid) const
 Out-of-line portion of data access (decorator version).
const AuxDataSpanBasegetDataSpanOol (SG::auxid_t auxid, bool allowMissing) const
 Return a reference to a description of this vector's start+size, out-of-line portion.

Detailed Description

Internal data container.

If an object has a private or standalone data store, its container is set to point to an instance of this.

Definition at line 29 of file AuxElement.cxx.

Member Typedef Documentation

◆ guard_t

Definition at line 997 of file AuxVectorData.h.

◆ mutex_t

Mutex used to synchronize modifications to the cache vector.

Definition at line 996 of file AuxVectorData.h.

Member Function Documentation

◆ capacity_v()

virtual size_t SG::AuxElementData::capacity_v ( ) const
inlineoverridevirtual

Return the capacity of the container.

This is used when we need to create a new aux data vector.

Implements SG::AuxVectorData.

Definition at line 34 of file AuxElement.cxx.

34{ return 1; }

◆ clearCache() [1/2]

void SG::AuxVectorData::clearCache ( )
inherited

Clear the cached aux data pointers.

You should call this any time something changes in the aux store that could invalidate the vector pointers.

◆ clearCache() [2/2]

void SG::AuxVectorData::clearCache ( SG::auxid_t auxid)
inherited

Clear the cached aux data pointers for a single variable.

Parameters
auxidID of the variable to clear.

Not really safe to use if another thread may be accessing the same decoration.

◆ clearDecorations()

bool SG::AuxVectorData::clearDecorations ( ) const
inherited

Clear all decorations.

Erase all decorations from the store, restoring the state to when lock was called.

Returns true if there were any decorations that were cleared, false if the store did not contain any decorations.

Definition at line 670 of file AuxVectorData.cxx.

671{
672 bool ret = false;
673 if (m_store) {
674 // Avoid warning about calling non-const function. OK here.
675 IAuxStore* store ATLAS_THREAD_SAFE = m_store;
676 ret = store->clearDecorations();
677 m_cache.clear();
678 m_constCache.clear();
679 m_decorCache.clear();
680 }
681 else if (getConstStore()) {
682 // The whole point of decorations is to allow adding information to
683 // something that's otherwise const. So we have the const_cast here.
684 // The store object is responsible for determining whether the
685 // modification is really allowed or not.
686 IConstAuxStore* store ATLAS_THREAD_SAFE =
687 const_cast<IConstAuxStore*> (getConstStore());
688 ret = store->clearDecorations();
689 }
690 else
691 throw SG::ExcNoAuxStore ("lock");
692 return ret;
693}
static size_t s_minCacheLen ATLAS_THREAD_SAFE
Minimum length to use for the cache vector.
SG::IAuxStore * m_store
Associated store, non-const.
const SG::IConstAuxStore * getConstStore() const
Return the current store, as a const interface.
TestStore store
Definition TestStore.cxx:23
std::unique_ptr< IIntersectionCache > m_cache

◆ clearDecorCache()

void SG::AuxVectorData::clearDecorCache ( SG::auxid_t auxid)
inherited

Clear the cached decoration pointer for a single variable.

Parameters
auxidID of the variable to clear.

Not really safe to use if another thread may be accessing the same decoration.

◆ getAuxIDs()

const SG::auxid_set_t & SG::AuxVectorData::getAuxIDs ( ) const
inherited

Return a set of identifiers for existing data items in store associated with this object.

This will include identifiers for all items, const and non-const. If no store is associated with this object, this will return an empty set.

Definition at line 203 of file AuxVectorData.cxx.

204{
205 const SG::IConstAuxStore* store = getConstStore();
206 if (store)
207 return store->getAuxIDs();
208 return s_emptySet;
209}
static const SG::auxid_set_t s_emptySet
Empty auxid set, used for a return value when we have no associated store.

◆ getConstStore()

const SG::IConstAuxStore * SG::AuxVectorData::getConstStore ( ) const
inherited

Return the current store, as a const interface.

This will be non-zero if either a const or non-const store is associated with this object.

◆ getConstStoreLink()

const DataLink< SG::IConstAuxStore > SG::AuxVectorData::getConstStoreLink ( ) const
inherited

Return the data link to the current store, as a const interface.

This is set by persistency when reading an object, but it may be overridden by setting the store pointer directly.

◆ getConstStoreOol()

const SG::IConstAuxStore * SG::AuxVectorData::getConstStoreOol ( ) const
inherited

Same as getConstStore.

But out-of-line, as sometimes the debugger has problems calling inline functions.

Definition at line 721 of file AuxVectorData.cxx.

722{
723 return getConstStore();
724}

◆ getCopyIDs()

SG::auxid_set_t SG::AuxVectorData::getCopyIDs ( bool warnUnlocked = false) const
inherited

Return the set of variables to copy in a deep copy.

Parameters
warnUnlockedIf true, we warn about variables skipped on account of being decorations.

This is usually getAuxIDs()-getDecorIDs(), but may be different for some special cases.

Definition at line 220 of file AuxVectorData.cxx.

221{
222 const SG::IConstAuxStore* store = getConstStore();
223 if (store)
224 return store->getCopyIDs (warnUnlocked);
225 return SG::auxid_set_t();
226}

◆ getData() [1/2]

template<class T>
AuxDataTraits< T >::reference_type SG::AuxVectorData::getData ( SG::auxid_t auxid,
size_t ndx )
inherited

Return reference to an aux data item.

Parameters
auxidThe desired aux data item.
ndxIndex of the element to return.

This will return a reference to element ndx of aux data item auxid. If the aux data item does not exist, it will be created. Errors are signaled by raising an exception.

Warning: no type checking is done. You should usually access the data via Accessor or ConstAccessor.

◆ getData() [2/2]

template<class T>
AuxDataTraits< T >::const_reference_type SG::AuxVectorData::getData ( SG::auxid_t auxid,
size_t ndx ) const
inherited

Return const reference to an aux data item.

Parameters
auxidThe desired aux data item.
ndxIndex of the element to return.

This will return a reference to element ndx of aux data item auxid. Errors are signaled by raising an exception.

Warning: no type checking is done. You should usually access the data via Accessor or ConstAccessor.

◆ getDataArray() [1/2]

void * SG::AuxVectorData::getDataArray ( SG::auxid_t auxid)
inherited

Return a pointer to the start of an aux data vector.

Parameters
auxidThe desired aux data item.

This will return a pointer to the start of the data for aux data item auxid. If the item doesn't exist, it will be created. Errors are signaled by raising an exception.

◆ getDataArray() [2/2]

const void * SG::AuxVectorData::getDataArray ( SG::auxid_t auxid) const
inherited

Return a const pointer to the start of an aux data vector.

Parameters
auxidThe desired aux data item.

This will return a pointer to the start of the data for aux data item auxid. Errors are signaled by raising an exception.

◆ getDataArrayAllowMissing()

const void * SG::AuxVectorData::getDataArrayAllowMissing ( SG::auxid_t auxid) const
inherited

Return a const pointer to the start of an aux data vector.

Parameters
auxidThe desired aux data item.

This will return a pointer to the start of the data for aux data item auxid. If the item does not exist, this will return nullptr rather than raising an exception.

◆ getDataOol() [1/2]

void * SG::AuxVectorData::getDataOol ( SG::auxid_t auxid,
bool allowMissing )
privateinherited

Out-of-line portion of data access.

Parameters
auxidaux data item being accessed.
allowMissingIf true, then return nullptr if the variable is missing rather than throwing an exception.

When this function returns, the cache entry m_cache[auxid] will be valid. That entry is also returned. If there's an error, the function will throw an exception rather than returning.

Definition at line 325 of file AuxVectorData.cxx.

326{
327 guard_t guard (m_mutex);
328
329 // Fetch the pointer from the store, or raise an exception if we don't
330 // have a non-const store.
331 void* ptr = 0;
332 if (m_store) {
333 if (SG::AuxTypeRegistry::instance().isLinked (auxid)) {
334 ptr = m_store->getData (auxid, 0, 0);
335 }
336 else {
337 ptr = m_store->getData (auxid, this->size_v(), this->capacity_v());
338 }
339 }
340 else if (getConstStore())
341 throw SG::ExcConstAuxData ("fetch item", auxid);
342 else
343 throw SG::ExcNoAuxStore (auxid);
344
345 // Check that we got a good pointer back, otherwise throw.
346 if (ptr) {
347 m_cache.store (auxid, ptr);
348
349 // Set the same entry in the other caches as well.
350 m_constCache.store (auxid, ptr);
351 m_decorCache.store (auxid, ptr);
352 }
353 else if (!allowMissing)
354 throw SG::ExcBadAuxVar (auxid);
355
356 return ptr;
357}
static AuxTypeRegistry & instance()
Return the singleton registry instance.
virtual size_t size_v() const =0
Return the size of the container.
virtual size_t capacity_v() const =0
Return the capacity of the container.
AthContainers_detail::lock_guard< mutex_t > guard_t
SG::auxid_t auxid() const
Return the aux id for this variable.
void * ptr(T *p)
Definition SGImplSvc.cxx:74

◆ getDataOol() [2/2]

const void * SG::AuxVectorData::getDataOol ( SG::auxid_t auxid,
bool allowMissing ) const
privateinherited

Out-of-line portion of data access (const version).

Parameters
auxidaux data item being accessed.
allowMissingIf true, then return nullptr if the variable is missing rather than throwing an exception.

When this function returns, the cache entry m_constCache[auxid] will be valid. That entry is also returned. If there's an error, the function will throw an exception rather than returning.

Definition at line 370 of file AuxVectorData.cxx.

372{
373 guard_t guard (m_mutex);
374
375 // Fetch the pointer from the store, or raise an exception if we don't
376 // have a const store.
377 const void* ptr = 0;
378 const SG::IConstAuxStore* store = getConstStore();
379 if (store)
380 ptr = store->getData (auxid);
381 else
382 throw SG::ExcNoAuxStore (auxid);
383
384 // Check that we got a good pointer back, otherwise throw.
385 if (ptr) {
386 // We could avoid the const_cast here by having distinct const and
387 // non-const Cache types, holding const void* and void*, respectively.
388 // However, since this is a purely internal class that users don't
389 // deal with directly, that's not worth the bother (and the extra code).
390 void* vp ATLAS_THREAD_SAFE = const_cast<void*> (ptr);
391 m_constCache.store (auxid, vp);
392 }
393 else if (!allowMissing)
394 throw SG::ExcBadAuxVar (auxid);
395
396 return ptr;
397}

◆ getDataSpan()

const AuxDataSpanBase * SG::AuxVectorData::getDataSpan ( SG::auxid_t auxid) const
inherited

Return a reference to a description of this vector's start+size.

Parameters
auxidThe desired aux data item.

This low-overhead method of getting the start+size of an auxiliary variable. The returned object will be updated if the variable's vector changes. Raises an exception if the variable does not exist.

This is in principle a const-correctness violation, since AuxDataSpanBase has a non-const pointer to the start of the vector. But doing it properly is kind of painful, and as this interface is only meant to be used internally, it's likely not a real problem.

◆ getDataSpanOol()

const AuxDataSpanBase * SG::AuxVectorData::getDataSpanOol ( SG::auxid_t auxid,
bool allowMissing ) const
privateinherited

Return a reference to a description of this vector's start+size, out-of-line portion.

Parameters
auxidThe desired aux data item.
allowMissingIf true, then return nullptr if the variable is missing rather than throwing an exception.

When this function returns, the cache entry m_spanCache[auxid] will be valid. That entry is also returned. If there's an error, the function will throw an exception rather than returning.

Definition at line 473 of file AuxVectorData.cxx.

474{
475 guard_t guard (m_mutex);
476
477 // Fetch the pointer from the store, or raise an exception if we don't
478 // have a const store.
479 const IAuxTypeVector* v = 0;
480 const SG::IConstAuxStore* store = getConstStore();
481 if (store)
482 v = store->getVector (auxid);
483 else
484 throw SG::ExcNoAuxStore (auxid);
485
486 // Check that we got a good pointer back, otherwise throw.
487 const AuxDataSpanBase* ptr = nullptr;
488 if (v) {
489 ptr = &v->getDataSpan();
490 // We could avoid the const_cast here by having distinct const and
491 // non-const Cache types, holding const void* and void*, respectively.
492 // However, since this is a purely internal class that users don't
493 // deal with directly, that's not worth the bother (and the extra code).
494 AuxDataSpanBase* vp ATLAS_THREAD_SAFE = const_cast<AuxDataSpanBase*> (ptr);
495 m_spanCache.store (auxid, vp);
496 }
497 else if (!allowMissing)
498 throw SG::ExcBadAuxVar (auxid);
499
500 return ptr;
501}

◆ getDecoration()

template<class T>
AuxDataTraits< T >::reference_type SG::AuxVectorData::getDecoration ( SG::auxid_t auxid,
size_t ndx ) const
inherited

Return reference to an aux decoration item.

Parameters
auxidThe desired aux decoration item.
ndxIndex of the element to return.

This will return a reference to element ndx of aux decoration item auxid. If the aux data item does not exist, it will be created. Errors are signaled by raising an exception.

Warning: no type checking is done. You should usually access the data via Decorator.

The difference between getDecoration and getData is that getDecoration takes a const container as input, but returns a non-const reference. This will only succeed if either the container is not locked or the item was first accessed as a decoration.

◆ getDecorationArray()

void * SG::AuxVectorData::getDecorationArray ( SG::auxid_t auxid) const
inherited

Return a pointer to the start of an aux data vector for a decoration.

Parameters
auxidThe desired aux data item.

This will return a pointer to the start of the data for aux data item auxid. If the item doesn't exist, it will be created. Errors are signaled by raising an exception.

The difference between getDecorationArray and getDataArray is that getDecorationArray takes a const container as input, but returns a non-const pointer. This will only succeed if either the container is not locked or the item was first accessed as a decoration.

◆ getDecorationOol()

void * SG::AuxVectorData::getDecorationOol ( SG::auxid_t auxid) const
privateinherited

Out-of-line portion of data access (decorator version).

Parameters
auxidaux data item being accessed.

When this function returns, the cache entry m_cache[auxid] will be valid. That entry is also returned. If there's an error, the function will throw an exception rather than returning.

The difference between getDecorationOol and getDataOol is that getDecorationOol takes a const container as input, but returns a non-const pointer. This will only succeed if either the container is not locked or the item was first accessed as a decoration.

Definition at line 414 of file AuxVectorData.cxx.

415{
416 guard_t guard (m_mutex);
417
418 // Fetch the pointer from the store, or raise an exception if we don't
419 // have a non-const store.
420 void* ptr = 0;
421 if (m_store) {
422 // Avoid warning about calling non-const function. OK here.
423 IAuxStore* store ATLAS_THREAD_SAFE = m_store;
424 if (SG::AuxTypeRegistry::instance().isLinked (auxid)) {
425 ptr = store->getDecoration (auxid, 0, 0);
426 }
427 else {
428 ptr = store->getDecoration (auxid, this->size_v(), this->capacity_v());
429 }
430 }
431 else if (getConstStore()) {
432 // The whole point of decorations is to allow adding information to
433 // something that's otherwise const. So we have the const_cast here.
434 // The store object is responsible for determining whether the
435 // modification is really allowed or not.
436 IConstAuxStore* store ATLAS_THREAD_SAFE =
437 const_cast<IConstAuxStore*> (getConstStore());
438 if (SG::AuxTypeRegistry::instance().isLinked (auxid)) {
439 ptr = store->getDecoration (auxid, 0, 0);
440 }
441 else {
442 ptr = store->getDecoration (auxid, this->size_v(), this->capacity_v());
443 }
444 }
445 else
446 throw SG::ExcNoAuxStore (auxid);
447
448 // Check that we got a good pointer back, otherwise throw.
449 if (!ptr)
450 throw SG::ExcBadAuxVar (auxid);
451
452 m_decorCache.store (auxid, ptr);
453
454 // Set the same entry in the const cache as well.
455 m_constCache.store (auxid, ptr);
456
457 return ptr;
458}

◆ getDecorIDs()

const SG::auxid_set_t & SG::AuxVectorData::getDecorIDs ( ) const
inherited

Return a set of identifiers for decorations for this object.

Definition at line 232 of file AuxVectorData.cxx.

233{
234 if (getConstStore())
235 return getConstStore()->getDecorIDs();
236 return s_emptySet;
237}

◆ getStore() [1/2]

SG::IAuxStore * SG::AuxVectorData::getStore ( )
inherited

Return the current store, as a non-const interface.

This will be non-zero if a non-const store is associated with this object.

◆ getStore() [2/2]

const SG::IAuxStore * SG::AuxVectorData::getStore ( ) const
inherited

Return the current store, as a non-const interface.

This will be non-zero if a non-const store is associated with this object.

◆ getWritableAuxIDs()

const SG::auxid_set_t & SG::AuxVectorData::getWritableAuxIDs ( ) const
inherited

Return a set of identifiers for writable data items in this store.

This will include only non-const identifiers. If no store is associated with this object, this will return an empty set.

Definition at line 248 of file AuxVectorData.cxx.

249{
250 if (m_store)
251 return m_store->getWritableAuxIDs();
252 return s_emptySet;
253}

◆ hasNonConstStore()

bool SG::AuxVectorData::hasNonConstStore ( ) const
inherited

Return true if this object has an associated non-const store.

◆ hasStore()

bool SG::AuxVectorData::hasStore ( ) const
inherited

Return true if this object has an associated store.

◆ isAvailable()

bool SG::AuxVectorData::isAvailable ( auxid_t id) const
inherited

Test to see if a variable exists in the store.

Parameters
idThe variable to test.

◆ isAvailableOol()

bool SG::AuxVectorData::isAvailableOol ( auxid_t id) const
privateinherited

Out-of-line portion of isAvailable.

Parameters
idThe variable to test.

Definition at line 260 of file AuxVectorData.cxx.

261{
262 guard_t guard (m_mutex);
263
264 const SG::IConstAuxStore* store = getConstStore();
265 if (!store) return false;
266
267 // Don't rely on getAuxIDs() --- the store can lie.
268 // Explicitly try to fetch the data.
269 const void* ptr = store->getData (id);
270 if (ptr) {
271 // We could avoid the const_cast here by having distinct const and
272 // non-const Cache types, holding const void* and void*, respectively.
273 // However, since this is a purely internal class that users don't
274 // deal with directly, that's not worth the bother (and the extra code).
275 void* vp ATLAS_THREAD_SAFE = const_cast<void*> (ptr);
276 m_constCache.store (id, vp);
277 return true;
278 }
279 return false;
280}

◆ isAvailableWritable()

bool SG::AuxVectorData::isAvailableWritable ( auxid_t id)
inherited

Test to see if a variable is available for writing.

Parameters
idThe variable to test.

◆ isAvailableWritableAsDecoration()

bool SG::AuxVectorData::isAvailableWritableAsDecoration ( auxid_t id) const
inherited

Test to see if a variable is available for writing as a decoration.

Parameters
idThe variable to test.

◆ isAvailableWritableAsDecorationOol()

bool SG::AuxVectorData::isAvailableWritableAsDecorationOol ( auxid_t id) const
privateinherited

Out-of-line portion of isAvailableWritableAsDecoration.

Parameters
idThe variable to test.

Definition at line 299 of file AuxVectorData.cxx.

300{
301 if (!isAvailableOol (id)) return false;
302
303 // Not nice, but not sure we can do otherwise without changing interfaces.
304 // I think the case of a caught exception should be rare.
305 try {
306 this->getDecorationArray (id);
307 }
308 catch (const SG::ExcStoreLocked&) {
309 return false;
310 }
311 return true;
312}
bool isAvailableOol(auxid_t id) const
Out-of-line portion of isAvailable.
void * getDecorationArray(SG::auxid_t auxid) const
Return a pointer to the start of an aux data vector for a decoration.

◆ isAvailableWritableOol()

bool SG::AuxVectorData::isAvailableWritableOol ( auxid_t id)
privateinherited

Out-of-line portion of isAvailableWritable.

Parameters
idThe variable to test.

Definition at line 287 of file AuxVectorData.cxx.

288{
289 const SG::IAuxStore* store = getStore();
290 if (!store) return false;
291 return store->getWritableAuxIDs().test(id);
292}
SG::IAuxStore * getStore()
Return the current store, as a non-const interface.

◆ lock()

void SG::AuxVectorData::lock ( )
overridevirtualinherited

Lock the container.

After this, only decorations can be changed/modified. If the container is already locked, this is a no-op.

Definition at line 650 of file AuxVectorData.cxx.

651{
652 if (m_store) {
653 m_store->lock();
654 clearCache();
655 }
656
657 // No error if no store or no writable store.
658}
void clearCache()
Clear the cached aux data pointers.

◆ lockDecoration()

void SG::AuxVectorData::lockDecoration ( SG::auxid_t auxid)
inherited

Explicitly lock a decoration.

Parameters
auxidID of the decoration to lock.

This is only safe if no other thread can be accessing this decoration. It is strongly preferred to do this via a WriteDecorHandle, where the dependencies can help ensure this.

Definition at line 704 of file AuxVectorData.cxx.

705{
706 const IConstAuxStore* store = this->getConstStore();
707 if (store) {
708 // Casting away const ok if no other thread is accessing this decoration.
709 IConstAuxStore* store_nc ATLAS_THREAD_SAFE = const_cast<IConstAuxStore*> (store);
710 store_nc->lockDecoration (auxid);
711 this->clearDecorCache (auxid);
712 }
713}
void clearDecorCache(SG::auxid_t auxid)
Clear the cached decoration pointer for a single variable.

◆ setCache() [1/2]

void SG::AuxVectorData::setCache ( SG::auxid_t auxid,
const void * ptr )
protectedinherited

Explicitly set a cache pointer.

Parameters
auxidVariable ID to set.
ptrPointer to which the cache entry should be set.

For internal use; do not use from user code. This does not acquire the lock — it's mostly meant to be used from a constructor.

◆ setCache() [2/2]

void SG::AuxVectorData::setCache ( SG::auxid_t auxid,
void * ptr )
protectedinherited

Explicitly set a cache pointer.

Parameters
auxidVariable ID to set.
ptrPointer to which the cache entry should be set.

For internal use; do not use from user code. This does not acquire the lock — it's mostly meant to be used from a constructor.

◆ setNonConstStore()

void SG::AuxVectorData::setNonConstStore ( SG::IAuxStore * store)
protectedinherited

Set the store associated with this object.

Parameters
storeThe new store.

This will set both the const and non-const store pointers, and also clear the cache. This is the same as setStore() above with the same signature. It exists so that it can be called from python; pyroot would not be able to call the non-const overload of setStore due to its simplistic overload resolution.

◆ setOption() [1/8]

bool SG::AuxVectorData::setOption ( auxid_t id,
const AuxDataOption & option )
inherited

Set an option for an auxiliary data variable.

Parameters
idThe variable for which we want to set the option.
optionThe option setting to make.

The interpretation of option depends on the associated auxiliary store. See PackedParameters.h for option settings for writing packed data. Returns true on success, false otherwise.

Definition at line 150 of file AuxVectorData.cxx.

151{
152 if (id == null_auxid) return false;
153 SG::IAuxStore* store = getStore();
154 if (!store) return false;
155 return store->setOption (id, option);
156}
static const auxid_t null_auxid
To signal no aux data item.
Definition AuxTypes.h:30

◆ setOption() [2/8]

template<class T>
bool SG::AuxVectorData::setOption ( auxid_t id,
const std::string & optname,
T arg )
inherited

Set an option for an auxiliary data variable.

Parameters
idThe variable for which we want to set the option.
optnameThe name of the option to set.
argThe option value to set.

The interpretation of option depends on the associated auxiliary store. See PackedParameters.h for option settings for writing packed data. Returns true on success, false otherwise.

◆ setOption() [3/8]

bool SG::AuxVectorData::setOption ( const std::string & name,
const AuxDataOption & option )
inherited

Set an option for an auxiliary data variable.

Parameters
nameThe name of the variable.
optionThe option setting to make.

The interpretation of option depends on the associated auxiliary store. See PackedParameters.h for option settings for writing packed data. Returns true on success, false otherwise.

Definition at line 168 of file AuxVectorData.cxx.

170{
172 return setOption (id, option);
173}
SG::auxid_t findAuxID(const std::string &name, const std::string &clsname="") const
Look up a name -> auxid_t mapping.
bool setOption(auxid_t id, const AuxDataOption &option)
Set an option for an auxiliary data variable.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27

◆ setOption() [4/8]

bool SG::AuxVectorData::setOption ( const std::string & name,
const std::string & clsname,
const AuxDataOption & option )
inherited

Set an option for an auxiliary data variable.

Parameters
nameThe name of the variable.
clsnameThe name of the associated class. May be blank.
optionThe option setting to make.

The interpretation of option depends on the associated auxiliary store. See PackedParameters.h for option settings for writing packed data. Returns true on success, false otherwise.

Definition at line 186 of file AuxVectorData.cxx.

189{
190 auxid_t id = SG::AuxTypeRegistry::instance().findAuxID (name, clsname);
191 return setOption (id, option);
192}

◆ setOption() [5/8]

template<class T>
bool SG::AuxVectorData::setOption ( const std::string & name,
const std::string & clsname,
const std::string & optname,
T arg )
inherited

Set an option for an auxiliary data variable.

Parameters
nameThe name of the variable.
clsnameThe name of the associated class. May be blank.
optnameThe name of the option to set.
argThe option value to set.

The interpretation of option depends on the associated auxiliary store. See PackedParameters.h for option settings for writing packed data. Returns true on success, false otherwise.

◆ setOption() [6/8]

bool SG::AuxVectorData::setOption ( const std::string & name,
const std::string & optname,
double arg )
inherited

◆ setOption() [7/8]

bool SG::AuxVectorData::setOption ( const std::string & name,
const std::string & optname,
float arg )
inherited

◆ setOption() [8/8]

bool SG::AuxVectorData::setOption ( const std::string & name,
const std::string & optname,
int arg )
inherited

Set an option for an auxiliary data variable.

Parameters
nameThe name of the variable.
optnameThe name of the option to set.
argThe option value to set.

The interpretation of option depends on the associated auxiliary store. See PackedParameters.h for option settings for writing packed data. Returns true on success, false otherwise.

◆ setStore() [1/3]

void SG::AuxVectorData::setStore ( const DataLink< SG::IConstAuxStore > & store)
protectedinherited

Set the store associated with this object.

Parameters
storeThe new store.

This will clear the non-const store pointer, and also clear the cache.

Parameters
Thenew store.

This will clear the non-const store pointer, and also clear the cache.

Definition at line 132 of file AuxVectorData.cxx.

133{
134 m_store = 0;
135 m_constStore = 0;
137 clearCache();
138}
DataLink< SG::IConstAuxStore > m_constStoreLink
Associated store link, const.
const SG::IConstAuxStore * m_constStore
Associated store, const.

◆ setStore() [2/3]

void SG::AuxVectorData::setStore ( const SG::IConstAuxStore * store)
protectedinherited

Set the store associated with this object.

Parameters
storeThe new store.

This will clear the non-const store pointer, and also clear the cache.

Parameters
Thenew store.

This will clear the non-const store pointer, and also clear the cache.

Definition at line 100 of file AuxVectorData.cxx.

101{
102 m_store = 0;
104 m_constStoreLink.clear();
105 clearCache();
106}

◆ setStore() [3/3]

void SG::AuxVectorData::setStore ( SG::IAuxStore * store)
protectedinherited

Set the store associated with this object.

Parameters
storeThe new store.

This will set both the const and non-const store pointers, and also clear the cache.

nb. List the non-const overload before the const one; otherwise, we can't call the const one from python.

Parameters
Thenew store.

This will set both the const and non-const store pointers, and also clear the cache.

Definition at line 116 of file AuxVectorData.cxx.

117{
118 m_store = store;
120 m_constStoreLink.clear();
121 clearCache();
122}

◆ size_v()

virtual size_t SG::AuxElementData::size_v ( ) const
inlineoverridevirtual

Return the size of the container.

This is used when we need to create a new aux data vector.

Implements SG::AuxVectorData.

Definition at line 33 of file AuxElement.cxx.

33{ return 1; }

◆ swap()

void SG::AuxVectorData::swap ( AuxVectorData & other)
inherited

Swap this instance with another.

Parameters
otherThe other instance with which to swap.

Member Data Documentation

◆ ATLAS_THREAD_SAFE [1/5]

Cache m_spanCache SG::AuxVectorData::ATLAS_THREAD_SAFE
mutableprivateinherited

Cached pointers to span descriptors.

Definition at line 980 of file AuxVectorData.h.

◆ ATLAS_THREAD_SAFE [2/5]

Cache m_decorCache SG::AuxVectorData::ATLAS_THREAD_SAFE
mutableprivateinherited

Cached pointers to the start of aux data vectors, decorations.

Definition at line 977 of file AuxVectorData.h.

◆ ATLAS_THREAD_SAFE [3/5]

Cache m_constCache SG::AuxVectorData::ATLAS_THREAD_SAFE
mutableprivateinherited

Cached pointers to the start of aux data vectors, const.

Definition at line 974 of file AuxVectorData.h.

◆ ATLAS_THREAD_SAFE [4/5]

Cache m_cache SG::AuxVectorData::ATLAS_THREAD_SAFE
mutableprivateinherited

Cached pointers to the start of aux data vectors, non-const.

Definition at line 971 of file AuxVectorData.h.

◆ ATLAS_THREAD_SAFE [5/5]

size_t s_minCacheLen SG::AuxVectorData::ATLAS_THREAD_SAFE
staticprotectedinherited

Minimum length to use for the cache vector.

Only changed by unit tests.

Definition at line 600 of file AuxVectorData.h.

◆ m_constStore

const SG::IConstAuxStore* SG::AuxVectorData::m_constStore
privateinherited

Associated store, const.

Definition at line 988 of file AuxVectorData.h.

◆ m_constStoreLink

DataLink< SG::IConstAuxStore > SG::AuxVectorData::m_constStoreLink
privateinherited

Associated store link, const.

Definition at line 992 of file AuxVectorData.h.

◆ m_mutex

mutex_t SG::AuxVectorData::m_mutex
mutableprivateinherited

Definition at line 998 of file AuxVectorData.h.

◆ m_store

SG::IAuxStore* SG::AuxVectorData::m_store
privateinherited

Associated store, non-const.

Definition at line 984 of file AuxVectorData.h.

◆ s_emptySet

const SG::auxid_set_t SG::AuxVectorData::s_emptySet
staticprivateinherited

Empty auxid set, used for a return value when we have no associated store.

Definition at line 1001 of file AuxVectorData.h.


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