NodeSystemClassInterface Class Reference

#include <nodesystem_class.h>

Inheritance diagram for NodeSystemClassInterface:

Detailed Description

A node system class defines a set of methods to customize the behavior of node systems and node templates. Whenever a NodeTemplate is instantiated to a NodeSystem, this process goes through a NodeSystemClass. Also only NodeSystems which use the same class can be used together.

NodeSystemClassInterface inherits from NodeSystemDerivationHandlerInterface: Unless you change the NodeSystemDerivationHandler explicitly (see MutableRoot::SetDerivationHandler()) the node system class is used to define the attribute derivation behaviour via its implementation of NodeSystemDerivationHandlerInterface.

Public Member Functions

MAXON_FUNCTION const IdGetId () const
 
MAXON_FUNCTION Bool IsSubclassOf (const NodeSystemClass &other) const
 
MAXON_METHOD Result< MutableRootCreateNodeSystem (const AssetRepositoryRef &repo) const
 
MAXON_METHOD Result< void > FinalizeModification (MutableRoot &root, TimeStamp stampOnBegin, NodeSystem::FINALIZE_FLAGS finalize, ChangeList *changelist) const
 
MAXON_METHOD const GraphAttribute & GetGraphAttribute (const InternedId &attr) const
 
MAXON_METHOD GraphAttribute::FLAGS GetGraphAttributeFlags (const InternedId &attr) const
 
MAXON_METHOD Result< BoolGetDerivedAttributes (const ValueReceiver< const InternedId & > &receiver) const
 
MAXON_METHOD Result< CONVERSION_FLAGSGetConversionFlags (const DataType &dest, const DataType &src) const
 
MAXON_METHOD Result< DataConvert (const DataType &dest, const ConstDataPtr &value) const
 
MAXON_METHOD Result< BoolSupportsImpl (const NodeTemplate &templ) const
 
MAXON_METHOD Result< BoolSupportsVariant (const NodeTemplate &templ, const Block< const Id > &variant) const
 
MAXON_METHOD Result< IdSubstituteVariant (const NodeTemplate &templ, const Block< const Id > &variant, const Block< const Id > &options) const
 
MAXON_METHOD Result< NodeSystemInstantiateImpl (const InstantiationTrace &parent, const NodeTemplate &templ, const TemplateArguments &args) const
 
MAXON_METHOD Result< GraphModelInterface::MODIFIEDGetSpecialFlags (const Port &port, const InternedId &attr, GraphAttribute::FLAGS attrFlags, const ConstDataPtr &newValue, const ConstDataPtr &oldValue) const
 
MAXON_FUNCTION Bool HasGlobalContext () const
 

Protected Member Functions

MAXON_METHOD GraphAttribute::FLAGS GetGraphAttributeFlagsImpl (const InternedId &attr) const
 

Private Member Functions

 MAXON_INTERFACE (NodeSystemClassInterface, MAXON_REFERENCE_CONST, "net.maxon.node.interface.nodesystemclass", MAXON_IMPLEMENTATION_MODULE("net.maxon.nodes"))
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( NodeSystemClassInterface  ,
MAXON_REFERENCE_CONST  ,
"net.maxon.node.interface.nodesystemclass"  ,
MAXON_IMPLEMENTATION_MODULE("net.maxon.nodes")   
)
private

◆ GetId()

MAXON_FUNCTION const Id& GetId ( ) const

Returns a unique identifier for this node system class (namely the identifier of the object class, {GetClass().GetId()}).

Returns
Unique identifier for node system class.

◆ IsSubclassOf()

Bool IsSubclassOf ( const NodeSystemClass &  other) const

Checks if this class is a subclass of other. This is implemented by the corresponding function of the underlying object class.

Parameters
[in]otherAnother node system class.
Returns
True if this class is a subclass of other, false otherwise.

◆ CreateNodeSystem()

MAXON_METHOD Result<MutableRoot> CreateNodeSystem ( const AssetRepositoryRef &  repo) const

Creates a new compound node system. Compound node systems allow to set up a node system consisting of several other nodes.

Whenever the node system needs to do an asset lookup during the following modifications, the given repository is used.

Parameters
[in]repoThe repository to use for asset lookup during the following modifications.
Returns
The MutableRoot of a new empty compound node system.

◆ FinalizeModification()

MAXON_METHOD Result<void> FinalizeModification ( MutableRoot root,
TimeStamp  stampOnBegin,
NodeSystem::FINALIZE_FLAGS  finalize,
ChangeList *  changelist 
) const

Runs finalization steps at the end of a modification. This method must not be called directly, instead it is called implicitly during MutableRoot::EndModification(). When overriding the method make sure to call the super implementation.

Parameters
[in]stampOnBeginThe time stamp of the node system at the time BeginModification() was called.
[in]finalizeFlags to control the finalization.
[in]changelistChange list to log changes made during finalization.

◆ GetGraphAttribute()

MAXON_METHOD const GraphAttribute& GetGraphAttribute ( const InternedId attr) const

Returns the GraphAttribute which node systems of this class use for the attribute identified by attr. The method may return a null reference if the class doesn't provide a GraphAttribute for attr. This doesn't mean that the attribute is unsupported, it just means that there is no need for special handling of the attribute (which would require a GraphAttribute). The default implementation asks the Attributes registry.

Parameters
[in]attrThe identifier of the attribute.
Returns
The corresponding GraphAttribute, or a null reference if the node system class has no GraphAttribute for attr.
See also
GetGraphAttributeFlags

◆ GetGraphAttributeFlags()

MAXON_METHOD GraphAttribute::FLAGS GetGraphAttributeFlags ( const InternedId attr) const

