![]() |
ATLAS Offline Software
|
Common base class for the auxiliary store implementations. More...
#include <AuxStoreBase.h>
Classes | |
struct | Members |
Struct collecting all member variables of this base class. More... | |
Public Types | |
enum | EStructMode { EStructMode::kUndefinedStore = 0, EStructMode::kContainerStore = 1, EStructMode::kObjectStore = 2 } |
"Structural" modes of the object More... | |
Public Member Functions | |
AuxStoreBase (bool topStore=true, EStructMode mode=EStructMode::kUndefinedStore) | |
Constructor. More... | |
virtual | ~AuxStoreBase () |
Destructor. More... | |
EStructMode | structMode () const |
Get what structure mode the object was constructed with. More... | |
void | setStructMode (EStructMode mode) |
Set the structure mode of the object to a new value. More... | |
const std::string & | prefix () const |
Get the currently configured object name prefix. More... | |
virtual void | setPrefix (std::string_view prefix)=0 |
Set the object name prefix. More... | |
bool | isTopStore () const |
Check if the object is a "top store", or not. More... | |
void | setTopStore (bool value=true) |
Set whether the object should behave as a "top store" or not. More... | |
virtual void * | getData (auxid_t auxid, size_t size, size_t capacity)=0 |
Return the data vector for one aux data item. More... | |
virtual const void * | getData (SG::auxid_t auxid) const=0 |
Pick up the const version from the base class. More... | |
virtual bool | resize (size_t sz)=0 |
Change the size of all aux data vectors. More... | |
virtual void | reserve (size_t sz)=0 |
Change the capacity of all aux data vectors. More... | |
virtual void | shift (size_t pos, ptrdiff_t offs)=0 |
Shift the elements of the container. More... | |
virtual bool | insertMove (size_t pos, IAuxStore &other, const SG::auxid_set_t &ignore=SG::auxid_set_t())=0 |
Move all elements from other to this store. More... | |
virtual bool | setOption (auxid_t, const AuxDataOption &) |
Set an option for a given auxiliary variable. More... | |
virtual const IAuxTypeVector * | linkedVector (SG::auxid_t) const |
Return interface for a linked variable. More... | |
virtual void * | getDecoration (auxid_t auxid, size_t size, size_t capacity)=0 |
Return the data vector for one aux data decoration item. More... | |
Static Public Attributes | |
static constexpr bool | supportsThinning = true |
Mark that this type supports thinning operations. More... | |
Protected Types | |
using | mutex_t = AthContainers_detail::mutex |
Mutex type for multithread synchronization. More... | |
using | guard_t = AthContainers_detail::lock_guard< mutex_t > |
Guard type for multithreaded synchronisation. More... | |
Protected Member Functions | |
bool | isAuxIDSelected (SG::auxid_t auxid) const |
Check if an auxiliary variable is selected for ouput writing. More... | |
Functions needed from the derived classes | |
virtual void | reset ()=0 |
Reset all (transient) information in the object. More... | |
virtual bool | hasEntryFor (SG::auxid_t auxid) const =0 |
Check if a given variable is available from the input. More... | |
virtual StatusCode | getEntryFor (SG::auxid_t auxid)=0 |
Load a single variable from the input. More... | |
virtual bool | hasOutput () const =0 |
Check if an output is being written by the object. More... | |
virtual StatusCode | setupInputData (SG::auxid_t auxid)=0 |
Connect a variable to the input. More... | |
virtual StatusCode | setupOutputData (SG::auxid_t auxid)=0 |
Connect a variable to the output. More... | |
virtual const void * | getInputObject (SG::auxid_t auxid) const =0 |
Get a pointer to an input object, as it is in memory, for getIOData() More... | |
virtual const std::type_info * | getInputType (SG::auxid_t auxid) const =0 |
Get the type of an input object, for getIOType() More... | |
Protected Attributes | |
Members | m_data |
Member variables of the base class. More... | |
Private Attributes | |
AuxSelection | m_selection |
Object helping to select which auxiliary variables to write. More... | |
bool | m_locked = false |
Is this container locked? More... | |
mutex_t | m_mutex1 |
Mutex objects used for multithreaded synchronisation. More... | |
mutex_t | m_mutex2 |
Common base class for the auxiliary store implementations.
This class provides the common functionality for the auxiliary store implementations in xAODRootAccess. Reducing the amount of code duplication in the different classes.
Definition at line 26 of file AuxStoreBase.h.
|
protected |
Guard type for multithreaded synchronisation.
Definition at line 206 of file AuxStoreBase.h.
|
protected |
Mutex type for multithread synchronization.
Definition at line 204 of file AuxStoreBase.h.
|
strong |
"Structural" modes of the object
Enumerator | |
---|---|
kUndefinedStore | The structure mode is not defined. |
kContainerStore | The object describes an entire container. |
kObjectStore | The object describes a single object. |
Definition at line 30 of file AuxStoreBase.h.
xAOD::details::AuxStoreBase::AuxStoreBase | ( | bool | topStore = true , |
EStructMode | mode = EStructMode::kUndefinedStore |
||
) |
|
virtualdefault |
Destructor.
|
overridevirtual |
Remove the decorations added so far.
Only works for transient decorations.
Implements SG::IConstAuxStore.
Definition at line 207 of file AuxStoreBase.cxx.
|
overridevirtual |
Get the types(names) of variables handled by this container.
Implements SG::IConstAuxStore.
Definition at line 99 of file AuxStoreBase.cxx.
|
pure virtualinherited |
Return the data vector for one aux data item.
auxid | The identifier of the desired aux data item. |
size | The current size of the container (in case the data item does not already exist). |
capacity | The current capacity of the container (in case the data item does not already exist). |
Each aux data item is stored as a vector, with one entry per entry in the owning container. This returns a pointer to the start of the vector.
If the data item does not exist, it should be created and initialized to default values. size
and capacity
give the size for the new aux data item vector.
If the container is locked, throw an exception.
Implemented in SG::AuxStoreInternal, APRTest::AuxStore, RootAuxDynStore, xAOD::AuxContainerBase, xAOD::ShallowAuxContainer, xAOD::AuxInfoBase, and xAOD::ByteStreamAuxContainer_v1.
|
overridevirtual |
Get a pointer to a given array.
Implements SG::IConstAuxStore.
Definition at line 54 of file AuxStoreBase.cxx.
|
inherited |
Pick up the const version from the base class.
|
overridevirtual |
Get a pointer to a given array, creating the array if necessary.
Definition at line 299 of file AuxStoreBase.cxx.
|
pure virtualinherited |
Return the data vector for one aux data decoration item.
auxid | The identifier of the desired aux data item. |
size | The current size of the container (in case the data item does not already exist). |
capacity | The current capacity of the container (in case the data item does not already exist). |
Each aux data item is stored as a vector, with one entry per entry in the owning container. This returns a pointer to the start of the vector.
If the data item does not exist, it then it will be created and initialized with default values. If the container is locked, then the new item will be marked as a decoration. size
and capacity
give the size for the new aux data item vector.
If the data item already exists, then we return it if either the container is not locked or the item is marked as a decoration. Otherwise we throw an exception.
Implemented in xAOD::EventAuxInfo_v1, xAOD::EventInfoAuxContainer_v1, xAOD::EventAuxInfo_v2, xAOD::EventAuxInfo_v3, RootAuxDynStore, SG::AuxStoreInternal, xAOD::AuxContainerBase, xAOD::ShallowAuxContainer, xAOD::AuxInfoBase, SG::AuxStoreConstMem, and xAOD::ByteStreamAuxContainer_v1.
|
overridevirtual |
Get a pointer to a given array, creating the array if necessary.
Definition at line 109 of file AuxStoreBase.cxx.
|
overridevirtual |
Get the types(names) of decorations handled by this container.
Implements SG::IConstAuxStore.
Definition at line 104 of file AuxStoreBase.cxx.
|
overridevirtual |
Get the types(names) of variables created dynamically.
Implements SG::IAuxStoreIO.
Definition at line 608 of file AuxStoreBase.cxx.
|
protectedpure virtual |
Load a single variable from the input.
Implemented in xAOD::TAuxStore, and xAOD::RAuxStore.
|
protectedpure virtual |
Get a pointer to an input object, as it is in memory, for getIOData()
Implemented in xAOD::TAuxStore, and xAOD::RAuxStore.
|
protectedpure virtual |
Get the type of an input object, for getIOType()
Implemented in xAOD::TAuxStore, and xAOD::RAuxStore.
|
overridevirtual |
Get a pointer to the data being stored for one aux data item.
Implements SG::IAuxStoreIO.
Definition at line 510 of file AuxStoreBase.cxx.
|
overridevirtual |
Return the type of the data to be stored for one aux data item.
Implements SG::IAuxStoreIO.
Definition at line 569 of file AuxStoreBase.cxx.
|
overridevirtual |
Get the IDs of the selected aux variables.
Reimplemented from SG::IAuxStoreIO.
Definition at line 623 of file AuxStoreBase.cxx.
|
overridevirtual |
Return vector interface for one aux data item.
Implements SG::IConstAuxStore.
Definition at line 63 of file AuxStoreBase.cxx.
|
overridevirtual |
Return a set of writable data identifiers.
Implements SG::IAuxStore.
Definition at line 366 of file AuxStoreBase.cxx.
|
protectedpure virtual |
Check if a given variable is available from the input.
Implemented in xAOD::TAuxStore, and xAOD::RAuxStore.
|
protectedpure virtual |
Check if an output is being written by the object.
Implemented in xAOD::TAuxStore, and xAOD::RAuxStore.
|
pure virtualinherited |
Move all elements from other
to this store.
pos | The starting index of the insertion. |
other | Store from which to do the move. |
ignore | Set 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.
|
overridevirtual |
|
protected |
Check if an auxiliary variable is selected for ouput writing.
This is a tricky one.
The function can't just rely on getSelectedAuxIDs, as the aux ID received here may be a new ID that the object doesn't yet know about. So we have no other choice but to check this ID explicitly.
@apram auxid The auxiliary ID that should be checked
true
if the variable needs to be written out, false
if not Definition at line 639 of file AuxStoreBase.cxx.
|
overridevirtual |
Test if a variable is a decoration.
Implements SG::IConstAuxStore.
Definition at line 184 of file AuxStoreBase.cxx.
bool xAOD::details::AuxStoreBase::isTopStore | ( | ) | const |
Check if the object is a "top store", or not.
Definition at line 43 of file AuxStoreBase.cxx.
|
overridevirtual |
Return (const) interface for a linked variable.
Reimplemented from SG::IConstAuxStore.
Definition at line 272 of file AuxStoreBase.cxx.
|
overridevirtual |
Return (non-const) interface for a linked variable.
Reimplemented from SG::IAuxStore.
Definition at line 286 of file AuxStoreBase.cxx.
|
inlineinherited |
Return interface for a linked variable.
auxid | The ID of the parent variable. |
If auxid
has a linked variable, then return the IAuxTypeVector
describing it. Otherwise, return nullptr
. May return nullptr
unconditionally if this store does not support linked variables.
Definition at line 189 of file IConstAuxStore.h.
|
overridevirtual |
Lock the object, and don't let decorations be added.
Implements SG::IConstAuxStore.
Definition at line 196 of file AuxStoreBase.cxx.
|
overridevirtual |
const std::string & xAOD::details::AuxStoreBase::prefix | ( | ) | const |
Get the currently configured object name prefix.
Definition at line 38 of file AuxStoreBase.cxx.
|
pure virtualinherited |
Change the capacity of all aux data vectors.
sz | The new capacity. |
This should be called when the capacity of the container changes (by reserve
). This should change the capacity for the vectors for all aux data items.
Implemented in SG::AuxStoreInternal, xAOD::AuxContainerBase, xAOD::ShallowAuxContainer, xAOD::AuxInfoBase, and xAOD::ByteStreamAuxContainer_v1.
|
overridevirtual |
|
protectedpure virtual |
Reset all (transient) information in the object.
Implemented in xAOD::TAuxStore, and xAOD::RAuxStore.
|
pure virtualinherited |
Change the size of all aux data vectors.
sz | The new size. |
This should be called when the size of the container changes. This should resize the vectors for all aux data items.
If the size of the container grows, the new elements should be default-initialized; if it shrinks, destructors should be run as appropriate.
Should return true
if it is known that none of the data pointers changed (and thus the cache does not need to be cleared), false otherwise.
Implemented in SG::AuxStoreInternal, xAOD::AuxContainerBase, xAOD::ShallowAuxContainer, xAOD::AuxInfoBase, and xAOD::ByteStreamAuxContainer_v1.
|
overridevirtual |
|
virtual |
Select dynamic auxiliary attributes for writing.
Definition at line 616 of file AuxStoreBase.cxx.
|
inlinevirtualinherited |
Set an option for a given auxiliary variable.
auxid | The identifier of the desired aux data item. |
option | The option to set. |
The interpretation of the option depends on the particular representation of the variable.
Returns true if the option setting was successful; false otherwise.
Reimplemented in xAOD::AuxContainerBase, xAOD::AuxInfoBase, and SG::AuxStoreInternal.
Definition at line 173 of file IAuxStore.h.
|
pure virtual |
Set the object name prefix.
Implemented in xAOD::RAuxStore, and xAOD::TAuxStore.
void xAOD::details::AuxStoreBase::setStructMode | ( | EStructMode | mode | ) |
Set the structure mode of the object to a new value.
Definition at line 32 of file AuxStoreBase.cxx.
void xAOD::details::AuxStoreBase::setTopStore | ( | bool | value = true | ) |
Set whether the object should behave as a "top store" or not.
Definition at line 48 of file AuxStoreBase.cxx.
|
protectedpure virtual |
Connect a variable to the input.
Implemented in xAOD::TAuxStore, and xAOD::RAuxStore.
|
protectedpure virtual |
Connect a variable to the output.
Implemented in xAOD::TAuxStore, and xAOD::RAuxStore.
|
pure virtualinherited |
Shift the elements of the container.
pos | The starting index for the shift. |
offs | The (signed) amount of the shift. |
This operation shifts the elements in the vectors for all aux data items, to implement an insertion or deletion. offs
may be either positive or negative.
If offs
is positive, then the container is growing. The container size should be increased by offs
, the element at pos
moved to pos
+ offs
, and similarly for following elements. The elements between pos
and pos
+ offs
should be default-initialized.
If offs
is negative, then the container is shrinking. The element at pos
should be moved to pos
+ offs
, and similarly for following elements. The container should then be shrunk by -offs
elements (running destructors as appropriate).
Implemented in SG::AuxStoreInternal, xAOD::AuxContainerBase, xAOD::ShallowAuxContainer, xAOD::AuxInfoBase, and xAOD::ByteStreamAuxContainer_v1.
|
overridevirtual |
|
overridevirtual |
Return the number of elements in the store.
Implements SG::IConstAuxStore.
Definition at line 244 of file AuxStoreBase.cxx.
auto xAOD::details::AuxStoreBase::structMode | ( | ) | const |
Get what structure mode the object was constructed with.
Definition at line 27 of file AuxStoreBase.cxx.
|
protected |
Member variables of the base class.
Definition at line 201 of file AuxStoreBase.h.
|
private |
Is this container locked?
Definition at line 212 of file AuxStoreBase.h.
|
mutableprivate |
Mutex objects used for multithreaded synchronisation.
Definition at line 214 of file AuxStoreBase.h.
|
private |
Definition at line 214 of file AuxStoreBase.h.
|
private |
Object helping to select which auxiliary variables to write.
Definition at line 210 of file AuxStoreBase.h.
|
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.