Public Member Functions | Private Attributes | List of all members
WireCellApps::NodeDumper Class Reference

#include <NodeDumper.h>

Inheritance diagram for WireCellApps::NodeDumper:
WireCell::IApplication WireCell::IConfigurable WireCell::IComponent< IApplication > WireCell::IComponent< IConfigurable > WireCell::Interface WireCell::Interface

Public Member Functions

 NodeDumper ()
 
virtual ~NodeDumper ()
 
virtual void execute ()
 Implement to run something. More...
 
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...
 
- 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::Configuration m_cfg
 

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 10 of file NodeDumper.h.

Constructor & Destructor Documentation

NodeDumper::NodeDumper ( )

Definition at line 22 of file NodeDumper.cxx.

24 {
25 }
WireCell::Configuration m_cfg
Definition: NodeDumper.h:11
virtual WireCell::Configuration default_configuration() const
Optional, override to return a hard-coded default configuration.
Definition: NodeDumper.cxx:36
NodeDumper::~NodeDumper ( )
virtual

Definition at line 27 of file NodeDumper.cxx.

28 {
29 }

Member Function Documentation

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

Accept a configuration.

Implements WireCell::IConfigurable.

Definition at line 31 of file NodeDumper.cxx.

32 {
33  m_cfg = config;
34 }
WireCell::Configuration m_cfg
Definition: NodeDumper.h:11
static Config * config
Definition: config.cpp:1054
WireCell::Configuration NodeDumper::default_configuration ( ) const
virtual

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

Reimplemented from WireCell::IConfigurable.

Definition at line 36 of file NodeDumper.cxx.

37 {
39  cfg["filename"] = "/dev/stdout";
40  cfg["nodes"] = Json::arrayValue;
41  return cfg;
42 }
cfg
Definition: dbjson.py:29
Json::Value Configuration
Definition: Configuration.h:50
void NodeDumper::execute ( )
virtual

Implement to run something.

Implements WireCell::IApplication.

Definition at line 45 of file NodeDumper.cxx.

46 {
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 }
std::string demangle(T const *=nullptr)
Outputs a demangled name for type T.
Definition: DebugUtils.h:348
std::string string
Definition: nybbler.cc:12
WireCell::Configuration m_cfg
Definition: NodeDumper.h:11
std::shared_ptr< Interface > pointer
Definition: Interface.h:16
static QInternalList< QTextCodec > * all
Definition: qtextcodec.cpp:63
static const char types[][NUM_HTML_LIST_TYPES]
static QCString type
Definition: declinfo.cpp:672
Json::Value Configuration
Definition: Configuration.h:50
void dump(const IFrame::pointer frame)
Definition: Fourdee.cxx:120
QCString & append(const char *s)
Definition: qcstring.cpp:383

Member Data Documentation

WireCell::Configuration WireCellApps::NodeDumper::m_cfg
private

Definition at line 11 of file NodeDumper.h.


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