.. index:: pair: class; PythonFunctionalNode .. _doxid-class_python_functional_node: class PythonFunctionalNode ========================== .. toctree:: :hidden: Overview ~~~~~~~~ Specialization of :ref:`FunctionalNode ` in which _function is a python callable object. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class PythonFunctionalNode: public :ref:`FunctionalNode` { public: // construction :ref:`PythonFunctionalNode`( const std::string& id, const boost::python::list& o_ports, :ref:`FunctionalNodePolicies::ExecutionPolicy` policy = FunctionalNodePolicies::ExecutionPolicy::ON_NEW_INPUT ); // methods boost::python::object :ref:`pySetup`(boost::python::object obj); template :ref:`InputPort`* :ref:`getOrRegisterInput`(const std::string& id); template :ref:`OutputPort`* :ref:`registerOutput`(const std::string& id); template :ref:`OutputPort`* :ref:`getOutput`(const std::string& id); }; .. _details-class_python_functional_node: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Specialization of :ref:`FunctionalNode ` in which _function is a python callable object. _function can have a variable number of inputs and outputs between 0 and input_s/output_s Construction ------------ .. index:: pair: function; PythonFunctionalNode .. _doxid-class_python_functional_node_1a15032c7991e2d8f0d8bc022eb4e323fa: .. ref-code-block:: cpp :class: doxyrest-title-code-block PythonFunctionalNode( const std::string& id, const boost::python::list& o_ports, :ref:`FunctionalNodePolicies::ExecutionPolicy` policy = FunctionalNodePolicies::ExecutionPolicy::ON_NEW_INPUT ) Constructor. Methods ------- .. index:: pair: function; pySetup .. _doxid-class_python_functional_node_1a083f8917b190580912c9acaed2e6bc2d: .. ref-code-block:: cpp :class: doxyrest-title-code-block boost::python::object pySetup(boost::python::object obj) Setup this node with a python callable object and registers it to :ref:`ComputationalGraphManager `. After calling this function the object is moved into a shared pointer which is returned by the function. Afterwards this object shouldn't be used. Use the returned shared pointer. It is meant to be used as **call** function in a Python decorator which creates a :ref:`PythonFunctionalNode ` from a given Python function .. index:: pair: function; getOrRegisterInput .. _doxid-class_python_functional_node_1a34606236035e415d8e2018c9e15105bc: .. ref-code-block:: cpp :class: doxyrest-title-code-block template :ref:`InputPort`* getOrRegisterInput(const std::string& id) Safely get or register an input port. .. index:: pair: function; registerOutput .. _doxid-class_python_functional_node_1a0a2fd6287f10f12fa7cdcbf5b5167b94: .. ref-code-block:: cpp :class: doxyrest-title-code-block template :ref:`OutputPort`* registerOutput(const std::string& id) Safely registers an output port. .. index:: pair: function; getOutput .. _doxid-class_python_functional_node_1ac7eb61caf5b170cf919ac97efe1616d4: .. ref-code-block:: cpp :class: doxyrest-title-code-block template :ref:`OutputPort`* getOutput(const std::string& id) Safely get an output port.