Public Member Functions | Protected Attributes | List of all members
WireCell::Pgraph::Node Class Referenceabstract

#include <Node.h>

Inheritance diagram for WireCell::Pgraph::Node:
IdNode WireCell::Pgraph::PortedNode Func Nfan Njoin Sink< InputType > Sink< int > Source< OutputType > Source< int > SplitQueueBuffer WireCell::Pgraph::Function WireCell::Pgraph::Hydra WireCell::Pgraph::JoinFanin< INodeBaseType > WireCell::Pgraph::Queuedout WireCell::Pgraph::Sink WireCell::Pgraph::Source WireCell::Pgraph::SplitFanout< INodeBaseType >

Public Member Functions

 Node ()
 
virtual ~Node ()
 
virtual bool operator() ()=0
 
virtual std::string ident ()=0
 
Portiport (size_t ind=0)
 
Portoport (size_t ind=0)
 
PortListinput_ports ()
 
PortListoutput_ports ()
 
Portport (Port::Type type, size_t ind=0)
 
Portport (Port::Type type, const std::string &name)
 
bool connected ()
 

Protected Attributes

PortList m_ports [Port::ntypes]
 

Detailed Description

Definition at line 10 of file Node.h.

Constructor & Destructor Documentation

WireCell::Pgraph::Node::Node ( )
inline

Definition at line 12 of file Node.h.

12 {} // constructures may wish to resize/populate m_ports.
virtual WireCell::Pgraph::Node::~Node ( )
inlinevirtual

Definition at line 13 of file Node.h.

13 { }

Member Function Documentation

bool WireCell::Pgraph::Node::connected ( )
inline

Definition at line 52 of file Node.h.

52  {
53  for (auto& p : input_ports()) {
54  if (!p.edge()) {
55  return false;
56  }
57  }
58  for (auto& p : output_ports()) {
59  if (!p.edge()) {
60  return false;
61  }
62  }
63  return true;
64  }
PortList & input_ports()
Definition: Node.h:29
p
Definition: test.py:223
PortList & output_ports()
Definition: Node.h:32
virtual std::string WireCell::Pgraph::Node::ident ( )
pure virtual

Implemented in WireCell::Pgraph::PortedNode, and IdNode.

PortList& WireCell::Pgraph::Node::input_ports ( )
inline

Definition at line 29 of file Node.h.

29  {
30  return m_ports[Port::input];
31  }
PortList m_ports[Port::ntypes]
Definition: Node.h:68
Port& WireCell::Pgraph::Node::iport ( size_t  ind = 0)
inline

Definition at line 22 of file Node.h.

22  {
23  return port(Port::input, ind);
24  }
Port & port(Port::Type type, size_t ind=0)
Definition: Node.h:36
virtual bool WireCell::Pgraph::Node::operator() ( )
pure virtual
Port& WireCell::Pgraph::Node::oport ( size_t  ind = 0)
inline

Definition at line 25 of file Node.h.

25  {
26  return port(Port::output, ind);
27  }
Port & port(Port::Type type, size_t ind=0)
Definition: Node.h:36
PortList& WireCell::Pgraph::Node::output_ports ( )
inline

Definition at line 32 of file Node.h.

32  {
33  return m_ports[Port::output];
34  }
PortList m_ports[Port::ntypes]
Definition: Node.h:68
Port& WireCell::Pgraph::Node::port ( Port::Type  type,
size_t  ind = 0 
)
inline

Definition at line 36 of file Node.h.

36  {
37  if (ind >= m_ports[type].size()) {
38  THROW(ValueError() << errmsg{"unknown port"});
39  }
40  return m_ports[type][ind];
41  }
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition: Exceptions.h:54
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:87
#define THROW(e)
Definition: Exceptions.h:25
PortList m_ports[Port::ntypes]
Definition: Node.h:68
std::string type(const T &t)
Definition: Type.h:20
Port& WireCell::Pgraph::Node::port ( Port::Type  type,
const std::string name 
)
inline

Definition at line 42 of file Node.h.

42  {
43  for (size_t ind=0; ind<m_ports[type].size(); ++ind) {
44  if (m_ports[type][ind].name() != name) {
45  continue;
46  }
47  return port(type, ind);
48  }
49  THROW(ValueError() << errmsg{"unknown port"});
50  }
static QCString name
Definition: declinfo.cpp:673
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition: Exceptions.h:54
Port & port(Port::Type type, size_t ind=0)
Definition: Node.h:36
#define THROW(e)
Definition: Exceptions.h:25
PortList m_ports[Port::ntypes]
Definition: Node.h:68
std::string type(const T &t)
Definition: Type.h:20

Member Data Documentation

PortList WireCell::Pgraph::Node::m_ports[Port::ntypes]
protected

Definition at line 68 of file Node.h.


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