![]() |
ATLAS Offline Software
|
Handle class for adding a decoration to an object. More...
#include <WriteDecorHandle.h>
Public Types | |
using | Base = ReadHandle< T > |
Base class. More... | |
using | accessor_t = SG::AuxElement::Decorator< D > |
Accessor type for aux data. More... | |
using | reference_type = typename accessor_t::reference_type |
Type referencing an aux data item. More... | |
using | container_pointer_type = typename accessor_t::container_pointer_type |
Pointer into the vector holding an aux data item. More... | |
using | span = typename accessor_t::span |
Span of aux data items. More... | |
Public Member Functions | |
WriteDecorHandle (const WriteDecorHandleKey< T > &key) | |
Constructor from a WriteDecorHandleKey. More... | |
WriteDecorHandle (const WriteDecorHandleKey< T > &key, const EventContext &ctx) | |
Constructor from a ReadDecorHandleKey and an explicit event context. More... | |
WriteDecorHandle (const WriteDecorHandle &rhs) | |
Copy constructor. More... | |
WriteDecorHandle (WriteDecorHandle &&rhs) | |
Move constructor. More... | |
~WriteDecorHandle () | |
Destructor. More... | |
WriteDecorHandle & | operator= (const WriteDecorHandle &rhs) |
Assignment operator. More... | |
WriteDecorHandle & | operator= (WriteDecorHandle &&rhs) |
Move operator. More... | |
bool | isPresent () const |
Is the referenced container present in SG? More... | |
virtual StatusCode | setProxyDict (IProxyDict *store) override |
Explicitly set the event store. More... | |
reference_type | operator() (const AuxElement &e) |
Fetch the variable for one element, as a reference. More... | |
reference_type | operator() (size_t index) |
Fetch the variable for one element, as a reference. More... | |
template<class POINTER_TYPE = container_pointer_type, typename = std::enable_if_t<!std::is_void_v<POINTER_TYPE> >> | |
POINTER_TYPE | getDecorationArray () |
Get a pointer to the start of the auxiliary data array, for the referenced object. More... | |
span | getDecorationSpan () |
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... | |
Gaudi::DataHandle::Mode | mode () const |
Return the mode (read/write/update) for this handle. More... | |
std::string | decorKey () const |
Return the name of the decoration alias (CONT.DECOR). More... | |
Private Types | |
enum | { NO_ALIAS, MADE_ALIAS, RENOUNCED } |
Set no NO_ALIAS when the handle is created, changed to MADE_ALIAS after the alias has been made. More... | |
Private Member Functions | |
virtual void * | typeless_dataPointer_impl (bool quiet) override |
Retrieve an object from StoreGate. More... | |
bool | isAvailable (std::true_type) |
Test to see if this variable exists in the store, for the referenced object. More... | |
bool | isAvailable (std::false_type) |
Test to see if this variable exists in the store, for the referenced object. More... | |
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: CONT.DECOR. More... | |
accessor_t | m_acc |
Accessor for the aux data item. More... | |
enum SG::WriteDecorHandle:: { ... } | m_state |
Set no NO_ALIAS when the handle is created, changed to MADE_ALIAS after the alias has been made. More... | |
Handle class for adding a decoration to an object.
This (and the corresponding ReadDecorHandle
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 WriteDecorHandle<T, D>
works just like a ReadHandle<T>
(except that using it as a property directly is not supported). When the object is first accessed, the decoration is actually created (and a SG alias is made for the object under the C.d name). The handle also has functionality for accessing a decoration of type D
, similarly to the interface provided by Decorator
objects. You can either write the decoration from for SG::AuxElement
object:
or reference the element by its index in the container:
Example:
When the decoration handle is destroyed, the decoration will be locked (i.e., converted to an ordinary variable).
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 97 of file StoreGate/StoreGate/WriteDecorHandle.h.
using SG::WriteDecorHandle< T, D >::accessor_t = SG::AuxElement::Decorator<D> |
Accessor type for aux data.
Definition at line 105 of file StoreGate/StoreGate/WriteDecorHandle.h.
using SG::WriteDecorHandle< T, D >::Base = ReadHandle<T> |
Base class.
Definition at line 102 of file StoreGate/StoreGate/WriteDecorHandle.h.
using SG::WriteDecorHandle< T, D >::container_pointer_type = typename accessor_t::container_pointer_type |
Pointer into the vector holding an aux data item.
Definition at line 111 of file StoreGate/StoreGate/WriteDecorHandle.h.
using SG::WriteDecorHandle< T, D >::reference_type = typename accessor_t::reference_type |
Type referencing an aux data item.
Definition at line 108 of file StoreGate/StoreGate/WriteDecorHandle.h.
using SG::WriteDecorHandle< T, D >::span = typename accessor_t::span |
Span of aux data items.
Definition at line 114 of file StoreGate/StoreGate/WriteDecorHandle.h.
|
private |
Set no NO_ALIAS when the handle is created, changed to MADE_ALIAS after the alias has been made.
But if renounce() has been called on the parent key, then we set this to RENOUNCED to indicate that we shouldn't make an alias.
Enumerator | |
---|---|
NO_ALIAS | |
MADE_ALIAS | |
RENOUNCED |
Definition at line 319 of file StoreGate/StoreGate/WriteDecorHandle.h.
|
explicit |
Constructor from a WriteDecorHandleKey.
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::WriteDecorHandle< T, D >::WriteDecorHandle | ( | const WriteDecorHandle< T, D > & | rhs | ) |
Copy constructor.
SG::WriteDecorHandle< T, D >::WriteDecorHandle | ( | WriteDecorHandle< T, D > && | rhs | ) |
Move constructor.
SG::WriteDecorHandle< T, D >::~WriteDecorHandle | ( | ) |
Destructor.
This will lock the decoration.
SG::auxid_t SG::WriteDecorHandle< T, D >::auxid | ( | ) | const |
Return the aux id for this variable.
std::string SG::WriteDecorHandle< T, D >::decorKey | ( | ) | const |
Return the name of the decoration alias (CONT.DECOR).
POINTER_TYPE SG::WriteDecorHandle< T, D >::getDecorationArray | ( | ) |
Get a pointer to the start of the auxiliary data array, for the referenced object.
span SG::WriteDecorHandle< T, D >::getDecorationSpan | ( | ) |
Get a span over the auxilary data array, for the referenced object.
bool SG::WriteDecorHandle< T, D >::isAvailable | ( | ) |
Test to see if this variable exists in the store, for the referenced object.
|
private |
Test to see if this variable exists in the store, for the referenced object.
Specialization for the case of a container (T
does not derive from SG::AuxElement
).
|
private |
Test to see if this variable exists in the store, for the referenced object.
Specialization for the case of a standalone object (T
derives from SG::AuxElement
).
bool SG::WriteDecorHandle< 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.
Gaudi::DataHandle::Mode SG::WriteDecorHandle< T, D >::mode | ( | ) | const |
Return the mode (read/write/update) for this handle.
reference_type SG::WriteDecorHandle< T, D >::operator() | ( | const AuxElement & | e | ) |
Fetch the variable for one element, as a reference.
e | The element for which to fetch the variable. |
reference_type SG::WriteDecorHandle< T, D >::operator() | ( | size_t | index | ) |
Fetch the variable for one element, as a 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.
WriteDecorHandle& SG::WriteDecorHandle< T, D >::operator= | ( | const WriteDecorHandle< T, D > & | rhs | ) |
Assignment operator.
WriteDecorHandle& SG::WriteDecorHandle< T, D >::operator= | ( | WriteDecorHandle< T, D > && | rhs | ) |
Move operator.
|
overridevirtual |
Explicitly set the event store.
store | The new event store. |
This implicitly does a reset().
We need to override this so that the setting gets made on the container handle as well.
|
overrideprivatevirtual |
Retrieve an object from StoreGate.
quiet | If true, suppress failure messages. |
Extended for decoration handles: when we first retrieve the object, we make an alias for the decoration and also create the decoration itself.
|
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
).
|
private |
Accessor for the aux data item.
Definition at line 313 of file StoreGate/StoreGate/WriteDecorHandle.h.
|
private |
Name of the decoration alias: CONT.DECOR.
Definition at line 310 of file StoreGate/StoreGate/WriteDecorHandle.h.
enum { ... } SG::WriteDecorHandle< T, D >::m_state |
Set no NO_ALIAS when the handle is created, changed to MADE_ALIAS after the alias has been made.
But if renounce() has been called on the parent key, then we set this to RENOUNCED to indicate that we shouldn't make an alias.