SinkCat.h
Go to the documentation of this file.
1 #ifndef WIRECELLTBB_SINKCAT
2 #define WIRECELLTBB_SINKCAT
3 
6 
7 namespace WireCellTbb {
8 
9  // adapter to convert from WC sink node to TBB sink node body.
10  class SinkBody {
12  public:
13  ~SinkBody() {}
14 
16  m_wcnode = std::dynamic_pointer_cast<WireCell::ISinkNodeBase>(wcnode);
17  }
18  boost::any operator()(const boost::any& in) {
19  //bool ok = (*m_wcnode)(in);
20  (*m_wcnode)(in); // fixme: don't ignore the return code
21  return in;
22  }
23  };
24 
25  // implement facade to access ports for sink nodes
26  class SinkNodeWrapper : public NodeWrapper {
28  public:
30  m_tbbnode(new sink_node(graph, wcnode->concurrency(), SinkBody(wcnode))) { }
32  delete m_tbbnode;
33  }
35  auto ptr = dynamic_cast< receiver_type* >(m_tbbnode);
36  return receiver_port_vector{ptr};
37  }
38  };
39 }
40 #endif
WireCell::ISinkNodeBase::pointer m_wcnode
Definition: SinkCat.h:11
def graph(desc, maker=maker)
Definition: apa.py:294
virtual receiver_port_vector receiver_ports()
Definition: SinkCat.h:34
tbb::flow::function_node< boost::any > sink_node
Definition: NodeWrapper.h:29
std::shared_ptr< Interface > pointer
Definition: Interface.h:16
std::vector< receiver_type * > receiver_port_vector
Definition: NodeWrapper.h:19
boost::any operator()(const boost::any &in)
Definition: SinkCat.h:18
SinkNodeWrapper(tbb::flow::graph &graph, WireCell::INode::pointer wcnode)
Definition: SinkCat.h:29
std::shared_ptr< ISinkNodeBase > pointer
Definition: ISinkNode.h:16
const void * ptr(const T *p)
Definition: format.h:3138
SinkBody(WireCell::INode::pointer wcnode)
Definition: SinkCat.h:15
tbb::flow::receiver< boost::any > receiver_type
Definition: NodeWrapper.h:16