ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
SG::ShallowCopyDecorDeps< T > Class Template Reference

Helper to propagate decoration dependencies to a shallow copy. More...

#include <ShallowCopyDecorDeps.h>

Collaboration diagram for SG::ShallowCopyDecorDeps< T >:

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 > &copyKey, 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...
 

Detailed Description

template<class T>
class SG::ShallowCopyDecorDeps< T >

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:

{ this, "DecorDeps", {"decor1", "decor2"},
"List of decorations to propagate through the shallow copy." };

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:

ATH_CHECK( m_decorDeps.initialize (m_origKey, m_copyKey) );

Finally, after the copy has been recorded, call linkDecors, passing the read handle key for the original object:

ATH_CHECK( m_decorDeps.linkDecors (m_origKey, ctx) );

Definition at line 74 of file StoreGate/StoreGate/ShallowCopyDecorDeps.h.

Constructor & Destructor Documentation

◆ ShallowCopyDecorDeps()

template<class T >
template<class OWNER >
SG::ShallowCopyDecorDeps< T >::ShallowCopyDecorDeps ( OWNER *  owner,
const std::string &  name,
std::initializer_list< std::string >  l,
const std::string &  doc = "" 
)

Auto-declaring Property constructor.

Parameters
ownerOwning component.
nameName of the Property.
lDefault list of decorations to propagate.
docDocumentation string.

Member Function Documentation

◆ initialize()

template<class T >
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().

Parameters
origKeyKey for the source of the shallow copy.
copyKeyKey for the result of the shallow copy.
usedIf false, then this handle is not to be used. Instead of normal initialization, the keys will be cleared.

◆ linkDecors()

template<class T >
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.

Parameters
origKeyKey for the source of the shallow copy.
ctxThe current EventContext.

Call this after the shallow copy has been recorded in SG.

Member Data Documentation

◆ m_readKeys

template<class T >
SG::ReadHandleKeyArray<T> SG::ShallowCopyDecorDeps< T >::m_readKeys
private

Keys for the decorations on the original object.

Definition at line 116 of file StoreGate/StoreGate/ShallowCopyDecorDeps.h.

◆ m_writeKeys

template<class T >
SG::WriteHandleKeyArray<T> SG::ShallowCopyDecorDeps< T >::m_writeKeys
private

Keys for decorations to alias for the shallow copy.

Definition at line 119 of file StoreGate/StoreGate/ShallowCopyDecorDeps.h.


The documentation for this class was generated from the following file:
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::ShallowCopyDecorDeps
Helper to propagate decoration dependencies to a shallow copy.
Definition: StoreGate/StoreGate/ShallowCopyDecorDeps.h:75