ATLAS Offline Software
|
Helper to propagate decoration dependencies to a shallow copy. More...
#include <ShallowCopyDecorDeps.h>
Public Member Functions | |
template<class OWNER > | |
ShallowCopyDecorDeps (OWNER *owner, const std::string &name, std::initializer_list< std::string > l, const std::string &doc="") | |
Auto-declaring Property constructor. More... | |
StatusCode | initialize (const SG::ReadHandleKey< T > &origKey, const SG::WriteHandleKey< T > ©Key, bool used=true) |
Initialize this property. More... | |
StatusCode | linkDecors (const SG::ReadHandleKey< T > &origKey, const EventContext &ctx=Gaudi::Hive::currentContext()) const |
Create alias for the decorations, linked to the shallow copy. More... | |
Private Attributes | |
SG::ReadHandleKeyArray< T > | m_readKeys |
Keys for the decorations on the original object. More... | |
SG::WriteHandleKeyArray< T > | m_writeKeys |
Keys for decorations to alias for the shallow copy. More... | |
Helper to propagate decoration dependencies to a shallow copy.
When we do a shallow copy of ORIG to COPY, any decorations of ORIG are readable via COPY. However, the scheduler doesn't know about this. The scheduler keeps track of decoration dependencies via aliases of the form ORIG.DECOR. If one tries to use a ReadDecorHandle for COPY.DECOR, the scheduler won't be able to resolve that dependency because that alias doesn't exist — only ORIG.DECOR.
This class will help in propagating the decoration aliases from the original object to the shallow copy. The set of decorations does need to be specified in advance.
It is assumed that you have a Gaudi component which does the shallow copy, and that the original and copy are specified by a ReadHandleKey and a WriteHandleKey, respectively.
In the definition of the component class, add a ShallowCopyDecorDeps member as a property. The value of the property should be the list of decorations to be copied:
In the initialize()
method, call initialize
on the ShallowCopyDecorDeps object, passing in the read and write handle keys for the original object and the shallow copy:
Finally, after the copy has been recorded, call linkDecors
, passing the read handle key for the original object:
Definition at line 74 of file StoreGate/StoreGate/ShallowCopyDecorDeps.h.
SG::ShallowCopyDecorDeps< T >::ShallowCopyDecorDeps | ( | OWNER * | owner, |
const std::string & | name, | ||
std::initializer_list< std::string > | l, | ||
const std::string & | doc = "" |
||
) |
StatusCode SG::ShallowCopyDecorDeps< T >::initialize | ( | const SG::ReadHandleKey< T > & | origKey, |
const SG::WriteHandleKey< T > & | copyKey, | ||
bool | used = true |
||
) |
Initialize this property.
Call this from initialize().
origKey | Key for the source of the shallow copy. |
copyKey | Key for the result of the shallow copy. |
used | If false, then this handle is not to be used. Instead of normal initialization, the keys will be cleared. |
StatusCode SG::ShallowCopyDecorDeps< T >::linkDecors | ( | const SG::ReadHandleKey< T > & | origKey, |
const EventContext & | ctx = Gaudi::Hive::currentContext() |
||
) | const |
Create alias for the decorations, linked to the shallow copy.
origKey | Key for the source of the shallow copy. |
ctx | The current EventContext. |
Call this after the shallow copy has been recorded in SG.
|
private |
Keys for the decorations on the original object.
Definition at line 116 of file StoreGate/StoreGate/ShallowCopyDecorDeps.h.
|
private |
Keys for decorations to alias for the shallow copy.
Definition at line 119 of file StoreGate/StoreGate/ShallowCopyDecorDeps.h.