The Gaudi Framework  master (37c0b60a)
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 * 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::stringgetInterfaceNames () 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 34 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 86 of file DataHandleHolderBase.h.

86  {
89  }

◆ declare()

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

Definition at line 48 of file DataHandleHolderBase.h.

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

◆ extraInputDeps()

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

Definition at line 45 of file DataHandleHolderBase.h.

45 { return m_extInputDataObjs; }

◆ extraOutputDeps()

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

Definition at line 46 of file DataHandleHolderBase.h.

46 { 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 94 of file DataHandleHolderBase.h.

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

◆ inputDataObjs()

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

Definition at line 83 of file DataHandleHolderBase.h.

83 { return m_inputDataObjs; }

◆ inputHandles()

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

Definition at line 38 of file DataHandleHolderBase.h.

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

◆ outputDataObjs()

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

Definition at line 84 of file DataHandleHolderBase.h.

84 { return m_outputDataObjs; }

◆ outputHandles()

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

Definition at line 41 of file DataHandleHolderBase.h.

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

◆ renounce()

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

Definition at line 58 of file DataHandleHolderBase.h.

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

◆ renounceInput()

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

Definition at line 65 of file DataHandleHolderBase.h.

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

Member Data Documentation

◆ m_extInputDataObjs

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

Definition at line 103 of file DataHandleHolderBase.h.

◆ m_extOutputDataObjs

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

Definition at line 104 of file DataHandleHolderBase.h.

◆ m_handles

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

Definition at line 101 of file DataHandleHolderBase.h.

◆ m_inputDataObjs

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

Definition at line 98 of file DataHandleHolderBase.h.

◆ m_outputDataObjs

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

Definition at line 98 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:52
std::unordered_set::find
T find(T... args)
GaudiException
Definition: GaudiException.h:31
std::unordered_set::emplace
T emplace(T... args)
DataHandleHolderBase::m_extOutputDataObjs
Gaudi::Property< DataObjIDColl > m_extOutputDataObjs
Definition: DataHandleHolderBase.h:104
Gaudi::DataHandle::Writer
@ Writer
Definition: DataHandle.h:40
DataHandleHolderBase::m_outputDataObjs
DataObjIDColl m_outputDataObjs
Definition: DataHandleHolderBase.h:98
Gaudi::DataHandle::owner
virtual IDataHandleHolder * owner() const
Definition: DataHandle.h:53
AlgSequencer.h
h
Definition: AlgSequencer.py:31
DataHandleHolderBase::m_inputDataObjs
DataObjIDColl m_inputDataObjs
Definition: DataHandleHolderBase.h:98
std::unordered_set::erase
T erase(T... args)
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
std::unordered_set::begin
T begin(T... args)
std::unordered_set::insert
T insert(T... args)
DataHandleHolderBase::m_extInputDataObjs
Gaudi::Property< DataObjIDColl > m_extInputDataObjs
Definition: DataHandleHolderBase.h:103
Gaudi::DataHandle::Reader
@ Reader
Definition: DataHandle.h:40
std::unordered_set::end
T end(T... args)
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
DataHandleHolderBase::m_handles
std::unordered_set< Gaudi::DataHandle * > m_handles
Definition: DataHandleHolderBase.h:101