ATLAS Offline Software
Public Types | Public Member Functions | Protected Attributes | List of all members
SG::AtomicConstAccessor< T, ALLOC > Class Template Reference

Access an auxiliary variable atomically. More...

#include <AtomicConstAccessor.h>

Inheritance diagram for SG::AtomicConstAccessor< T, ALLOC >:
Collaboration diagram for SG::AtomicConstAccessor< T, ALLOC >:

Public Types

using Base = ConstAccessor< T, ALLOC >
 Base class. More...
 
using const_reference_type = const std::atomic< T > &
 Type referencing an item. More...
 
using element_type = typename AuxDataTraits< T, ALLOC >::element_type
 Type the user sees. More...
 
using const_container_pointer_type = const std::atomic< T > *
 Pointer into the container holding this item. More...
 
using const_span = typename AuxDataTraits< T, AuxAllocator_t< T > >::const_span
 A span over elements in the container. More...
 

Public Member Functions

 AtomicConstAccessor (const std::string &name)
 Constructor. More...
 
 AtomicConstAccessor (const std::string &name, const std::string &clsname)
 Constructor. More...
 
 AtomicConstAccessor (const SG::auxid_t auxid)
 Constructor taking an auxid directly. More...
 
template<class ELT >
operator() (const ELT &e) const
 Fetch the variable for one element, as a const reference. More...
 
operator() (const AuxVectorData &container, size_t index) const
 Fetch the variable for one element, as a const reference. More...
 
const_container_pointer_type getDataArray (const AuxVectorData &container) const
 Get a pointer to the start of the auxiliary data array. More...
 
const_reference_type withDefault (const ELT &e, const T &deflt) const
 Fetch the variable for one element, as a const reference, with a default. More...
 
const_reference_type withDefault (const AuxVectorData &container, size_t index, const T &deflt) const
 Fetch the variable for one element, as a const reference. More...
 
const_span getDataSpan (const AuxVectorData &container) const
 Get a span over the auxilary data array. More...
 
bool isAvailable (const ELT &e) const
 Test to see if this variable exists in the store. More...
 
SG::auxid_t auxid () const
 Return the aux id for this variable. More...
 

Protected Attributes

SG::auxid_t m_auxid
 The cached auxid. More...
 

Detailed Description

template<class T, class ALLOC = AuxAllocator_t<T>>
class SG::AtomicConstAccessor< T, ALLOC >

Access an auxiliary variable atomically.

Definition at line 43 of file AtomicConstAccessor.h.

Member Typedef Documentation

◆ Base

template<class T , class ALLOC = AuxAllocator_t<T>>
using SG::AtomicConstAccessor< T, ALLOC >::Base = ConstAccessor<T, ALLOC>

Base class.

Definition at line 48 of file AtomicConstAccessor.h.

◆ const_container_pointer_type

template<class T , class ALLOC = AuxAllocator_t<T>>
using SG::AtomicConstAccessor< T, ALLOC >::const_container_pointer_type = const std::atomic<T>*

Pointer into the container holding this item.

Definition at line 57 of file AtomicConstAccessor.h.

◆ const_reference_type

template<class T , class ALLOC = AuxAllocator_t<T>>
using SG::AtomicConstAccessor< T, ALLOC >::const_reference_type = const std::atomic<T>&

Type referencing an item.

Definition at line 51 of file AtomicConstAccessor.h.

◆ const_span

using SG::ConstAccessor< T, AuxAllocator_t< T > >::const_span = typename AuxDataTraits<T, AuxAllocator_t< T > >::const_span
inherited

A span over elements in the container.

Definition at line 68 of file ConstAccessor.h.

◆ element_type

template<class T , class ALLOC = AuxAllocator_t<T>>
using SG::AtomicConstAccessor< T, ALLOC >::element_type = typename AuxDataTraits<T, ALLOC>::element_type

Type the user sees.

Definition at line 54 of file AtomicConstAccessor.h.

Constructor & Destructor Documentation

◆ AtomicConstAccessor() [1/3]

