Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
WireCellTbb::WrapperFactory Class Reference

#include <WrapperFactory.h>

Public Types

typedef std::map< WireCell::INode::pointer, NodeWCNode2Wrapper
 

Public Member Functions

 WrapperFactory (tbb::flow::graph &graph)
 
template<class Wrapper >
void bind_maker (WireCell::INode::NodeCategory cat)
 
Node operator() (WireCell::INode::pointer wcnode)
 
WCNode2Wrapperseen ()
 

Private Types

typedef std::map< WireCell::INode::NodeCategory, WrapperMaker * > NodeMakers
 

Private Attributes

tbb::flow::graph & m_graph
 
NodeMakers m_factory
 
WCNode2Wrapper m_nodes
 

Detailed Description

Definition at line 22 of file WrapperFactory.h.

Member Typedef Documentation

Definition at line 36 of file WrapperFactory.h.

Definition at line 33 of file WrapperFactory.h.

Constructor & Destructor Documentation

WrapperFactory::WrapperFactory ( tbb::flow::graph &  graph)

Definition at line 13 of file WrapperFactory.cxx.

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 }
def graph(desc, maker=maker)
Definition: apa.py:294
tbb::flow::graph & m_graph

Member Function Documentation

template<class Wrapper >
void WireCellTbb::WrapperFactory::bind_maker ( WireCell::INode::NodeCategory  cat)
inline

Definition at line 27 of file WrapperFactory.h.

27  {
28  m_factory[cat] = new WrapperMakerT<Wrapper>;
29  }
Node WrapperFactory::operator() ( WireCell::INode::pointer  wcnode)

Definition at line 27 of file WrapperFactory.cxx.

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 }
std::shared_ptr< NodeWrapper > Node
Definition: NodeWrapper.h:51
tbb::flow::graph & m_graph
def maker(G, ac, typename)
Definition: apa.py:280
WCNode2Wrapper& WireCellTbb::WrapperFactory::seen ( )
inline

Definition at line 34 of file WrapperFactory.h.

34 { return m_nodes; }

Member Data Documentation

NodeMakers WireCellTbb::WrapperFactory::m_factory
private

Definition at line 39 of file WrapperFactory.h.

tbb::flow::graph& WireCellTbb::WrapperFactory::m_graph
private

Definition at line 38 of file WrapperFactory.h.

WCNode2Wrapper WireCellTbb::WrapperFactory::m_nodes
private

Definition at line 40 of file WrapperFactory.h.


The documentation for this class was generated from the following files: