NodeTemplateInterface Class Reference

#include <nodetemplate.h>

Inheritance diagram for NodeTemplateInterface:

Detailed Description

A node template allows to create node system instantiations based on a set of template parameters.

Public Member Functions

MAXON_METHOD Result< BoolSupports (const NodeSystemClass &cls) const
 
MAXON_METHOD Result< NodeSystemInstantiate (const InstantiationTrace &parent, const TemplateArguments &args=GetZeroRef< TemplateArguments >()) const
 
MAXON_FUNCTION Result< NodeSystemInstantiate (const InstantiationTrace &parent, Result< TemplateArguments > &&args) const
 
MAXON_FUNCTION Result< NodeSystemInstantiate (const NodeSystemClass &cls, const AssetRepositoryRef &repo, const TemplateArguments &args=GetZeroRef< TemplateArguments >()) const
 
MAXON_METHOD Result< BoolPrivateGetConfigurations (const ValueReceiver< const TemplateArguments & > &receiver) const
 
MAXON_METHOD Result< BoolSupportsImpl (const NodeSystemClass &cls) const
 
MAXON_METHOD Result< NodeSystemInstantiateImpl (const InstantiationTrace &parent, const TemplateArguments &args) const
 
MAXON_METHOD Bool IsGroupBase () const
 
MAXON_FUNCTION Bool IsGroup () const
 
 MAXON_ATTRIBUTE_CLASS (Array< IdAndVersion >, Bases, "net.maxon.node.bases")
 
MAXON_FUNCTION Result< NodeSystemInstantiate (const NodeSystemClass &cls, const AssetRepositoryRef &repo, const DataDictionary &additionalContext, const TemplateArguments &args=GetZeroRef< TemplateArguments >()) const
 

