The Gaudi Framework  v30r4 (9b837755)
Gaudi::v2::DataHandle Class Referenceabstract

Base class to all new-style data handles. More...

#include <GaudiKernel/DataHandle.h>

Inheritance diagram for Gaudi::v2::DataHandle:

Public Types

using AccessMode = IDataHandleMetadata::AccessMode
 

Public Member Functions

 DataHandle (const DataHandle &)=delete
 
DataHandleoperator= (const DataHandle &)=delete
 
 DataHandle (DataHandle &&)=default
 
DataHandleoperator= (DataHandle &&)=delete
 
AccessMode access () const
 
const DataObjIDtargetKey () const
 (Configurable) ID of the data being accessed via this handle More...
 
void setTargetKey (const DataObjID &id)
 Change the ID of the target data. More...
 
virtual void initialize (const IDataHandleHolder &owner)=0
 Initialize the data handle. More...
 
bool ownerSetupDone () const
 Truth that owner setup has been performed. More...
 
template<typename Owner , std::enable_if_t< std::is_base_of< IDataHandleHolder, Owner >::value > * = nullptr>
void setOwner (Owner &owner)
 Setup the owner of this DataHandle. More...
 

Protected Member Functions

template<typename Owner , typename T = DataObjID, std::enable_if_t< std::is_base_of< IDataHandleHolder, Owner >::value > * = nullptr>
 DataHandle (Owner &owner, const std::string &propertyName, T &&defaultID, const std::string &docString, const IDataHandleMetadata &metadata)
 Handles are constructed like a Gaudi property (and effectively behave as one, which sets the associated data object identifier) More...
 
template<typename T = DataObjID>
 DataHandle (const std::string &propertyName, T &&defaultID, const std::string &docString, const IDataHandleMetadata &metadata)
 The above constructor is easier to use correctly, and therefore preferred. More...
 

Private Attributes

Gaudi::Property< DataHandleConfigurablem_property
 Configurable property associated with a DataHandle. More...
 
bool m_ownerSetupDone
 Truth that owner setup has been performed. More...
 

Detailed Description

Base class to all new-style data handles.

The purpose of this base class is to act as a middleman between user-facing data handle classes (which provide ways to access data in various whiteboards) and the framework (which needs to know about data dependencies and provide a way to configure them).

Definition at line 91 of file DataHandle.h.

Member Typedef Documentation

using Gaudi::v2::DataHandle::AccessMode = IDataHandleMetadata::AccessMode

Definition at line 115 of file DataHandle.h.

Constructor & Destructor Documentation

Gaudi::v2::DataHandle::DataHandle ( const DataHandle )
delete
Gaudi::v2::DataHandle::DataHandle ( DataHandle &&  )
default
template<typename Owner , typename T = DataObjID, std::enable_if_t< std::is_base_of< IDataHandleHolder, Owner >::value > * = nullptr>
Gaudi::v2::DataHandle::DataHandle ( Owner &  owner,
const std::string propertyName,
T &&  defaultID,
const std::string docString,
const IDataHandleMetadata metadata 
)
inlineprotected

Handles are constructed like a Gaudi property (and effectively behave as one, which sets the associated data object identifier)

Definition at line 175 of file DataHandle.h.

177  : m_property{&owner, propertyName, {metadata, std::forward<T>( defaultID )}, docString}
178  , m_ownerSetupDone{true}
179  {
180  }
bool m_ownerSetupDone
Truth that owner setup has been performed.
Definition: DataHandle.h:203
Gaudi::Property< DataHandleConfigurable > m_property
Configurable property associated with a DataHandle.
Definition: DataHandle.h:200
template<typename T = DataObjID>
Gaudi::v2::DataHandle::DataHandle ( const std::string propertyName,
T &&  defaultID,
const std::string docString,
const IDataHandleMetadata metadata 
)
inlineexplicitprotected

The above constructor is easier to use correctly, and therefore preferred.

But some legacy use cases may require setting a DataHandle's owner lazily after construction. In that case, this constructor must be used.

If you opt for this lazy construction method, then you must set the owner Alg or AlgTool before said owner's initialize() procedure has finished. See setOwnerImpl() for more information on this.

Definition at line 192 of file DataHandle.h.

