class ComputationalNode¶
Overview¶
Base class implementing a node in the computational graph. More…
#include <computational_node.h> class ComputationalNode { public: // enums enum NodeType; // fields static const static std::map<NodeType, std::string> nodeTypeStr = {{ComputationalNode::Input, "Input"}, {ComputationalNode::Output, "Output"}, {ComputationalNode::Functional, "Functional"}}; // construction ComputationalNode(); ComputationalNode(std::string id, NodeType type); // methods const std::string& id() const; NodeType type() const; virtual std::string typeStr() const; void setVisited(bool visited); bool isVisited() const; void setDoCompute(bool doCompute); virtual bool doCompute() const; static std::pair<std::string, std::string> parseNodeAddress( const std::string& address, bool hasPort = true ); }; // direct descendants class FunctionalNodeBase; template <class DATA> class InputNode; template <class DATA> class OutputNode;
Detailed Documentation¶
Base class implementing a node in the computational graph.
Methods¶
const std::string& id() const
Returns the node ‘id’.
NodeType type() const
Returns the node ‘type’.
virtual std::string typeStr() const
Returns the node ‘type’ as a string.
void setVisited(bool visited)
Sets a value for the node ‘visited’ property, used for graph traversing.
bool isVisited() const
Returns true if the node has been marked as visited, false otherwise.
void setDoCompute(bool doCompute)
Sets a value for the node ‘doCompute’ property, used in some graph execution modes.
virtual bool doCompute() const
Tells if this node should be executed in this graph execution cycle, used in some graph execution modes.
ComputationalNode returns the value of its ‘doCompute’ property. Subclasses of ComputationalNode can implement further logic that can override this value
static std::pair<std::string, std::string> parseNodeAddress( const std::string& address, bool hasPort = true )
Parses a computational node address returning the node id and the port (if any) contained in the address.
Parameters:
address |
string containing a computational graph connection address with the format /node_id/port_id |
hasPort |
if the address contains a port id or just a node id |
Returns:
a pair with the node and port ids parsed from ‘address’