OperatorNode< OP, SIGNATURE > Class Template Reference

Detailed Description

template<typename OP, typename SIGNATURE>
class maxon::corenodes::OperatorNode< OP, SIGNATURE >

OperatorNode is a helper class to simplify the implementation of core nodes. It implements a core node for the function OP::Process which you have to provide. OP::Process receives a reference to the value of the single output port in its first parameter and the function arguments from the input ports in the remaining parameters, for example:

template <typename T> class ReflectNode : public OperatorNode<ReflectNode<T>, T(T, T)>
{
public:
static ResultOk<void> Process(T& out, const T& incoming, const T& normal)
{
out = incoming - normal * (T(2) * Dot(normal, incoming));
return OK;
}
};

The implemented core node consists of a single BatchMicroNode. The output port has the name "out", the input ports are named "in1", "in2", ... (or just "in" for a function with a single parameter).

The MAXON_CORENODE_FUNCTION, MAXON_CORENODE_OPERATOR_UNARY and MAXON_CORENODE_OPERATOR_BINARY macros further simplify the core node implementation if the function is already available as a C++ function or operator.

Template Parameters
OPA class with a Process function which implements the operator.
SIGNATUREThe signature of the node as a function type RESULT(IN...). RESULT is used for the type of the output port, IN... for the types of the input ports.