.. index:: pair: class; ComputationalNode .. _doxid-class_computational_node: class ComputationalNode ======================= .. toctree:: :hidden: enum_ComputationalNode_NodeType.rst Overview ~~~~~~~~ Base class implementing a node in the computational graph. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class ComputationalNode { public: // enums enum :ref:`NodeType`; // fields static const static std::map<:ref:`NodeType`, std::string> :target:`nodeTypeStr` = {{:ref:`ComputationalNode::Input`, "Input"}, {ComputationalNode::Output, "Output"}, {ComputationalNode::Functional, "Functional"}}; // construction :target:`ComputationalNode`(); :ref:`ComputationalNode`(std::string id, :ref:`NodeType` type); // methods const std::string& :ref:`id`() const; :ref:`NodeType` :ref:`type`() const; virtual std::string :ref:`typeStr`() const; void :ref:`setVisited`(bool visited); bool :ref:`isVisited`() const; void :ref:`setDoCompute`(bool doCompute); virtual bool :ref:`doCompute`() const; static std::pair :ref:`parseNodeAddress`( const std::string& address, bool hasPort = true ); }; // direct descendants class :ref:`FunctionalNodeBase`; template class :ref:`InputNode`; template class :ref:`OutputNode`; .. _details-class_computational_node: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Base class implementing a node in the computational graph. Construction ------------ .. index:: pair: function; ComputationalNode .. _doxid-class_computational_node_1a668973b4f5901fa6dd59e33f354605eb: .. ref-code-block:: cpp :class: doxyrest-title-code-block ComputationalNode(std::string id, :ref:`NodeType` type) Constructor. Methods ------- .. index:: pair: function; id .. _doxid-class_computational_node_1aeab0953471cf02647c0264c8b474afb5: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::string& id() const Returns the node 'id'. .. index:: pair: function; type .. _doxid-class_computational_node_1a4cb10cde56ec02dd5e31c5b5498388ed: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`NodeType` type() const Returns the node 'type'. .. index:: pair: function; typeStr .. _doxid-class_computational_node_1a7f3ac66b0ba01255d3b4614d8451a11a: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual std::string typeStr() const Returns the node 'type' as a string. .. index:: pair: function; setVisited .. _doxid-class_computational_node_1a4d75c538b8bbc2f9c26278d27ad8a434: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setVisited(bool visited) Sets a value for the node 'visited' property, used for graph traversing. .. index:: pair: function; isVisited .. _doxid-class_computational_node_1aa657870e632df5c4ed11470d10e65d5f: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool isVisited() const Returns true if the node has been marked as visited, false otherwise. .. index:: pair: function; setDoCompute .. _doxid-class_computational_node_1a42173436871d42cf1b3142a742541b82: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setDoCompute(bool doCompute) Sets a value for the node 'doCompute' property, used in some graph execution modes. .. index:: pair: function; doCompute .. _doxid-class_computational_node_1aa48b20e4dd19b5923f47d4d4a39d19af: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual bool doCompute() const Tells if this node should be executed in this graph execution cycle, used in some graph execution modes. :ref:`ComputationalNode ` returns the value of its 'doCompute' property. Subclasses of :ref:`ComputationalNode ` can implement further logic that can override this value .. index:: pair: function; parseNodeAddress .. _doxid-class_computational_node_1aa0ee3c31cff004eb3ca6c44a21b11fc5: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::pair 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. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - 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 .. rubric:: Returns: a pair with the node and port ids parsed from 'address'