The Gaudi Framework  v30r4 (9b837755)
Gaudi::EventWriteHandle< T > Class Template Reference

Reentrant write handle for event data. More...

#include <GaudiKernel/EventDataHandle.h>

Inheritance diagram for Gaudi::EventWriteHandle< T >:
Collaboration diagram for Gaudi::EventWriteHandle< T >:

Public Member Functions

template<typename Owner >
 EventWriteHandle (Owner *owner, const std::string &propertyName, DataObjID defaultID, const std::string &docString="")
 Create a WriteHandle and set up the associated Gaudi property. More...
 
const T & put (const EventContext &ctx, T data) const
 Move data into the store. More...
 
const T & put (const EventContext &ctx, std::unique_ptr< DataObject > ptr) const
 Transfer ownership of heap-allocated data to the store. More...
 
- Public Member Functions inherited from Gaudi::EventDataHandle
void initialize (const IDataHandleHolder &owner) final override
 Initialize the data handle. More...
 
- Public Member Functions inherited from Gaudi::v2::DataHandle
 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...
 
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 Types

using AccessMode = DataHandle::AccessMode
 
- Protected Types inherited from Gaudi::EventDataHandle
using AccessMode = DataHandle::AccessMode
 

Private Member Functions

void putImpl (const EventContext &, std::unique_ptr< DataObject > &&ptr) const
 Insert a valid DataObject into the transient event store. More...
 

Additional Inherited Members

- Public Types inherited from Gaudi::v2::DataHandle
using AccessMode = IDataHandleMetadata::AccessMode
 
- Protected Member Functions inherited from Gaudi::EventDataHandle
template<typename Owner >
 EventDataHandle (Owner &owner, const std::string &propertyName, DataObjID &&defaultID, const std::string &docString, const Metadata &metadata)
 Handles are constructed like a Gaudi property (and effectively behave as one, which sets the associated data object identifier) More...
 
- Protected Member Functions inherited from Gaudi::v2::DataHandle
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...
 
- Protected Attributes inherited from Gaudi::EventDataHandle
IDataProviderSvcm_whiteBoard = nullptr
 Pointer to the whiteboard, set during initialize() More...
 
- Static Protected Attributes inherited from Gaudi::EventDataHandle
static const Metadata s_readHandleMetadata
 
static const Metadata s_writeHandleMetadata
 

Detailed Description

template<typename T>
class Gaudi::EventWriteHandle< T >

Reentrant write handle for event data.

Definition at line 112 of file EventDataHandle.h.

Member Typedef Documentation

template<typename T >
using Gaudi::EventWriteHandle< T >::AccessMode = DataHandle::AccessMode
protected

Definition at line 115 of file EventDataHandle.h.

Constructor & Destructor Documentation

template<typename T >
template<typename Owner >
Gaudi::EventWriteHandle< T >::EventWriteHandle ( Owner *  owner,
const std::string propertyName,
DataObjID  defaultID,
const std::string docString = "" 
)
inline

Create a WriteHandle and set up the associated Gaudi property.

Definition at line 120 of file EventDataHandle.h.

122  : EventDataHandle{*owner, propertyName, std::move( defaultID ), docString, s_writeHandleMetadata}
123  {
124  }
EventDataHandle(Owner &owner, const std::string &propertyName, DataObjID &&defaultID, const std::string &docString, const Metadata &metadata)
Handles are constructed like a Gaudi property (and effectively behave as one, which sets the associat...
T move(T...args)
static const Metadata s_writeHandleMetadata

Member Function Documentation

template<typename T >
const T& Gaudi::EventWriteHandle< T >::put ( const EventContext ctx,
data 
) const
inline

Move data into the store.

Definition at line 127 of file EventDataHandle.h.

128  {
129  auto ptrAndRef = HandleDetail::wrapDataObject<T>( std::move( data ) );
130  putImpl( ctx, std::move( ptrAndRef.first ) );
131  return ptrAndRef.second;
132  }
void putImpl(const EventContext &, std::unique_ptr< DataObject > &&ptr) const
Insert a valid DataObject into the transient event store.
T move(T...args)
template<typename T >
const T& Gaudi::EventWriteHandle< T >::put ( const EventContext ctx,
std::unique_ptr< DataObject ptr 
) const
inline

Transfer ownership of heap-allocated data to the store.

This is intended as a way to inject legacy non-movable DataObjects into the store. New data types should be movable and use the other overload of put. This method will eventually be removed.

Definition at line 140 of file EventDataHandle.h.

141  {
142  auto ptrAndRef = HandleDetail::wrapDataObject<T>( std::move( ptr ) );
143  putImpl( ctx, std::move( ptrAndRef.first ) );
144  return ptrAndRef.second;
145  }
void putImpl(const EventContext &, std::unique_ptr< DataObject > &&ptr) const
Insert a valid DataObject into the transient event store.
T move(T...args)
template<typename T >
void Gaudi::EventWriteHandle< T >::putImpl ( const EventContext ,
std::unique_ptr< DataObject > &&  ptr 
) const
inlineprivate

Insert a valid DataObject into the transient event store.

Definition at line 149 of file EventDataHandle.h.

150  {
151  // TODO: Introduce and use an EventContext-aware whiteboard interface
152  auto sc = m_whiteBoard->registerObject( targetKey().key(), ptr.release() );
153  if ( sc.isFailure() ) {
154  throw std::runtime_error( "Failed to write output into whiteboard" );
155  }
156  }
const DataObjID & targetKey() const
(Configurable) ID of the data being accessed via this handle
Definition: DataHandle.h:133
T release(T...args)
StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject)
Register object with the data store.
IDataProviderSvc * m_whiteBoard
Pointer to the whiteboard, set during initialize()

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