194  : m_property{propertyName, {metadata, std::forward<T>( defaultID )}, docString}, m_ownerSetupDone{false}
195  {
196  }
bool m_ownerSetupDone
Truth that owner setup has been performed.
Definition: DataHandle.h:203
Gaudi::Property< DataHandleConfigurable > m_property
Configurable property associated with a DataHandle.
Definition: DataHandle.h:200

Member Function Documentation

AccessMode Gaudi::v2::DataHandle::access ( ) const
inline

Definition at line 116 of file DataHandle.h.

116 { return m_property.metadata().access(); }
Gaudi::Property< DataHandleConfigurable > m_property
Configurable property associated with a DataHandle.
Definition: DataHandle.h:200
virtual void Gaudi::v2::DataHandle::initialize ( const IDataHandleHolder owner)
pure virtual

Initialize the data handle.

This must be done by the owner once it has sysInitialized itself. It is the stage at which the handle performs deferred framework operations such as acquiring access to the data stores.

Implemented in Gaudi::EventDataHandle.

DataHandle& Gaudi::v2::DataHandle::operator= ( const DataHandle )
delete
DataHandle& Gaudi::v2::DataHandle::operator= ( DataHandle &&  )
delete
bool Gaudi::v2::DataHandle::ownerSetupDone ( ) const
inline

Truth that owner setup has been performed.

Subclasses of DataHandle which allow for lazy owner initialization are strongly encouraged to check if said initialization has been performed at the time where a DataHandle is used.

Definition at line 152 of file DataHandle.h.

152 { return m_ownerSetupDone; }
bool m_ownerSetupDone
Truth that owner setup has been performed.
Definition: DataHandle.h:203
template<typename Owner , std::enable_if_t< std::is_base_of< IDataHandleHolder, Owner >::value > * = nullptr>
void Gaudi::v2::DataHandle::setOwner ( Owner &  owner)
inline

Setup the owner of this DataHandle.

You should only perform this operation when you used the owner-less constructor. And you should only perform it only once. Failures to do so will be detected and result in a run-time error.

Definition at line 161 of file DataHandle.h.

162  {
163  if ( m_ownerSetupDone ) {
164  throw std::runtime_error( "Attempted to set DataHandle owner twice" );
165  }
166  m_property.setOwner( &owner );
167  m_ownerSetupDone = true;
168  }
bool m_ownerSetupDone
Truth that owner setup has been performed.
Definition: DataHandle.h:203
Gaudi::Property< DataHandleConfigurable > m_property
Configurable property associated with a DataHandle.
Definition: DataHandle.h:200
void Gaudi::v2::DataHandle::setTargetKey ( const DataObjID id)
inline

Change the ID of the target data.

Definition at line 136 of file DataHandle.h.

136 { m_property.setTargetKey( id ); }
Gaudi::Property< DataHandleConfigurable > m_property
Configurable property associated with a DataHandle.
Definition: DataHandle.h:200
const DataObjID& Gaudi::v2::DataHandle::targetKey ( ) const
inline

(Configurable) ID of the data being accessed via this handle

The current proposal is to only support one ID per handle. If experiments need to read from multiple whiteboard keys (LHCb alternate paths) or to write an object that's accessible via multiple whiteboard keys (ATLAS), they would need to implement the underlying support on their own.

For LHCb alternate paths, this can be handled at the DataLoader level (try linking from alternate paths if original one is empty), or via good old DataOnDemand for the sequential case. See https://gitlab.cern.ch/gaudi/Gaudi/merge_requests/422 .

FIXME: For aliased writes, how would that work with the Scheduler?

Definition at line 133 of file DataHandle.h.

133 { return m_property.targetKey(); }
Gaudi::Property< DataHandleConfigurable > m_property
Configurable property associated with a DataHandle.
Definition: DataHandle.h:200

Member Data Documentation

bool Gaudi::v2::DataHandle::m_ownerSetupDone
private

Truth that owner setup has been performed.

Definition at line 203 of file DataHandle.h.

Gaudi::Property<DataHandleConfigurable> Gaudi::v2::DataHandle::m_property
private

Configurable property associated with a DataHandle.

Definition at line 200 of file DataHandle.h.


The documentation for this class was generated from the following file: