The Gaudi Framework  v40r0 (475e45c1)
DataHandleHolderBase< BASE > Class Template Reference

#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/DataHandleHolderBase.h>

Inheritance diagram for DataHandleHolderBase< BASE >:
Collaboration diagram for DataHandleHolderBase< BASE >:

Public Member Functions

std::vector< Gaudi::DataHandle * > inputHandles () const override
 
std::vector< Gaudi::DataHandle * > outputHandles () const override
 
virtual const DataObjIDCollextraInputDeps () const override
 
virtual const DataObjIDCollextraOutputDeps () const override
 
void declare (Gaudi::DataHandle &handle) override
 
void renounce (Gaudi::DataHandle &handle) override
 
bool renounceInput (const DataObjID &id) override
 
const DataObjIDCollinputDataObjs () const override
 
const DataObjIDColloutputDataObjs () const override
 
void addDependency (const DataObjID &id, const Gaudi::DataHandle::Mode &mode) override
 
- Public Member Functions inherited from extends< BASE, IDataHandleHolder >
void const * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 

Protected Member Functions

void initDataHandleHolder ()
 initializes all handles - called by the sysInitialize method of any descendant of this More...
 

Protected Attributes

DataObjIDColl m_inputDataObjs
 
DataObjIDColl m_outputDataObjs
 

Private Attributes

std::unordered_set< Gaudi::DataHandle * > m_handles
 
Gaudi::Property< DataObjIDCollm_extInputDataObjs { this, "ExtraInputs", DataObjIDColl{} }
 
Gaudi::Property< DataObjIDCollm_extOutputDataObjs { this, "ExtraOutputs", DataObjIDColl{} }
 

Additional Inherited Members

- Public Types inherited from extends< BASE, IDataHandleHolder >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 

Detailed Description

template<class BASE>
class DataHandleHolderBase< BASE >

Definition at line 33 of file DataHandleHolderBase.h.

Member Function Documentation

◆ addDependency()

template<class BASE >
void DataHandleHolderBase< BASE >::addDependency ( const DataObjID id,
const Gaudi::DataHandle::Mode mode 
)
inlineoverride

Definition at line 85 of file DataHandleHolderBase.h.

85  {
86  if ( mode & Gaudi::DataHandle::Reader ) m_inputDataObjs.emplace( id );
87  if ( mode & Gaudi::DataHandle::Writer ) m_outputDataObjs.emplace( id );
88  }

◆ declare()

template<class BASE >
void DataHandleHolderBase< BASE >::declare ( Gaudi::DataHandle handle)
inlineoverride

Definition at line 47 of file DataHandleHolderBase.h.

47  {
48  if ( !handle.owner() ) handle.setOwner( this );
49 
50  if ( handle.owner() != this ) {
51  throw GaudiException( "Attempt to declare foreign handle with algorithm!", this->name(), StatusCode::FAILURE );
52  }
53 
54  m_handles.insert( &handle );
55  }

◆ extraInputDeps()

template<class BASE >
virtual const DataObjIDColl& DataHandleHolderBase< BASE >::extraInputDeps ( ) const
inlineoverridevirtual

Definition at line 44 of file DataHandleHolderBase.h.

44 { return m_extInputDataObjs; }

◆ extraOutputDeps()

template<class BASE >
virtual const DataObjIDColl& DataHandleHolderBase< BASE >::extraOutputDeps ( ) const
inlineoverridevirtual

Definition at line 45 of file DataHandleHolderBase.h.

45 { return m_extOutputDataObjs; }

◆ initDataHandleHolder()

template<class BASE >
void DataHandleHolderBase< BASE >::initDataHandleHolder ( )
inlineprotected

initializes all handles - called by the sysInitialize method of any descendant of this

Definition at line 93 of file DataHandleHolderBase.h.

93  {
94  for ( auto h : m_handles ) h->init();
95  }

◆ inputDataObjs()

template<class BASE >
const DataObjIDColl& DataHandleHolderBase< BASE >::inputDataObjs ( ) const
inlineoverride

Definition at line 82 of file DataHandleHolderBase.h.

82 { return m_inputDataObjs; }

◆ inputHandles()

template<class BASE >
std::vector<Gaudi::DataHandle*> DataHandleHolderBase< BASE >::inputHandles ( ) const
inlineoverride

Definition at line 37 of file DataHandleHolderBase.h.

37  {
38  return handles( m_handles, Gaudi::DataHandle::Reader );
39  }

◆ outputDataObjs()

