WrapperFactory.cxx
Go to the documentation of this file.
3 #include "WireCellTbb/SinkCat.h"
4 #include "WireCellTbb/JoinCat.h"
5 #include "WireCellTbb/FaninCat.h"
8 
9 using namespace WireCell;
10 using namespace WireCellTbb;
11 
12 
13 WrapperFactory::WrapperFactory(tbb::flow::graph& graph)
14  : m_graph(graph)
15 {
16  // gotta add one for each Wire Cell category
17  bind_maker<SourceNodeWrapper>(INode::sourceNode);
18  bind_maker<SinkNodeWrapper>(INode::sinkNode);
19  bind_maker<QueuedoutWrapper>(INode::queuedoutNode);
20  bind_maker<JoinWrapper>(INode::joinNode);
21  bind_maker<FaninWrapper>(INode::faninNode);
22  bind_maker<FunctionWrapper>(INode::functionNode);
23 // bind_maker<HydraWrapper>(INode::hydraNode);
24  // fixme: add more ...
25 }
26 
28 {
29  auto nit = m_nodes.find(wcnode);
30  if (nit != m_nodes.end()) {
31  return nit->second;
32  }
33 
34  auto mit = m_factory.find(wcnode->category());
35  if (mit == m_factory.end()) {
36  return nullptr;
37  }
38  auto maker = mit->second;
39 
40  Node node = (*maker)(m_graph, wcnode);
41  m_nodes[wcnode] = node;
42  return node;
43 }
def graph(desc, maker=maker)
Definition: apa.py:294
std::shared_ptr< NodeWrapper > Node
Definition: NodeWrapper.h:51
std::shared_ptr< Interface > pointer
Definition: Interface.h:16
Definition: Main.h:22
tbb::flow::graph & m_graph
Node operator()(WireCell::INode::pointer wcnode)
def maker(G, ac, typename)
Definition: apa.py:280