ATLAS Offline Software
|
Handle class for reading a decoration on an object. More...
#include <ReadDecorHandle.h>
Public Types | |
using | Base = ReadHandle< T > |
Base class. More... | |
using | accessor_t = SG::AuxElement::ConstAccessor< D > |
Accessor type for aux data. More... | |
using | const_reference_type = typename accessor_t::const_reference_type |
Type referencing an aux data item. More... | |
using | const_container_pointer_type = typename accessor_t::const_container_pointer_type |
Pointer into the vector holding an aux data item. More... | |
using | const_span = typename accessor_t::const_span |
Span of aux data items. More... | |
Public Member Functions | |
ReadDecorHandle (const ReadDecorHandleKey< T > &key) | |
Constructor from a ReadDecorHandleKey. More... | |
ReadDecorHandle (const ReadDecorHandleKey< T > &key, const EventContext &ctx) | |
Constructor from a ReadDecorHandleKey and an explicit event context. More... | |
ReadDecorHandle (const ReadDecorHandle &rhs) | |
Copy constructor. More... | |
ReadDecorHandle (ReadDecorHandle &&rhs) | |
Move constructor. More... | |
ReadDecorHandle & | operator= (const ReadDecorHandle &rhs) |
Assignment operator. More... | |
ReadDecorHandle & | operator= (ReadDecorHandle &&rhs) |
Move operator. More... | |
bool | isPresent () const |
Is the referenced container present in SG? More... | |
const_reference_type | operator() (const AuxElement &e) const |
Fetch the variable for one element, as a const reference. More... | |
const_reference_type | withDefault (size_t index, const D &deflt) |
Fetch the variable for one element, as a const reference. More... | |
const_reference_type | withDefault (const AuxElement &e, const D &deflt) const |
Fetch the variable for one element, as a const reference. More... | |
const_reference_type | operator() (size_t index) |
Fetch the variable for one element, as a const reference. More... | |
template<class POINTER_TYPE = const_container_pointer_type, typename = std::enable_if_t<!std::is_void_v<POINTER_TYPE> >> | |
POINTER_TYPE | getDataArray () |
Get a pointer to the start of the auxiliary data array, for the referenced object. More... | |
const_span | getDataSpan () |
Get a span over the auxilary data array, for the referenced object. More... | |
bool | isAvailable () |
Test to see if this variable exists in the store, for the referenced object. More... | |
SG::auxid_t | auxid () const |
Return the aux id for this variable. More... | |
const std::string & | decorKey () const |
Return the name of the decoration alias (CONT.DECOR). More... | |
Private Member Functions | |
const SG::AuxVectorData * | vectorData (std::true_type) |
Return the referenced object as a SG::AuxVectorData . More... | |
const SG::AuxVectorData * | vectorData (std::false_type) |
Return the referenced object as a SG::AuxVectorData . More... | |
const SG::AuxVectorData * | vectorData () |
Return the referenced object as a SG::AuxVectorData . More... | |
Private Attributes | |
std::string | m_decorKey |
Name of the decoration alias. More... | |
accessor_t | m_acc |
Accessor for the aux data item. More... | |
Handle class for reading a decoration on an object.
This (and the corresponding WriteDecorHandle
class) allow the scheduler to track dependencies on decorations on objects, in addition to the objects themselves. For example, one algorithm could produce a container C, a second could read C and add a decoration to it C.d, and a third algorithm could read the decoration C.d. This allows the scheduler to know that the third algorithm must be executed after the second completes.
A ReadDecorHandle<T, D>
works just like a ReadHandle<T>
(except that using it as a property directly is not supported). In addition, it has functionality for accessing a decoration of type D
, similarly to the interface provided by Accessor
objects. You can either read the decoration from a SG::AuxElement
object:
or reference the element by its index in the container:
Example:
Implementation note: we keep track of decorations using aliases. For a container C with decoration d, the WriteDecorHandle
will make an alias C.d for C. The ReadDecorHandle
will then retrieve C.d from StoreGate. The alias C.d is also what enters into scheduling decisions.
The key() method will return the key of the container. Use decorKey() to get the name used for the decoration alias.
Definition at line 92 of file StoreGate/StoreGate/ReadDecorHandle.h.
using SG::ReadDecorHandle< T, D >::accessor_t = SG::AuxElement::ConstAccessor<D> |
Accessor type for aux data.
Definition at line 100 of file StoreGate/StoreGate/ReadDecorHandle.h.
using SG::ReadDecorHandle< T, D >::Base = ReadHandle<T> |
Base class.
Definition at line 97 of file StoreGate/StoreGate/ReadDecorHandle.h.
using SG::ReadDecorHandle< T, D >::const_container_pointer_type = typename accessor_t::const_container_pointer_type |
Pointer into the vector holding an aux data item.
Definition at line 106 of file StoreGate/StoreGate/ReadDecorHandle.h.
using SG::ReadDecorHandle< T, D >::const_reference_type = typename accessor_t::const_reference_type |
Type referencing an aux data item.
Definition at line 103 of file StoreGate/StoreGate/ReadDecorHandle.h.
using SG::ReadDecorHandle< T, D >::const_span = typename accessor_t::const_span |
Span of aux data items.
Definition at line 109 of file StoreGate/StoreGate/ReadDecorHandle.h.
|
explicit |
Constructor from a ReadDecorHandleKey.
key | The key object holding the clid/key/store/attr. |
This will raise an exception if the StoreGate key is blank, or if the event store cannot be found.
|
explicit |
Constructor from a ReadDecorHandleKey and an explicit event context.
key | The key object holding the clid/key. |
ctx | The event context. |
This will raise an exception if the StoreGate key is blank, or if the event store cannot be found.
If the default event store has been requested, then the thread-specific store from the event context will be used.
SG::ReadDecorHandle< T, D >::ReadDecorHandle | ( | const ReadDecorHandle< T, D > & | rhs | ) |
Copy constructor.
SG::ReadDecorHandle< T, D >::ReadDecorHandle | ( | ReadDecorHandle< T, D > && | rhs | ) |
Move constructor.
SG::auxid_t SG::ReadDecorHandle< T, D >::auxid | ( | ) | const |
Return the aux id for this variable.
const std::string& SG::ReadDecorHandle< T, D >::decorKey | ( | ) | const |
Return the name of the decoration alias (CONT.DECOR).
POINTER_TYPE SG::ReadDecorHandle< T, D >::getDataArray | ( | ) |
Get a pointer to the start of the auxiliary data array, for the referenced object.
const_span SG::ReadDecorHandle< T, D >::getDataSpan | ( | ) |
Get a span over the auxilary data array, for the referenced object.
bool SG::ReadDecorHandle< T, D >::isAvailable | ( | ) |
Test to see if this variable exists in the store, for the referenced object.
bool SG::ReadDecorHandle< T, D >::isPresent | ( | ) | const |
Is the referenced container present in SG?
Note that this tests for the presence of the container, not for the decoration.
Const method; the handle does not change as a result of this.
const_reference_type SG::ReadDecorHandle< T, D >::operator() | ( | const AuxElement & | e | ) | const |
Fetch the variable for one element, as a const reference.
e | The element for which to fetch the variable. |
const_reference_type SG::ReadDecorHandle< T, D >::operator() | ( | size_t | index | ) |
Fetch the variable for one element, as a const reference.
index | The index of the desired element. |
This looks up the variable in the object referenced by this handle. For a standalone object, pass an index of 0.
ReadDecorHandle& SG::ReadDecorHandle< T, D >::operator= | ( | const ReadDecorHandle< T, D > & | rhs | ) |
Assignment operator.
ReadDecorHandle& SG::ReadDecorHandle< T, D >::operator= | ( | ReadDecorHandle< T, D > && | rhs | ) |
Move operator.
|
private |
Return the referenced object as a SG::AuxVectorData
.
If T
is a container object, then this should be the object itself. But if it is a standalone object, deriving from SG::AuxElement
, then we need to call container() on the object.
|
private |
Return the referenced object as a SG::AuxVectorData
.
Specialization for the case of a container (T
does not derive from SG::AuxElement
).
|
private |
Return the referenced object as a SG::AuxVectorData
.
Specialization for the case of a standalone object (T
derives from SG::AuxElement
).
const_reference_type SG::ReadDecorHandle< T, D >::withDefault | ( | const AuxElement & | e, |
const D & | deflt | ||
) | const |
Fetch the variable for one element, as a const reference.
e | The element for which to fetch the variable. |
deflt | Default value. |
If this variable is not available, then return deflt
instead.
const_reference_type SG::ReadDecorHandle< T, D >::withDefault | ( | size_t | index, |
const D & | deflt | ||
) |
Fetch the variable for one element, as a const reference.
index | The index of the desired element. |
deflt | Default value. |
This looks up the variable in the object referenced by this handle. For a standalone object, pass an index of 0. If this variable is not available, then return deflt
instead.
|
private |
Accessor for the aux data item.
Definition at line 280 of file StoreGate/StoreGate/ReadDecorHandle.h.
|
private |
Name of the decoration alias.
Definition at line 276 of file StoreGate/StoreGate/ReadDecorHandle.h.