Functions
test_dfpgraph.cxx File Reference
#include "WireCellUtil/DfpGraph.h"
#include "WireCellUtil/Configuration.h"
#include "WireCellUtil/Persist.h"
#include <iostream>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( void  )

Definition at line 9 of file test_dfpgraph.cxx.

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
cfg
Definition: dbjson.py:29
Definition: Main.h:22
Json::Value loads(const std::string &text, const externalvars_t &extvar=externalvars_t(), const externalvars_t &extcode=externalvars_t())
Definition: Persist.cxx:152
conn
Definition: dbjson.py:16
QTextStream & endl(QTextStream &s)