Returns the GraphAttribute::FLAGS to use for the attribute identified by attr. This allows the node system class to override the default flags of the attribute, for example to mark an attribute as meta attribute.

You must not override this method directly, override GetGraphAttributeFlagsImpl instead.

Parameters
[in]attrThe identifier of the attribute.
Returns
The flags which this node system class uses for the attribute.
See also
GetGraphAttribute @MAXON_ANNOTATION{default=GraphAttributeInterface::FLAGS::DIRECT}

◆ GetDerivedAttributes()

MAXON_METHOD Result<Bool> GetDerivedAttributes ( const ValueReceiver< const InternedId & > &  receiver) const

Yields all required derived attributes of this node system class to receiver.

Parameters
[in]receiverA receiver for required derived attributes.

◆ GetConversionFlags()

MAXON_METHOD Result<CONVERSION_FLAGS> GetConversionFlags ( const DataType dest,
const DataType src 
) const

Returns the conversion flags of a conversion from src to #dest as implemented by Convert. If there is no such conversion, CONVERSION_FLAGS::INCONVERTIBLE is returned.

Parameters
[in]destThe destination type.
[in]srcThe source type.
Returns
The conversion flags for the conversion from src to #dest.

◆ Convert()

MAXON_METHOD Result<Data> Convert ( const DataType dest,
const ConstDataPtr value 
) const

Converts value to type dest. This is used e.g. by the validation mechanism of the EffectivePortValue attribute whenever this needs to convert incoming data to a different expected type. The default implementation of DefaultNodeSystemClass uses DataType::Convert, but this may be overridden if the implementation provides additional means for conversion.

Parameters
[in]destThe type to convert to.
[in]valueThe value to convert.
Returns
The converted value.

◆ SupportsImpl()

MAXON_METHOD Result<Bool> SupportsImpl ( const NodeTemplate &  templ) const

Checks if this node system class supports the instantiation of the given node template. If true is returned, this does not necessarily mean that all possible instantiations of the template are supported, but at least some are supported. Usually this call is just forwarded to NodeTemplateInterface::SupportsImpl, but the node system class may override this default behaviour.

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

◆ SupportsVariant()

MAXON_METHOD Result<Bool> SupportsVariant ( const NodeTemplate &  templ,
const Block< const Id > &  variant 
) const

Checks if this node system class supports the given #variant for a node template #templ created by NodesLib::CreateVariantTemplate(). #variant is a path into the TreeMap which was given as argument to NodesLib::CreateVariantTemplate(). The default implementation of DefaultNodeSystemClass returns true.

Parameters
[in]templThe variant node template to check.
[in]variantThe path into the TreeMap of variants.
Returns
True if this node system supports the given variant, false otherwise.

◆ SubstituteVariant()

MAXON_METHOD Result<Id> SubstituteVariant ( const NodeTemplate &  templ,
const Block< const Id > &  variant,
const Block< const Id > &  options 
) const

Subtitutes an unsupported variant of a node template #templ created by NodesLib::CreateVariantTemplate() by a supported one. #variant is a path into the TreeMap which was given as argument to NodesLib::CreateVariantTemplate(). The path points to the variant of the template which was chosen by the template arguments, but which is not supported as reported by SupportsVariant(). If a supported alternative shall be used as a substitution, the method returns its identifier. If no substution is possible, the method returns an empty identifier.

Parameters
[in]templThe variant node template to check.
[in]variantThe (unsupported) path into the TreeMap of variants.
[in]optionsThe supported alternatives for the last path element of #variant. This is not a path, but a list of the supported siblings of the unsupported variant in the TreeMap of the variant node template.
Returns
An alternative to use for the unsupported #variant, or an empty identifier if there is no viable alternative.

◆ InstantiateImpl()

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

Instantiates the template #templ using the given arguments for this node system class. Usually this call is just forwarded to NodeTemplateInterface::InstantiateImpl, but the node system class may override this behaviour to return a specialization of the node template.

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

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

◆ GetSpecialFlags()

MAXON_METHOD Result<GraphModelInterface::MODIFIED> GetSpecialFlags ( const Port port,
const InternedId attr,
GraphAttribute::FLAGS  attrFlags,
const ConstDataPtr newValue,
const ConstDataPtr oldValue 
) const

Returns the set of special graph modification stamps which shall be set for the change from oldValue to newValue.

Parameters
[in]portThe port where the attribute value has changed.
[in]attrThe attribute whose value has changed.
[in]attrFlagsThe flags of the attribute.
[in]newValueThe newly derived attribute value for port.
[in]oldValueThe previously derived attribute value for port.
Returns
Combination of special flags, these determine the graph modification stamps which shall be updated.

◆ HasGlobalContext()

MAXON_FUNCTION Bool HasGlobalContext ( ) const

Returns true if node systems of this node system class shall have the GlobalContext port. GlobalContext ports are implicitly propagated from children to their parents.

Returns
True if GlobalContext port shall be provided, false otherwise.

◆ GetGraphAttributeFlagsImpl()

MAXON_METHOD GraphAttribute::FLAGS GetGraphAttributeFlagsImpl ( const InternedId attr) const
protected

Returns the GraphAttribute::FLAGS to use for the attribute identified by attr. This allows the node system class to override the default flags of the attribute, for example to mark an attribute as meta attribute.

Implementations may override this method, this will be used by the public GetGraphAttributeFlags method.

Parameters
[in]attrThe identifier of the attribute.
Returns
The flags which this node system class uses for the attribute.
See also
GetGraphAttribute @MAXON_ANNOTATION{default=GraphAttributeInterface::FLAGS::DIRECT}