#include <nodeslib.h>
NodesLib provides a set of static methods for the creation and management of node systems.
Classes | |
struct | Variant |
Public Types | |
using | InstantiateDelegate = Delegate< Result< MutableRoot >(const InstantiationTrace &parent, const TemplateArguments &args, const NodeTemplate &self)> |
using | VariantTreeMap = TreeMap< Id, Variant, ArrayMapSelector< false > > |
Static Public Member Functions | |
static MAXON_METHOD Result< NodeSystemBasedNodeTemplate > | CreateTemplateFromNodeSystem (const NodeSystem &templ, const AssetRepositoryRef &lookup) |
static MAXON_METHOD Result< NodeTemplate > | LoadTemplate (const AssetRepositoryRef &repo, const Id &assetId) |
static MAXON_METHOD Result< NodeTemplate > | LoadBuiltinTemplate (const Id &assetId) |
static MAXON_METHOD Result< NodeTemplate > | CreateTemplateWithInstantiationCache (const NodeTemplate &templ) |
static MAXON_METHOD Result< NodeTemplate > | CreateLazyTemplate (const Id &nodeId, Delegate< Result< NodeTemplate >()> &&creator, Delegate< Result< Bool >(const NodeSystemClass &cls)> &&support={}) |
static MAXON_FUNCTION Result< NodeTemplate > | CreateLazyTemplate (const Id &nodeId, Delegate< Result< NodeTemplate >()> &&creator, const ComponentDescriptor &support) |
static MAXON_FUNCTION Result< NodeTemplate > | CreateLazyTemplate (const Id &nodeId, Delegate< Result< NodeTemplate >()> &&creator, const NodeSystemClass &support) |
static MAXON_METHOD Result< NodeTemplate > | CreateTemplateFromDelegate (const Id &nodeId, Bool cache, InstantiateDelegate &&instantiate, Delegate< Result< Bool >(const NodeSystemClass &cls)> &&support={}) |
static MAXON_FUNCTION Result< NodeTemplate > | CreateTemplateFromDelegate (const Id &nodeId, Bool cache, InstantiateDelegate &&instantiate, const ComponentDescriptor &support) |
static MAXON_FUNCTION Result< NodeTemplate > | CreateTemplateFromDelegate (const Id &nodeId, Bool cache, InstantiateDelegate &&instantiate, const NodeSystemClass &support) |
static MAXON_METHOD Result< NodeTemplate > | CreateVariantTemplate (VariantTreeMap &&variants) |
static MAXON_METHOD Result< NodeSystemBasedNodeTemplate > | BuildNodeFromDescription (const Id &id, const NodeSystemClass &nodeClass, Bool addDependencies=true, const Delegate< Result< void >(const MutableRoot &root, const TemplateArguments &args)> &finalizer={}) |
static MAXON_METHOD Result< DescriptionProcessor > | CreateNodeDescriptionProcessor (Delegate< Result< NodeTemplate >(const Id &descriptionId, const DataDescription &dataDescription)> &&delegate) |
static MAXON_METHOD Result< DescriptionProcessor > | CreateNodeDescriptionProcessorEx (Delegate< Result< NodeTemplate >(const Id &descriptionId, const DataDescriptionDefinition &dataDef, const DataDescription &dataDescription)> &&delegate) |
static MAXON_METHOD Result< Bool > | AssetSupports (const AssetDescription &nodeAsset, const NodeSystemClass &cls) |
static MAXON_METHOD Result< ChangeList > | CreateChangeList () |
static MAXON_METHOD Result< AssetDescription > | StoreAsset (const AssetRepositoryRef &repository, const Id &assetId, const NodeSystemData &data) |
static MAXON_METHOD String | PrivateGNodeToString (const GNodeBase &node, const FormatStatement *fs) |
static MAXON_METHOD Result< Id > | MakePortUuid (const Char *prefix) |
static MAXON_METHOD Result< Id > | MakePortUuid (PORT_DIR dir) |
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL (NodesLib, MAXON_REFERENCE_NONE, "net.maxon.node.interface.nodeslib") | |
using InstantiateDelegate = Delegate<Result<MutableRoot>(const InstantiationTrace& parent, const TemplateArguments& args, const NodeTemplate& self)> |
The Delegate type to use for CreateTemplateFromDelegate. This is used to implement NodeTemplateInterface::InstantiateImpl.
[in] | parent | The parent instantiation context, this defines the node system class to use as well as the asset repository for asset resolution. |
[in] | args | Arguments to parametrize the instantiation. |
[in] | self | The NodeTemplate created by CreateTemplateFromDelegate is passed here. |
using VariantTreeMap = TreeMap<Id, Variant, ArrayMapSelector<false> > |
A VariantTreeMap is used as argument for CreateVariantTemplate to define the variants of the variant template.
|
private |
|
static |
Creates a NodeSystemBasedNodeTemplate from a template node system.
[in] | templ | A node system to be used as template. |
[in] | lookup | The asset repository to use for lookup of assets within #templ. |
|
static |
Loads a NodeTemplate asset from a repository. This is a convenience method around AssetRepositoryRef::FindAssets, it returns the latest version for assetId after a check that the asset is really a NodeTemplate.
[in] | repo | A repository. |
[in] | assetId | The id of the asset to load. |
|
static |
Loads a NodeTemplate asset from the builtin asset repository. This is the same as LoadTemplate, but restricted to the builtin asset repository. The returned asset is a decorated version of the corresponding NodeTemplate in the BuiltinNodes registry, adding support for meta data, resource descriptions and instantiation cache.
[in] | assetId | The id of the asset to load. |
|
static |
Creates a NodeTemplate which wraps the given template and caches instantiations. I.e., whenever the template is instantiated with equal arguments, the returned instantiation will be the same NodeSystem.
[in] | templ | The node template to wrap. |
|
static |
Creates a NodeTemplate which wraps a lazily created NodeTemplate. Only when needed the creator is called once to obtain the NodeTemplate to be wrapped, this is then cached.
[in] | nodeId | The asset id to use for the NodeTemplate. The asset repository will be set to the built-in repository. |
[in] | creator | The callback for lazy creation of the wrapped NodeTemplate. |
[in] | support | The callback to implement NodeTemplateInterface::SupportsImpl. Pass a null value (the default) to use the wrapped implementation. |
|
static |
Creates a NodeTemplate which wraps a lazily created NodeTemplate. Only when needed the creator is called once to obtain the NodeTemplate to be wrapped, this is then cached.
[in] | nodeId | The asset id to use for the NodeTemplate. The asset repository will be set to the built-in repository. |
[in] | creator | The callback for lazy creation of the wrapped NodeTemplate. |
[in] | support | The returned NodeTemplate implements the SupportsImpl method such that it returns true if and only if the NodeSystemClass argument has the component given by #support. |
|
static |
Creates a NodeTemplate which wraps a lazily created NodeTemplate. Only when needed the creator is called once to obtain the NodeTemplate to be wrapped, this is then cached.
[in] | nodeId | The asset id to use for the NodeTemplate. The asset repository will be set to the built-in repository. |
[in] | creator | The callback for lazy creation of the wrapped NodeTemplate. |
[in] | support | The returned NodeTemplate implements the SupportsImpl method such that it returns true if and only if the NodeSystemClass argument is the same as the class given by #support or a subclass thereof. |
|
static |
Creates a NodeTemplate where the Instantiate method is implemented by the given delegate.
[in] | nodeId | The asset id to use for the NodeTemplate. The asset repository will be set to the built-in repository. |
[in] | cache | If true, instantiations will be cached. I.e., for a given set of template arguments, the delegate will be called only once and the result will be cached. |
[in] | instantiate | The delegate to implement NodeTemplateInterface::InstantiateImpl. |
[in] | support | The callback to implement NodeTemplateInterface::SupportsImpl. Pass a null value (the default) to use the wrapped implementation. |
|
static |
Creates a NodeTemplate where the Instantiate method is implemented by the given delegate.
[in] | nodeId | The asset id to use for the NodeTemplate. The asset repository will be set to the built-in repository. |
[in] | cache | If true, instantiations will be cached. I.e., for a given set of template arguments, the delegate will be called only once and the result will be cached. |
[in] | instantiate | The delegate to implement NodeTemplateInterface::InstantiateImpl. |
[in] | support | The returned NodeTemplate implements the SupportsImpl method such that it returns true if and only if the NodeSystemClass argument has the component given by #support. |
|
static |
Creates a NodeTemplate where the Instantiate method is implemented by the given delegate.
[in] | nodeId | The asset id to use for the NodeTemplate. The asset repository will be set to the built-in repository. |
[in] | cache | If true, instantiations will be cached. I.e., for a given set of template arguments, the delegate will be called only once and the result will be cached. |
[in] | instantiate | The delegate to implement NodeTemplateInterface::InstantiateImpl. |
[in] | support | The returned NodeTemplate implements the SupportsImpl method such that it returns true if and only if the NodeSystemClass argument is the same as the class given by #support or a subclass thereof. |
|
static |
Creates a variant template for the VariantTreeMap #variants. A variant template allows the user to choose between different other templates, for example the arithmetic node allows to select the operation (add, subtract, multiply, divide) at first level and the datatype at second level. The selection of the variant is controlled by template parameter ports (see Variant::childSelector) of the returned node template.
[in] | variants | The variants as a tree of alternatives. |
|
static |
Builds a node template from a resource description.
[in] | id | The identifier of the description. |
[in] | nodeClass | The node system class to use for the construction. |
[in] | addDependencies | If true (the default) dependency wires are added crosswise between input and output ports. |
[in] | finalizer | An optional finalizer which will be called at the end to allow for customization. |
|
static |
Creates a DescriptionProcessor which processes a resource description to build a node template. The actual processing is done by #delegate, the returned DescriptionProcessor just adds the automatic insertion of the node template into the BuiltinNodes registry.
[in] | delegate | A delegate to process the dataDescription for descriptionId into a NodeTemplate. |
|
static |
Creates a DescriptionProcessor which processes a resource description to build a node template. The actual processing is done by #delegate, the returned DescriptionProcessor just adds the automatic insertion of the node template into the BuiltinNodes registry.
[in] | delegate | A delegate to process the dataDescription for descriptionId into a NodeTemplate. |
|
static |
Checks if a node template asset is supported by a node system class using a cache. The method caches this information in the asset meta data, so that the asset only needs to be loaded and the NodeTemplate::Supports only needs to be called once.
[in] | nodeAsset | The node asset to check. |
[in] | cls | The node system class to check. |
|
static |
Creates a ChangeList which can be used to track NodeSystem changes. Most of the methods which modify a NodeSystem have an optional ChangeList parameter, when a ChangeList is passed there the changes will be tracked.
|
static |
|
static |
|
static |
Creates a UUID (universally unique identifier) for a port. If prefix is given, the returned identifier starts with prefix, otherwise it is a UUID only.
The implementation is based on AssetInterface::MakeUuid. In addition to that method it makes sure that special port ids such as those with component access tags are handled correctly.
[in] | prefix | The prefix for the identifier, may be nullptr. Only the characters up to the first @ sign are used. |
|
static |
Creates a UUID (universally unique identifier) for a port. The UUID will have a direction-dependent prefix.
[in] | dir | The port direction. |