Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
util
test
test_dfpgraph.cxx
Go to the documentation of this file.
1
#include "
WireCellUtil/DfpGraph.h
"
2
#include "
WireCellUtil/Configuration.h
"
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
}
WireCell::DfpGraph
Definition:
DfpGraph.h:13
WireCell::DfpGraph::connections
std::vector< Connection > connections()
Definition:
DfpGraph.cxx:32
update_metadata.loads
loads
Definition:
update_metadata.py:26
string
std::string string
Definition:
nybbler.cc:12
WireCell::DfpGraph::configure
void configure(const Configuration &cfg)
Definition:
DfpGraph.cxx:55
DfpGraph.h
std
STL namespace.
dbjson.cfg
cfg
Definition:
dbjson.py:29
WireCell
Definition:
Main.h:22
Persist.h
main
int main()
Definition:
test_dfpgraph.cxx:9
dbjson.conn
conn
Definition:
dbjson.py:16
Configuration.h
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11