Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
apps
src
NodeDumper.cxx
Go to the documentation of this file.
1
#include "
WireCellApps/NodeDumper.h
"
2
#include "
WireCellUtil/String.h
"
3
#include "
WireCellUtil/Type.h
"
4
#include "
WireCellUtil/NamedFactory.h
"
5
#include "
WireCellUtil/Configuration.h
"
6
#include "
WireCellUtil/Persist.h
"
7
#include "
WireCellIface/INode.h
"
8
#include "
WireCellUtil/Logging.h
"
9
10
WIRECELL_FACTORY
(
NodeDumper
,
WireCellApps::NodeDumper
,
11
WireCell::IApplication
,
WireCell::IConfigurable
)
12
13
14
using
spdlog
::
info
;
15
using
spdlog
::
warn
;
16
17
using namespace
std
;
18
using namespace
WireCell
;
19
using namespace
WireCellApps
;
20
21
22
NodeDumper
::
NodeDumper
()
23
: m_cfg(default_configuration())
24
{
25
}
26
27
NodeDumper::~NodeDumper()
28
{
29
}
30
31
void
NodeDumper::configure
(
const
Configuration
&
config
)
32
{
33
m_cfg
=
config
;
34
}
35
36
WireCell::Configuration
NodeDumper::default_configuration
()
const
37
{
38
Configuration
cfg
;
39
cfg[
"filename"
] =
"/dev/stdout"
;
40
cfg[
"nodes"
] = Json::arrayValue;
41
return
cfg
;
42
}
43
44
45
void
NodeDumper::execute
()
46
{
47
Configuration
all
;
48
49
int
nnodes =
m_cfg
[
"nodes"
].size();
50
std::vector<std::string>
types
;
51
if
(0 == nnodes) {
52
types = Factory::known_classes<INode>();
53
nnodes = types.size();
54
info
(
"Dumping all known node classes ({})"
, nnodes);
55
}
56
else
{
57
info
(
"Dumping: ({})"
, nnodes);
58
for
(
auto
type_cfg :
m_cfg
[
"nodes"
]) {
59
std::string
type
= convert<string>(type_cfg);
60
types.push_back(type);
61
info
(
"\t{}"
, type);
62
}
63
}
64
65
66
for
(
auto
type
: types) {
67
68
INode::pointer
node;
69
try
{
70
node = Factory::lookup<INode>(
type
);
71
}
72
catch
(
FactoryException
& fe) {
73
warn
(
"NodeDumper: failed lookup node: \"{}\""
,
type
);
74
continue
;
75
}
76
77
Configuration
one;
78
one[
"type"
] =
type
;
79
for
(
auto
intype : node->input_types()) {
80
one[
"input_types"
].
append
(
demangle
(intype));
81
}
82
for
(
auto
intype : node->output_types()) {
83
one[
"output_types"
].
append
(
demangle
(intype));
84
}
85
one[
"concurrency"
] = node->concurrency();
86
one[
"category"
] = node->category();
87
88
all.
append
(one);
89
}
90
91
Persist::dump
(get<string>(
m_cfg
,
"filename"
), all);
92
}
93
94
95
96
lar::debug::demangle
std::string demangle(T const *=nullptr)
Outputs a demangled name for type T.
Definition:
DebugUtils.h:348
spdlog::level::warn
Definition:
common.h:116
WireCell::IConfigurable
Definition:
IConfigurable.h:13
NamedFactory.h
WireCellApps::NodeDumper::configure
virtual void configure(const WireCell::Configuration &config)
Accept a configuration.
Definition:
NodeDumper.cxx:31
Type.h
Logging.h
WireCell::IApplication
Definition:
IApplication.h:12
string
std::string string
Definition:
nybbler.cc:12
INode.h
WireCellApps
Definition:
ConfigDumper.h:8
std
STL namespace.
dbjson.cfg
cfg
Definition:
dbjson.py:29
WireCellApps::NodeDumper::m_cfg
WireCell::Configuration m_cfg
Definition:
NodeDumper.h:11
spdlog
Definition:
async.h:27
config
static Config * config
Definition:
config.cpp:1054
type
Definition:
ShowerProduedPtrsHolder.hh:46
generate_datataset.info
info
Definition:
generate_datataset.py:142
WireCell::FactoryException
Definition:
NamedFactory.h:22
WireCell::Interface::pointer
std::shared_ptr< Interface > pointer
Definition:
Interface.h:16
WireCell
Definition:
Main.h:22
WireCellApps::NodeDumper
Definition:
NodeDumper.h:10
all
static QInternalList< QTextCodec > * all
Definition:
qtextcodec.cpp:63
types
static const char types[][NUM_HTML_LIST_TYPES]
Definition:
htmldocvisitor.cpp:40
Persist.h
type
static QCString type
Definition:
declinfo.cpp:672
WireCell::Configuration
Json::Value Configuration
Definition:
Configuration.h:50
WireCellApps::NodeDumper::default_configuration
virtual WireCell::Configuration default_configuration() const
Optional, override to return a hard-coded default configuration.
Definition:
NodeDumper.cxx:36
WireCellApps::NodeDumper::execute
virtual void execute()
Implement to run something.
Definition:
NodeDumper.cxx:45
Configuration.h
NodeDumper.h
dump
void dump(const IFrame::pointer frame)
Definition:
Fourdee.cxx:120
WIRECELL_FACTORY
#define WIRECELL_FACTORY(NAME, CONCRETE,...)
Definition:
NamedFactory.h:332
String.h
QCString::append
QCString & append(const char *s)
Definition:
qcstring.cpp:383
Generated by
1.8.11