test_dfpgraph.cxx
Go to the documentation of this file.
3 #include "WireCellUtil/Persist.h"
4 
5 #include <iostream>
6 
7 using namespace std;
8 
9 int main()
10 {
11  using namespace WireCell;
12 
13  std::string json = R"(
14 {
15 "edges":[
16  {
17  "tail": {"type":"A","name":"a"},
18  "head": {"type":"B","name":""}
19  },
20  {
21  "tail": {"type":"A","name":"a"},
22  "head": {"type":"B","name":"b"}
23  },
24  {
25  "tail": {"type":"A","name":"a","port":1},
26  "head": {"type":"B","name":"b","port":1}
27  },
28  {
29  "tail": {"type":"A","name":"a","port":2},
30  "head": {"type":"C","name":"c","port":1}
31  },
32  {
33  "tail": {"type":"A","name":"a","port":2},
34  "head": {"type":"D","name":"d","port":1}
35  },
36  {
37  "tail": {"type":"C","name":"c","port":1},
38  "head": {"type":"D","name":"d","port":2}
39  }
40 ]
41 }
42 )";
43  auto cfg = Persist::loads(json);
44 
45  DfpGraph dfp;
46  dfp.configure(cfg["edges"]);
47 
48  for (auto thc: dfp.connections()) {
49  auto tail = get<0>(thc);
50  auto head = get<1>(thc);
51  auto conn = get<2>(thc);
52  cerr << tail << " " << conn << " " << head << endl;
53  }
54 
55  return 0;
56 }
std::vector< Connection > connections()
Definition: DfpGraph.cxx:32
std::string string
Definition: nybbler.cc:12
void configure(const Configuration &cfg)
Definition: DfpGraph.cxx:55
STL namespace.
cfg
Definition: dbjson.py:29
Definition: Main.h:22
int main()
conn
Definition: dbjson.py:16
QTextStream & endl(QTextStream &s)