NodeSystemDerivationHandlerInterface Class Reference

#include <nodesystem_derivation.h>

Inheritance diagram for NodeSystemDerivationHandlerInterface:

Detailed Description

A node system derivation handler defines a set of methods to customize the attribute derivation behavior of node systems. Usually you don't have to bother about this because the default handler is sufficient. However some node templates have to specialize the default behavior for the node systems which they instantiate, for example to define a custom constant value computation.

To change the handler of a node system a node template has to call MutableRoot::SetDerivationHandler().

Public Member Functions

MAXON_METHOD Result< Opt< Data > > DeriveAttributeValue (const Block< const Port > &nesting, const DerivedAttribute &attr) const
 
MAXON_METHOD Result< BoolFilterDerivationConnection (const Port &src, const Port &dst) const
 
MAXON_METHOD Result< BoolOverrideDerivedValue (const Port &port, VALUEMODE &outMode, Data &outValue) const
 

Private Member Functions

 MAXON_INTERFACE (NodeSystemDerivationHandlerInterface, MAXON_REFERENCE_CONST, "net.maxon.node.interface.nodesystemderivationhandler")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( NodeSystemDerivationHandlerInterface  ,
MAXON_REFERENCE_CONST  ,
"net.maxon.node.interface.nodesystemderivationhandler"   
)
private

◆ DeriveAttributeValue()

MAXON_METHOD Result<Opt<Data> > DeriveAttributeValue ( const Block< const Port > &  nesting,
const DerivedAttribute &  attr 
) const

Computes the value of the derived attribute attr at the port specified by nesting. This method is called during validation of derived attributes. The default implementation just calls attr.DeriveAttributeValue(), but implementations may override this default behavior.

Parameters
[in]nestingThe last element of nesting if the port for which the attribute value shall be computed, the previous elements are its enclosing ports up to the top-level port.
[in]attrThe derived attribute whose value shall be computed.
Returns
The derived attribute value.

◆ FilterDerivationConnection()

MAXON_METHOD Result<Bool> FilterDerivationConnection ( const Port src,
const Port dst 
) const

Checks if connections from src to #dst shall be reported by PortFunctions::GetConnections when the GET_CONNECTIONS_MODE::DERIVATION_FILTER flag is set. This method is called by PortFunctions::GetConnections whenever the source port of a connection has GNODE_FLAGS::DERIVATION_FILTER_SOURCE set, the target port has GNODE_FLAGS::DERIVATION_FILTER_TARGET set and both ports belong to instantiations of the same template. Only if this method returns true the connection will be reported by PortFunctions::GetConnections. This allows to hide connections which aren't needed, for example because they transport constant values.

Parameters
[in]srcThe source port of a connection.
[in]dstThe target port of a connection.
Returns
True if the connection shall be reported by PortFunctions::GetConnections, false otherwise.

◆ OverrideDerivedValue()

MAXON_METHOD Result<Bool> OverrideDerivedValue ( const Port port,
VALUEMODE outMode,
Data outValue 
) const

Allows to override the ConstantValue and its mode on #port. This method is called during validation of the ConstantValue and related attributes, and it allows to override the ConstantValue and the VALUEMODE of any port (input or output) after regular derivation of these attributes has been done. You can implement this method for example to compute constant values for ports when their inputs are known. Default behavior returns false and doesn't affect the value and mode.

Parameters
[in]portThe port for which NodeSystemDerivationHandlerInterface can update the value.
[in,out]outModeThe original mode, update the value to force another mode.
[in,out]outValueThe original port's value, update to a new value has needed.
Returns
True if value or mode were changed.