| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

DataHandleHolderVisitor.cpp
Go to the documentation of this file.
1 #include "GaudiKernel/DataHandleHolderVisitor.h"
2 #include "GaudiKernel/DataHandle.h"
3 #include "GaudiKernel/DataObjID.h"
4 #include "GaudiKernel/IDataHandleHolder.h"
5 #include <tuple>
6 #include <typeinfo>
7
8 namespace
9 {
10 using std::make_tuple;
11 }
12
13 DHHVisitor::DHHVisitor( DataObjIDColl& ido, DataObjIDColl& odo ) : m_ido( ido ), m_odo( odo ) {}
14
15 void DHHVisitor::visit( const IDataHandleHolder* v )
16 {
17 if ( !v ) {
18 return;
19 }
20
21 // Loop over inputs and outputs of handles, extra dependiencies and objects to
22 // collect all of them.
23 // Handles and extra dependencies are those of a specific algorith or tool, while
24 // the collection of data objects also contains those of the tree of tools and
25 // algorithms below it.
26
27 // Loop over input handles and output handles and store those with with non-empty keys
28 // in the container of input objects passed to us and the others in a container of those
29 // we ignore for debug purposes. To avoid multiple for loops, make some tuples and loop
30 // over those.
31 for ( auto& hs : {make_tuple( v->inputHandles(), std::ref( m_ido ), std::ref( m_ign_i ) ),
32 make_tuple( v->outputHandles(), std::ref( m_odo ), std::ref( m_ign_o ) )} ) {
33 for ( const auto& h : std::get<0>( hs ) ) {
34 if ( !h->objKey().empty() ) {
35 std::get<1>( hs ).emplace( h->fullKey() );
36 } else {
37 std::get<2>( hs ).emplace( h->fullKey() );
38 }
39 }
40 }
41
42 // The containers of handles are a different type than the on of input deps and input
43 // objects, so we need another loop here.
44 // NOTE: perhaps a view from range v3 can be used to also avoid this second loop.
45 for ( auto& hs : {make_tuple( v->extraInputDeps(), std::ref( m_ido ), std::ref( m_ign_i ) ),
46 make_tuple( v->extraOutputDeps(), std::ref( m_odo ), std::ref( m_ign_o ) ),
47 make_tuple( v->inputDataObjs(), std::ref( m_ido ), std::ref( m_ign_i ) ),
48 make_tuple( v->outputDataObjs(), std::ref( m_odo ), std::ref( m_ign_o ) )} ) {
49 for ( const auto& h : std::get<0>( hs ) ) {
50 if ( !h.key().empty() ) {
51 std::get<1>( hs ).emplace( h );
52 } else {
53 std::get<2>( hs ).emplace( h );
54 }
55 }
56 }
57 }
IDataHandleHolder.h
DHHVisitor::visit
void visit(const IDataHandleHolder *visitee) override
Definition: DataHandleHolderVisitor.cpp:15
DHHVisitor::m_ign_o
DataObjIDColl m_ign_o
Definition: DataHandleHolderVisitor.h:20
std::make_tuple
T make_tuple(T...args)
DHHVisitor::m_ign_i
DataObjIDColl m_ign_i
Definition: DataHandleHolderVisitor.h:20
DHHVisitor::m_ido
DataObjIDColl & m_ido
Definition: DataHandleHolderVisitor.h:19
IDataHandleHolder::inputHandles
virtual std::vector< Gaudi::DataHandle * > inputHandles() const =0
IDataHandleHolder::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const =0
IDataHandleHolder
Definition: IDataHandleHolder.h:14
HiveAlgSequencer.h
h
Definition: HiveAlgSequencer.py:24
IDataHandleHolder::extraOutputDeps
virtual const DataObjIDColl & extraOutputDeps() const =0
IDataHandleHolder::extraInputDeps
virtual const DataObjIDColl & extraInputDeps() const =0
IDataHandleHolder::inputDataObjs
virtual const DataObjIDColl & inputDataObjs() const =0
std::unordered_set< DataObjID, DataObjID_Hasher >
DataHandleHolderVisitor.h
DataObjID.h
std::ref
T ref(T...args)
DHHVisitor::m_odo
DataObjIDColl & m_odo
Definition: DataHandleHolderVisitor.h:19
DHHVisitor::DHHVisitor
DHHVisitor(DataObjIDColl &ido, DataObjIDColl &odo)
Definition: DataHandleHolderVisitor.cpp:13
IDataHandleHolder::outputDataObjs
virtual const DataObjIDColl & outputDataObjs() const =0
DataHandle.h