Public Member Functions | Private Attributes | List of all members
WireCell::Pgraph::Pgrapher Class Reference

#include <Pgrapher.h>

Inheritance diagram for WireCell::Pgraph::Pgrapher:
WireCell::IApplication WireCell::IConfigurable WireCell::IComponent< IApplication > WireCell::IComponent< IConfigurable > WireCell::Interface WireCell::Interface

Public Member Functions

 Pgrapher ()
 
virtual ~Pgrapher ()
 
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

Graph m_graph
 
Log::logptr_t l
 

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 61 of file Pgrapher.h.

Constructor & Destructor Documentation

Pgrapher::Pgrapher ( )

Definition at line 69 of file Pgrapher.cxx.

70  : l(Log::logger("pgraph"))
71 {
72 }
logptr_t logger(std::string name)
Definition: Logging.cxx:71
Pgrapher::~Pgrapher ( )
virtual

Definition at line 73 of file Pgrapher.cxx.

74 {
75 }

Member Function Documentation

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

Accept a configuration.

Implements WireCell::IConfigurable.

Definition at line 36 of file Pgrapher.cxx.

38 {
39  Pgraph::Factory fac;
40  l->debug("connecting: {} edges", cfg["edges"].size());
41  for (auto jedge : cfg["edges"]) {
42  auto tail = get_node(jedge["tail"]);
43  auto head = get_node(jedge["head"]);
44 
45  SPDLOG_LOGGER_TRACE(l,"connecting: {}", jedge);
46 
47  bool ok = m_graph.connect(fac(tail.first), fac(head.first),
48  tail.second, head.second);
49  if (!ok) {
50  l->critical("failed to connect edge: {}", jedge);
51  THROW(ValueError() << errmsg{"failed to connect edge"});
52  }
53  }
54  if (!m_graph.connected()) {
55  l->critical("graph not fully connected");
56  THROW(ValueError() << errmsg{"graph not fully connected"});
57  }
58 }
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition: Exceptions.h:54
cfg
Definition: dbjson.py:29
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:87
bool connect(Node *tail, Node *head, size_t tpind=0, size_t hpind=0)
Definition: Graph.cxx:21
#define THROW(e)
Definition: Exceptions.h:25
Thrown when a wrong value has been encountered.
Definition: Exceptions.h:37
#define SPDLOG_LOGGER_TRACE(logger,...)
Definition: spdlog.h:319
static std::pair< WireCell::INode::pointer, int > get_node(WireCell::Configuration jone)
Definition: Pgrapher.cxx:21
WireCell::Configuration Pgrapher::default_configuration ( ) const
virtual

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

Reimplemented from WireCell::IConfigurable.

Definition at line 12 of file Pgrapher.cxx.

13 {
15 
16  cfg["edges"] = Json::arrayValue;
17  return cfg;
18 }
cfg
Definition: dbjson.py:29
Json::Value Configuration
Definition: Configuration.h:50
void Pgrapher::execute ( )
virtual

Implement to run something.

Implements WireCell::IApplication.

Definition at line 62 of file Pgrapher.cxx.

63 {
64  m_graph.execute();
65 }

Member Data Documentation

Log::logptr_t WireCell::Pgraph::Pgrapher::l
private

Definition at line 75 of file Pgrapher.h.

Graph WireCell::Pgraph::Pgrapher::m_graph
private

Definition at line 74 of file Pgrapher.h.


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