Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
tbb
inc
WireCellTbb
FunctionCat.h
Go to the documentation of this file.
1
#ifndef WIRECELLTBB_FUNCTIONCAT
2
#define WIRECELLTBB_FUNCTIONCAT
3
4
#include "
WireCellIface/IFunctionNode.h
"
5
#include "
WireCellTbb/NodeWrapper.h
"
6
7
#include <iostream>
// temporary, don't ignore the error code, chump!
8
9
namespace
WireCellTbb
{
10
11
12
// Body for a TBB function node.
13
class
FunctionBody
{
14
WireCell::IFunctionNodeBase::pointer
m_wcnode
;
15
public
:
16
FunctionBody
(
WireCell::INode::pointer
wcnode) {
17
m_wcnode = std::dynamic_pointer_cast<
WireCell::IFunctionNodeBase
>(wcnode);
18
}
19
virtual
~FunctionBody
() {}
20
21
boost::any
operator()
(
const
boost::any &in)
const
{
22
boost::any ret;
23
bool
ok = (*m_wcnode)(in, ret);
// fixme: don't ignore the error code!
24
if
(!ok) {
25
std::cerr <<
"I'm ignoring the error code!\n"
;
26
}
27
return
ret;
28
}
29
30
};
31
32
// Wrap the TBB (compound) node
33
class
FunctionWrapper
:
public
NodeWrapper
{
34
tbb::flow::graph_node *
m_tbbnode
;
35
36
public
:
37
38
FunctionWrapper
(
tbb::flow::graph
&
graph
,
WireCell::INode::pointer
wcnode)
39
: m_tbbnode(new
function_node
(graph, wcnode->concurrency(),
FunctionBody
(wcnode)))
40
{
41
}
42
43
virtual
receiver_port_vector
receiver_ports
() {
44
return
{
dynamic_cast<
receiver_type
*
>
(m_tbbnode) };
45
}
46
47
virtual
sender_port_vector
sender_ports
() {
48
return
{
dynamic_cast<
sender_type
*
>
(m_tbbnode) };
49
}
50
};
51
52
53
}
54
55
#endif
WireCell::IFunctionNodeBase::pointer
std::shared_ptr< IFunctionNodeBase > pointer
Definition:
IFunctionNode.h:16
WireCellTbb::FunctionBody::operator()
boost::any operator()(const boost::any &in) const
Definition:
FunctionCat.h:21
wirecell.util.wires.apa.graph
def graph(desc, maker=maker)
Definition:
apa.py:294
WireCellTbb::FunctionWrapper::receiver_ports
virtual receiver_port_vector receiver_ports()
Definition:
FunctionCat.h:43
WireCellTbb::FunctionWrapper::sender_ports
virtual sender_port_vector sender_ports()
Definition:
FunctionCat.h:47
WireCellTbb::FunctionWrapper
Definition:
FunctionCat.h:33
WireCellTbb::FunctionBody::~FunctionBody
virtual ~FunctionBody()
Definition:
FunctionCat.h:19
WireCellTbb::FunctionBody::FunctionBody
FunctionBody(WireCell::INode::pointer wcnode)
Definition:
FunctionCat.h:16
WireCellTbb::NodeWrapper
Definition:
NodeWrapper.h:38
WireCellTbb::FunctionWrapper::m_tbbnode
tbb::flow::graph_node * m_tbbnode
Definition:
FunctionCat.h:34
WireCell::Interface::pointer
std::shared_ptr< Interface > pointer
Definition:
Interface.h:16
WireCellTbb::receiver_port_vector
std::vector< receiver_type * > receiver_port_vector
Definition:
NodeWrapper.h:19
WireCell::IFunctionNodeBase
Definition:
IFunctionNode.h:13
WireCellTbb::sender_type
tbb::flow::sender< boost::any > sender_type
Definition:
NodeWrapper.h:15
WireCellTbb
Definition:
DataFlowGraph.h:14
WireCellTbb::FunctionBody::m_wcnode
WireCell::IFunctionNodeBase::pointer m_wcnode
Definition:
FunctionCat.h:14
IFunctionNode.h
WireCellTbb::FunctionBody
Definition:
FunctionCat.h:13
WireCellTbb::FunctionWrapper::FunctionWrapper
FunctionWrapper(tbb::flow::graph &graph, WireCell::INode::pointer wcnode)
Definition:
FunctionCat.h:38
WireCellTbb::sender_port_vector
std::vector< sender_type * > sender_port_vector
Definition:
NodeWrapper.h:18
NodeWrapper.h
WireCellTbb::function_node
tbb::flow::function_node< boost::any, boost::any > function_node
Definition:
NodeWrapper.h:30
WireCellTbb::receiver_type
tbb::flow::receiver< boost::any > receiver_type
Definition:
NodeWrapper.h:16
Generated by
1.8.11