NRP Core  1.4.1
PythonFunctionalNode Class Reference

Specialization of FunctionalNode in which _function is a python callable object. More...

#include <functional_node.h>

Inheritance diagram for PythonFunctionalNode:
FunctionalNode< tuple_array< bpy::object, 10 >::type, tuple_array< bpy::object, 10 >::type >

Public Member Functions

 PythonFunctionalNode (const std::string &id, const boost::python::list &o_ports, FunctionalNodePolicies::ExecutionPolicy policy=FunctionalNodePolicies::ExecutionPolicy::ON_NEW_INPUT)
 Constructor. More...
 
boost::python::object pySetup (boost::python::object obj)
 Setup this node with a python callable object and registers it to ComputationalGraphManager. More...
 
template<typename T_IN , size_t N = 0>
InputPort< T_IN, bpy::object > * getOrRegisterInput (const std::string &id)
 Safely get or register an input port. More...
 
template<size_t N = 0>
OutputPort< bpy::object > * registerOutput (const std::string &id)
 Safely registers an output port. More...
 
template<size_t N = 0>
OutputPort< bpy::object > * getOutput (const std::string &id)
 Safely get an output port. More...
 

Protected Member Functions

void createEdge (const std::string &port_id, Port *out_port) override
 Create an edge in the graph between this node 'port_id' input port and o_port. More...
 
void configure () override
 Configure this node. More...
 

Friends

class ComputationalGraphPythonNodes_PYTHON_FUNCTIONAL_NODE_Test
 

Detailed Description

Specialization of 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

Constructor & Destructor Documentation

◆ PythonFunctionalNode()

PythonFunctionalNode::PythonFunctionalNode ( const std::string &  id,
const boost::python::list &  o_ports,
FunctionalNodePolicies::ExecutionPolicy  policy = FunctionalNodePolicies::ExecutionPolicy::ON_NEW_INPUT 
)
inline

Constructor.

Member Function Documentation

◆ configure()

void PythonFunctionalNode::configure ( )
inlineoverrideprotected

Configure this node.

◆ createEdge()

void PythonFunctionalNode::createEdge ( const std::string &  port_id,
Port out_port 
)
inlineoverrideprotected

Create an edge in the graph between this node 'port_id' input port and o_port.

◆ getOrRegisterInput()

template<typename T_IN , size_t N = 0>
InputPort<T_IN, bpy::object>* PythonFunctionalNode::getOrRegisterInput ( const std::string &  id)
inline

Safely get or register an input port.

◆ getOutput()

template<size_t N = 0>
OutputPort<bpy::object>* PythonFunctionalNode::getOutput ( const std::string &  id)
inline

Safely get an output port.

◆ pySetup()

boost::python::object PythonFunctionalNode::pySetup ( boost::python::object  obj)
inline

Setup this node with a python callable object and registers it to 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 PythonFunctionalNode from a given Python function

◆ registerOutput()

template<size_t N = 0>
OutputPort<bpy::object>* PythonFunctionalNode::registerOutput ( const std::string &  id)
inline

Safely registers an output port.

Friends And Related Function Documentation

◆ ComputationalGraphPythonNodes_PYTHON_FUNCTIONAL_NODE_Test

friend class ComputationalGraphPythonNodes_PYTHON_FUNCTIONAL_NODE_Test
friend

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