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

#include <TbbFlow.h>

Inheritance diagram for WireCellTbb::TbbFlow:
WireCell::IApplication WireCell::IConfigurable WireCell::IComponent< IApplication > WireCell::IComponent< IConfigurable > WireCell::Interface WireCell::Interface

Public Member Functions

 TbbFlow ()
 
virtual ~TbbFlow ()
 
virtual void configure (const WireCell::Configuration &config)
 Accept a configuration. More...
 
virtual WireCell::Configuration default_configuration () const
 Optional, override to return a hard-coded default configuration. More...
 
virtual void execute ()
 Implement to run something. More...
 
- Public Member Functions inherited from WireCell::IApplication
virtual ~IApplication ()
 
- Public Member Functions inherited from WireCell::IComponent< IApplication >
virtual ~IComponent ()
 
- Public Member Functions inherited from WireCell::Interface
virtual ~Interface ()
 
- Public Member Functions inherited from WireCell::IConfigurable
virtual ~IConfigurable ()
 
- Public Member Functions inherited from WireCell::IComponent< IConfigurable >
virtual ~IComponent ()
 

Private Attributes

WireCell::IDataFlowGraph::pointer m_dfp
 
WireCell::DfpGraph m_dfpgraph
 

Additional Inherited Members

- Public Types inherited from WireCell::IComponent< IApplication >
typedef std::shared_ptr< IApplicationpointer
 Access subclass facet by pointer. More...
 
typedef std::vector< pointervector
 Vector of shared pointers. More...
 
- Public Types inherited from WireCell::Interface
typedef std::shared_ptr< Interfacepointer
 
- Public Types inherited from WireCell::IComponent< IConfigurable >
typedef std::shared_ptr< IConfigurablepointer
 Access subclass facet by pointer. More...
 
typedef std::vector< pointervector
 Vector of shared pointers. More...
 

Detailed Description

Definition at line 11 of file TbbFlow.h.

Constructor & Destructor Documentation

TbbFlow::TbbFlow ( )

Definition at line 15 of file TbbFlow.cxx.

16 {
17 }
TbbFlow::~TbbFlow ( )
virtual

Definition at line 19 of file TbbFlow.cxx.

20 {
21 }

Member Function Documentation

void TbbFlow::configure ( const WireCell::Configuration config)
virtual

Accept a configuration.

Implements WireCell::IConfigurable.

Definition at line 34 of file TbbFlow.cxx.

35 {
36  std::string type, name, desc = get<std::string>(cfg, "dfp","TbbDataFlowGraph");
37  std::tie(type,name) = String::parse_pair(desc);
38  m_dfp = Factory::lookup<IDataFlowGraph>(type, name);
39 
40  m_dfpgraph.configure(cfg["graph"]);
41 
42 }
WireCell::IDataFlowGraph::pointer m_dfp
Definition: TbbFlow.h:12
static QCString name
Definition: declinfo.cpp:673
std::string string
Definition: nybbler.cc:12
void configure(const Configuration &cfg)
Definition: DfpGraph.cxx:55
std::pair< std::string, std::string > parse_pair(const std::string &in, const std::string &delim=":")
Definition: String.cxx:15
cfg
Definition: dbjson.py:29
WireCell::DfpGraph m_dfpgraph
Definition: TbbFlow.h:13
static QCString type
Definition: declinfo.cpp:672
Configuration TbbFlow::default_configuration ( ) const
virtual

Optional, override to return a hard-coded default configuration.

Reimplemented from WireCell::IConfigurable.

Definition at line 23 of file TbbFlow.cxx.

24 {
25  std::string json = R"(
26 {
27 "dfp": "TbbDataFlowGraph",
28 "graph":[]
29 }
30 )";
31  return Persist::loads(json);
32 }
std::string string
Definition: nybbler.cc:12
void TbbFlow::execute ( )
virtual

Implement to run something.

Implements WireCell::IApplication.

Definition at line 44 of file TbbFlow.cxx.

45 {
46  if (!m_dfp) {
47  std::cerr << "TbbFlow: not configured\n";
48  return;
49  }
50 
51  std::cerr << "TbbFlow::Execute\n";
52 
53  for (auto thc : m_dfpgraph.connections()) {
54  auto tail_tn = get<0>(thc);
55  auto head_tn = get<1>(thc);
56  auto conn = get<2>(thc);
57 
58  std::cerr << "TbbFlow: Connect: "
59  << tail_tn.type << ":" << tail_tn.name
60  << " ( " << conn.tail << " -> " << conn.head << " ) "
61  << head_tn.type << ":" << head_tn.name << "\n";
62 
63  INode::pointer tail_node = WireCell::Factory::lookup<INode>(tail_tn.type, tail_tn.name);
64  INode::pointer head_node = WireCell::Factory::lookup<INode>(head_tn.type, head_tn.name);
65 
66  m_dfp->connect(tail_node, head_node, conn.tail, conn.head);
67  }
68 
69 
70  m_dfp->run();
71 }
WireCell::IDataFlowGraph::pointer m_dfp
Definition: TbbFlow.h:12
std::vector< Connection > connections()
Definition: DfpGraph.cxx:32
WireCell::DfpGraph m_dfpgraph
Definition: TbbFlow.h:13
std::shared_ptr< Interface > pointer
Definition: Interface.h:16
conn
Definition: dbjson.py:16

Member Data Documentation

WireCell::IDataFlowGraph::pointer WireCellTbb::TbbFlow::m_dfp
private

Definition at line 12 of file TbbFlow.h.

WireCell::DfpGraph WireCellTbb::TbbFlow::m_dfpgraph
private

Definition at line 13 of file TbbFlow.h.


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