Private Member Functions

 MAXON_INTERFACE (NodeTemplateInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.node.interface.nodetemplate", MAXON_IMPLEMENTATION_MODULE("net.maxon.nodes"))
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( NodeTemplateInterface  ,
MAXON_REFERENCE_COPY_ON_WRITE  ,
"net.maxon.node.interface.nodetemplate"  ,
MAXON_IMPLEMENTATION_MODULE("net.maxon.nodes")   
)
private

◆ Supports()

MAXON_METHOD Result<Bool> Supports ( const NodeSystemClass &  cls) const

Checks if this node template can be instantiated for the node system class cls. If true is returned, this does not necessarily mean that all possible instantiations of the template are supported, but at least some.

The default implementation of this method just forwards to NodeSystemClass::SupportsImpl. {You must not override it.}

Parameters
[in]clsThe node system class to check.
Returns
True if this node template can be instantiated for cls, false otherwise.

◆ Instantiate() [1/4]

MAXON_METHOD Result<NodeSystem> Instantiate ( const InstantiationTrace &  parent,
const TemplateArguments args = GetZeroRef< TemplateArguments >() 
) const

Instantiates this template using the given template arguments in the context of #parent.

If this template or the node system class support the instantiation in general but not for the given arguments, a NodeSystem will be returned nevertheless but with error attributes indicating the instantiation error. If the instantiation isn't supported at all, error attributes can be set too, or an error can be returned.

The implementation of this method just forwards to NodeSystemClass::InstantiateImpl. {You must not override it.}

Parameters
[in]parentThe parent instantiation context, this defines the node system class to use as well as the asset repository for asset resolution.
[in]argsArguments to parametrize the instantiation.
Returns
A new node system which is the instantiation of this template for the given arguments.

◆ Instantiate() [2/4]

MAXON_FUNCTION Result<NodeSystem> Instantiate ( const InstantiationTrace &  parent,
Result< TemplateArguments > &&  args 
) const

Instantiates this template using the given template arguments in the context of #parent.

If this template or the node system class support the instantiation in general but not for the given arguments, a NodeSystem will be returned nevertheless but with error attributes indicating the instantiation error. If the instantiation isn't supported at all, error attributes can be set too, or an error can be returned.

The implementation of this method just forwards to NodeSystemClass::InstantiateImpl. {You must not override it.}

Parameters
[in]parentThe parent instantiation context, this defines the node system class to use as well as the asset repository for asset resolution.
[in]argsArguments to parametrize the instantiation.
Returns
A new node system which is the instantiation of this template for the given arguments.

◆ Instantiate() [3/4]

MAXON_FUNCTION Result<NodeSystem> Instantiate ( const NodeSystemClass &  cls,
const AssetRepositoryRef &  repo,
const TemplateArguments args = GetZeroRef< TemplateArguments >() 
) const

Instantiates this template using the given template arguments for the node system class cls. Asset references are resolved in the scope of the asset repository #repo.

If this template or the node system class support the instantiation in general but not for the given arguments, a NodeSystem will be returned nevertheless but with error attributes indicating the instantiation error. If the instantiation isn't supported at all, error attributes can be set too, or an error can be returned.

The implementation of this function just forwards to NodeSystemClass::InstantiateImpl.

Parameters
[in]clsThe node system class to use for the instantiation.
[in]repoThe asset repository to use for asset resolution.
[in]argsArguments to parametrize the instantiation.
Returns
A new node system which is the instantiation of this template for the given arguments.

◆ PrivateGetConfigurations()

MAXON_METHOD Result<Bool> PrivateGetConfigurations ( const ValueReceiver< const TemplateArguments & > &  receiver) const

Yields all possible template parameter configurations for this template. Templates can implement this method if they have a finite number of instantiations.

Parameters
[in]receiverA callback which receives the configurations.
Returns
false if the receiver cancelled further evaluation, true otherwise.

◆ SupportsImpl()

MAXON_METHOD Result<Bool> SupportsImpl ( const NodeSystemClass &  cls) const

Checks if this node template can be instantiated for the node system class cls. If true is returned, this does not necessarily mean that all possible instantiations of the template are supported, but at least some.

This method shouldn't be invoked directly, use Supports instead. You have to implement this method to define a template-specific check, it will be called by NodeSystemClass::SupportsImpl.

Parameters
[in]clsThe node system class to check.
Returns
True if this node template can be instantiated for cls, false otherwise. @MAXON_ANNOTATION{refclass=false}

◆ InstantiateImpl()

MAXON_METHOD Result<NodeSystem> InstantiateImpl ( const InstantiationTrace &  parent,
const TemplateArguments args 
) const

Instantiates this template using the given arguments.

This method shouldn't be invoked directly, use Instantiate instead. You have to implement this method to define the template instantiation, it will be called by NodeSystemClass::InstantiateImpl.

Parameters
[in]parentThe parent instantiation context. You can reach all enclosing instantiation contexts through parent, this helps to prevent infinite recursions.
[in]argsArguments to parametrize the instantiation.
Returns
A new node system which is the instantiation of this template for the given arguments. @MAXON_ANNOTATION{refclass=false}

◆ IsGroupBase()

MAXON_METHOD Bool IsGroupBase ( ) const

@MAXON_ANNOTATION{methodId="IsGroupBase@12e73654e6d65520"->"IsGroup@12e73654e6d65520"}

Tells if this node template is a group base. Group bases may have some ports but are otherwise empty or have internal nodes only (e.g. the loop carried value template). When a group base is added in the node editor it isn't added directly but as an editable instance of the group base.

Returns
True if this node template is a group base, false otherwise.

◆ IsGroup()

MAXON_FUNCTION Bool IsGroup ( ) const

◆ MAXON_ATTRIBUTE_CLASS()

MAXON_ATTRIBUTE_CLASS ( Array< IdAndVersion ,
Bases  ,
"net.maxon.node.bases"   
)

◆ Instantiate() [4/4]

MAXON_FUNCTION Result<NodeSystem> Instantiate ( const NodeSystemClass &  cls,
const AssetRepositoryRef &  repo,
const DataDictionary &  additionalContext,
const TemplateArguments args = GetZeroRef< TemplateArguments >() 
) const

Instantiates this template using the given template arguments for the node system class cls. Asset references are resolved in the scope of the asset repository #repo.

If this template or the node system class support the instantiation in general but not for the given arguments, a NodeSystem will be returned nevertheless but with error attributes indicating the instantiation error. If the instantiation isn't supported at all, error attributes can be set too, or an error can be returned.

The implementation of this function just forwards to NodeSystemClass::InstantiateImpl.

Parameters
[in]clsThe node system class to use for the instantiation.
[in]repoThe asset repository to use for asset resolution.
[in]argsArguments to parametrize the instantiation.
[in]additionalContextSupplementary instantiation context parameters.
Returns
A new node system which is the instantiation of this template for the given arguments.