template<class T , class ALLOC = AuxAllocator_t<T>>
SG::AtomicConstAccessor< T, ALLOC >::AtomicConstAccessor ( const std::string &  name)

Constructor.

Parameters
nameName of this aux variable.

The name -> auxid lookup is done here.

◆ AtomicConstAccessor() [2/3]

template<class T , class ALLOC = AuxAllocator_t<T>>
SG::AtomicConstAccessor< T, ALLOC >::AtomicConstAccessor ( const std::string &  name,
const std::string &  clsname 
)

Constructor.

Parameters
nameName of this aux variable.
clsnameThe name of its associated class. May be blank.

The name -> auxid lookup is done here.

◆ AtomicConstAccessor() [3/3]

template<class T , class ALLOC = AuxAllocator_t<T>>
SG::AtomicConstAccessor< T, ALLOC >::AtomicConstAccessor ( const SG::auxid_t  auxid)

Constructor taking an auxid directly.

Parameters
auxidID for this auxiliary variable.

Will throw SG::ExcAuxTypeMismatch if the types don't match.

Member Function Documentation

◆ auxid()

SG::auxid_t SG::ConstAccessor< T, AuxAllocator_t< T > >::auxid ( ) const
inherited

Return the aux id for this variable.

◆ getDataArray()

template<class T , class ALLOC = AuxAllocator_t<T>>
const_container_pointer_type SG::AtomicConstAccessor< T, ALLOC >::getDataArray ( const AuxVectorData container) const

Get a pointer to the start of the auxiliary data array.

Parameters
containerThe container from which to fetch the variable.

◆ getDataSpan()

const_span SG::ConstAccessor< T, AuxAllocator_t< T > >::getDataSpan ( const AuxVectorData container) const
inherited

Get a span over the auxilary data array.

Parameters
containerThe container from which to fetch the variable.

◆ isAvailable()

bool SG::ConstAccessor< T, AuxAllocator_t< T > >::isAvailable ( const ELT &  e) const
inherited

Test to see if this variable exists in the store.

Parameters
eAn element of the container which to test the variable.

◆ operator()() [1/2]

template<class T , class ALLOC = AuxAllocator_t<T>>
T SG::AtomicConstAccessor< T, ALLOC >::operator() ( const AuxVectorData container,
size_t  index 
) const

Fetch the variable for one element, as a const reference.

Parameters
containerThe container from which to fetch the variable.
indexThe index of the desired element.

This allows retrieving aux data by container / index. Looping over the index via this method will be faster then looping over the elements of the container.

As this class can be used only read-only for basic types, return the result by value. That makes it easier to call from python.

◆ operator()() [2/2]

template<class T , class ALLOC = AuxAllocator_t<T>>
template<class ELT >
T SG::AtomicConstAccessor< T, ALLOC >::operator() ( const ELT &  e) const

Fetch the variable for one element, as a const reference.

Parameters
eThe element for which to fetch the variable.

As this class can be used only read-only for basic types, return the result by value. That makes it easier to call from python.

◆ withDefault() [1/2]

const_reference_type SG::ConstAccessor< T, AuxAllocator_t< T > >::withDefault ( const AuxVectorData container,
size_t  index,
const T &  deflt 
) const
inherited

Fetch the variable for one element, as a const reference.

Parameters
containerThe container from which to fetch the variable.
indexThe index of the desired element.
defltDefault value.

This allows retrieving aux data by container / index. Looping over the index via this method will be faster then looping over the elements of the container. If this variable is not available, then return deflt instead.

◆ withDefault() [2/2]

const_reference_type SG::ConstAccessor< T, AuxAllocator_t< T > >::withDefault ( const ELT &  e,
const T &  deflt 
) const
inherited

Fetch the variable for one element, as a const reference, with a default.

Parameters
eThe element for which to fetch the variable.
defltDefault value.

If this variable is not available, then return deflt instead.

Member Data Documentation

◆ m_auxid

SG::auxid_t SG::ConstAccessor< T, AuxAllocator_t< T > >::m_auxid
protectedinherited

The cached auxid.

Definition at line 206 of file ConstAccessor.h.


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