template<class BASE >
const DataObjIDColl& DataHandleHolderBase< BASE >::outputDataObjs ( ) const
inlineoverride

Definition at line 83 of file DataHandleHolderBase.h.

83 { return m_outputDataObjs; }

◆ outputHandles()

template<class BASE >
std::vector<Gaudi::DataHandle*> DataHandleHolderBase< BASE >::outputHandles ( ) const
inlineoverride

Definition at line 40 of file DataHandleHolderBase.h.

40  {
41  return handles( m_handles, Gaudi::DataHandle::Writer );
42  }

◆ renounce()

template<class BASE >
void DataHandleHolderBase< BASE >::renounce ( Gaudi::DataHandle handle)
inlineoverride

Definition at line 57 of file DataHandleHolderBase.h.

57  {
58  if ( handle.owner() != this ) {
59  throw GaudiException( "Attempt to renounce foreign handle with algorithm!", this->name(), StatusCode::FAILURE );
60  }
61  m_handles.erase( &handle );
62  }

◆ renounceInput()

template<class BASE >
bool DataHandleHolderBase< BASE >::renounceInput ( const DataObjID id)
inlineoverride

Definition at line 64 of file DataHandleHolderBase.h.

64  {
65  bool renounced = false;
66  // TODO: C++20: use std::erase_if
67  for ( auto i = m_handles.begin(), last = m_handles.end(); i != last; ) {
68  if ( ( *i )->mode() == Gaudi::DataHandle::Reader && ( *i )->fullKey() == id ) {
69  i = m_handles.erase( i );
70  renounced = true;
71  } else {
72  ++i;
73  }
74  }
75  if ( auto elm = m_inputDataObjs.find( id ); elm != m_inputDataObjs.end() ) {
76  m_inputDataObjs.erase( elm );
77  renounced = true;
78  }
79  return renounced;
80  }

Member Data Documentation

◆ m_extInputDataObjs

template<class BASE >
Gaudi::Property<DataObjIDColl> DataHandleHolderBase< BASE >::m_extInputDataObjs { this, "ExtraInputs", DataObjIDColl{} }
private

Definition at line 102 of file DataHandleHolderBase.h.

◆ m_extOutputDataObjs

template<class BASE >
Gaudi::Property<DataObjIDColl> DataHandleHolderBase< BASE >::m_extOutputDataObjs { this, "ExtraOutputs", DataObjIDColl{} }
private

Definition at line 103 of file DataHandleHolderBase.h.

◆ m_handles

template<class BASE >
std::unordered_set<Gaudi::DataHandle*> DataHandleHolderBase< BASE >::m_handles
private

Definition at line 100 of file DataHandleHolderBase.h.

◆ m_inputDataObjs

template<class BASE >
DataObjIDColl DataHandleHolderBase< BASE >::m_inputDataObjs
protected

Definition at line 97 of file DataHandleHolderBase.h.

◆ m_outputDataObjs

template<class BASE >
DataObjIDColl DataHandleHolderBase< BASE >::m_outputDataObjs
protected

Definition at line 97 of file DataHandleHolderBase.h.


The documentation for this class was generated from the following file:
Gaudi::DataHandle::setOwner
virtual void setOwner(IDataHandleHolder *o)
Definition: DataHandle.h:51
GaudiException
Definition: GaudiException.h:29
DataHandleHolderBase::m_extOutputDataObjs
Gaudi::Property< DataObjIDColl > m_extOutputDataObjs
Definition: DataHandleHolderBase.h:103
Gaudi::DataHandle::Writer
@ Writer
Definition: DataHandle.h:39
DataHandleHolderBase::m_outputDataObjs
DataObjIDColl m_outputDataObjs
Definition: DataHandleHolderBase.h:97
Gaudi::DataHandle::owner
virtual IDataHandleHolder * owner() const
Definition: DataHandle.h:52
AlgSequencer.h
h
Definition: AlgSequencer.py:31
DataHandleHolderBase::m_inputDataObjs
DataObjIDColl m_inputDataObjs
Definition: DataHandleHolderBase.h:97
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
DataHandleHolderBase::m_extInputDataObjs
Gaudi::Property< DataObjIDColl > m_extInputDataObjs
Definition: DataHandleHolderBase.h:102
Gaudi::DataHandle::Reader
@ Reader
Definition: DataHandle.h:39
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:100
DataHandleHolderBase::m_handles
std::unordered_set< Gaudi::DataHandle * > m_handles
Definition: DataHandleHolderBase.h:100