NodeSystemInterface Class Reference

#include <nodesystem.h>

Inheritance diagram for NodeSystemInterface:

Detailed Description

A NodeSystem owns and manages a complete hierarchy of nodes and ports. NodeSystem is a copy-on-write reference, therefore each non-const method may create a copy of the original node system at first. However the copy is done by sharing the internal data, so it is a lightweight operation.

Traversal of a node system starts with GetRoot().

NodeSystem is a copy-on-write reference class, but you can't call non-const methods or MakeWritable directly. Instead, for modifications, you have to call BeginModification() to obtain write access to the hierarchy through a MutableRoot. As long as you make modifications, you have to ensure that no other thread uses the reference to the node system, or synchronize the threads in an appropriate way. As last step of a sequence of modifications you have to call MutableRoot::EndModification().

The implementation class of this interface is a final class, so you can't override it. However some behavior is delegated to NodeSystemClass and NodeSystemDerivationHandler to allow for customization of certain aspects.

See also
$ref usernodes_nodesystem
NodesLib @MAXON_ANNOTATION{refclass=false}

Public Types

enum class  GML_OPTIONS {
  NONE ,
  DIRECT_ATTRIBUTES ,
  BASE_ATTRIBUTES ,
  DERIVED_ATTRIBUTES ,
  BASES ,
  ALL_BASES ,
  NO_CONNECTIONS ,
  INDUCED_CONNECTIONS ,
  ATTRIBUTES
}
 
enum class  FINALIZE_FLAGS {
  NONE ,
  CLEANUP ,
  FOR_GROUP
}
 
using GET_CONNECTIONS_MODE = GraphModelInterface::GET_CONNECTIONS_MODE
 

Public Member Functions

MAXON_METHOD const NodeSystemClass & GetNodeSystemClass () const
 
MAXON_METHOD const NodeSystemDerivationHandler & GetDerivationHandler () const
 
MAXON_METHOD const NodeSystemGetBase () const
 
MAXON_METHOD const Block< const NodeSystem > & GetBases () const
 
MAXON_METHOD Bool HasBase (const IdAndVersion &baseId) const
 
MAXON_METHOD Result< Array< IdAndVersion > > GetAllBaseAssets () const
 
MAXON_METHOD Result< BoolGetAllBases (const ValueReceiver< const NodeSystem & > &receiver) const
 
MAXON_METHOD const NodeTemplate & GetTemplate () const
 
MAXON_METHOD const TemplateArgumentsGetArguments () const
 
MAXON_METHOD const AssetRepositoryRef & GetTemplateLookupRepository ()
 
MAXON_FUNCTION Node GetRoot () const
 
 MAXON_ADD_TO_COPY_ON_WRITE_REFERENCE_CLASS (Result< MutableRoot > BeginModification(const AssetRepositoryRef &repo);)
 
MAXON_METHOD Bool IsFinalized () const
 
MAXON_METHOD Result< MutableRootCreateInstance (const AssetRepositoryRef &repo) const
 
MAXON_METHOD Result< NodeSystemCreateCopyOfSelection (const AssetRepositoryRef &repo, const NodePath &basePath, const Block< const InternedId > &selection) const
 
MAXON_METHOD TimeStamp GetModificationStamp () const
 
MAXON_METHOD Result< BoolGetModificationsSince (TimeStamp stamp, const ValueReceiver< const GNode &, GraphModelRef::MODIFIED > &receiver) const
 
MAXON_METHOD GraphModelRef::MODIFIED GetModificationsSince (TimeStamp stamp) const
 
MAXON_METHOD Int GetTopologicalLayer (const NodePath &port) const
 
MAXON_METHOD Int GetTopologicalLayer (const PathBlock &port) const
 
MAXON_METHOD Result< BoolGetTopLevelPorts (Bool reverseOrder, const ValueReceiver< const Port & > &receiver) const
 
MAXON_METHOD Result< BoolSetValue (const GNodeHandle &node, const InternedId &attr, ForwardingDataPtr &&value, ChangeList *list, Bool checkAndInvalidate=true)
 
MAXON_METHOD Result< NodeSystemData > GetNodeSystemData () const
 
enum maxon::nodes::NodeSystemInterface::GML_OPTIONS MAXON_ENUM_FLAGS_CLASS (GML_OPTIONS)
 
MAXON_METHOD Result< void > WriteGml (UrlOrOutputStream &&output, GML_OPTIONS opts) const
 
MAXON_METHOD Int PrivateGetChildEntryCount (const GNodeHandle &node) const
 
MAXON_METHOD GNodeHandle PrivateGetRoot () const
 
enum maxon::nodes::NodeSystemInterface::FINALIZE_FLAGS MAXON_ENUM_FLAGS_CLASS (FINALIZE_FLAGS)
 
MAXON_METHOD Result< BoolGetReferencedAssets (Bool onlyUpdatable, const ValueReceiver< const AssetReference & > &receiver) const
 

Static Public Attributes

static constexpr WIRE_MODE VALUE_CHAIN
 
static constexpr WIRE_MODE VALUE_SECONDARY
 
static constexpr WIRE_MODE VALUE_DEFAULT
 
static constexpr WIRE_MODE VALUE_COUNTERCHAIN
 
static constexpr WIRE_MODE DEPENDENCY_TYPE
 
static constexpr WIRE_MODE DEPENDENCY_COMPONENT
 

Private Member Functions

 MAXON_INTERFACE (NodeSystemInterface, MAXON_REFERENCE_COPY_ON_WRITE, "net.maxon.node.interface.nodesystem", MAXON_IMPLEMENTATION_MODULE("net.maxon.nodes"))
 
MAXON_METHOD Result< void > SetDerivationHandler (const NodeSystemDerivationHandler &handler)
 
MAXON_METHOD Result< void > SetTemplate (const AssetRepositoryRef &lookup, const NodeTemplate &templ, const TemplateArguments &args, Bool setValues)
 
MAXON_METHOD Result< BoolGetInnerNodes (const GNodeHandle &node, NODE_KIND mask, Bool includeNode, const ValueReceiver< const MutableGNode & > &receiver)
 
MAXON_METHOD Result< GNodeHandleGetParent (const GNodeHandle &node) const
 
MAXON_METHOD Result< GNodeHandleGetAncestor (const GNodeHandle &node, NODE_KIND kind) const
 
MAXON_METHOD Result< GNodeHandleGetPortList (const GNodeHandle &node, PORT_DIR dir) const
 
MAXON_METHOD Result< GNodeHandleFindChild (const GNodeHandle &node, const InternedId &name, NODE_KIND kind) const
 
MAXON_METHOD Result< GNodeHandleFindInnerNode (const GNodeHandle &node, const PathBlock &innerPath) const
 
MAXON_METHOD const NodeSystemGetBase (const GNodeHandle &node) const
 
MAXON_METHOD const Block< const NodeSystem > & GetBases (const GNodeHandle &node) const
 
MAXON_METHOD Result< BoolGetAllBases (const GNodeHandle &node, const ValueReceiver< const NodeSystem & > &receiver) const
 
MAXON_METHOD Result< void > AddBase (const NodeSystem &other)
 
MAXON_METHOD const NodeTemplate & GetTemplate (const GNodeHandle &node) const
 
MAXON_METHOD Result< BoolGetAllTemplates (const GNodeHandle &node, const ValueReceiver< const NodeTemplate & > &receiver) const
 
MAXON_METHOD const NodeSystemDerivationHandler & GetDerivationHandler (const GNodeHandle &node) const
 
MAXON_METHOD Result< GNodeHandleFindHandle (const PathBlock &path) const
 
MAXON_METHOD GNodeHandle FindHandle (const NodePath &path) const
 
MAXON_METHOD Bool PrivateValidate (const GNodeHandle &handle) const
 
MAXON_METHOD GNODE_FLAGS GetFlags (const GNodeHandle &port) const
 
MAXON_METHOD Result< void > InitIterator (const GNodeHandle &node, GNodeIteratorBase &iterator) const
 
MAXON_METHOD Result< void > MoveToNext (GNodeIteratorBase &iterator) const
 
MAXON_METHOD Result< void > Validate (ChangeList *change)
 
MAXON_METHOD Result< void > ValidateTopology ()
 
MAXON_METHOD Result< void > ValidatePorts (ChangeList *change)
 
MAXON_METHOD Result< void > BeginModificationImpl (const AssetRepositoryRef &lookup)
 
MAXON_METHOD Result< void > EndModificationImpl (ChangeList *change, FINALIZE_FLAGS finalize)
 
MAXON_METHOD Result< void > Compact ()
 
MAXON_METHOD Result< ChangeList > Apply (const ChangeList &toApply, Bool inverse, ChangeList *list)
 
MAXON_METHOD Result< void > Update (const Block< const Tuple< AssetReference, AssetBase >> &updates, const AssetRepositoryRef &lookup, ChangeList *list)
 
MAXON_METHOD Result< GNodeHandleAddChild (const Id &child, const NodeSystem &base, ChangeList *list)
 
MAXON_METHOD Result< ChangeList > ReplaceBase (const NodeSystem &base, ChangeList *list)
 
MAXON_METHOD Result< ChangeList > ReplaceChildren (const Block< const Tuple< InternedId, NodeSystem >> &newChildren, ChangeList *list)
 
MAXON_METHOD Result< GNodeHandleMoveToGroup (MutableRoot &&groupRoot, const Id &groupId, const Block< const InternedId > &selection, Bool matchPorts, const FixedSizeArray< Block< const Tuple< NodePath, NodePath, NodePath >>, 2 > &mapping, ChangeList *list)
 
MAXON_METHOD Result< NodeSystemMoveToNodeSystem (const GNodeHandle &node, ChangeList *list)
 
MAXON_METHOD Result< HashMap< InternedId, InternedId > > Ungroup (const GNodeHandle &node, ChangeList *list)
 
MAXON_METHOD Result< HomogenousTupleType< 3, HashMap< InternedId, InternedId > > > Merge (const NodeSystem &other, ChangeList *list)
 
MAXON_METHOD Result< HomogenousTupleType< 3, HashMap< InternedId, InternedId > > > Duplicate (const Block< const NodePath > &selection, Bool withConnections, ChangeList *list)
 
MAXON_METHOD Result< GNodeHandleAddChild (const GNodeHandle &node, const Id &port, GNODE_FLAGS flags, ChangeList *list)
 
MAXON_METHOD Result< void > InheritChild (const GNodeHandle &parent, const InternedId &childId, ChangeList *list)
 
MAXON_METHOD Result< void > Remove (const GNodeHandle &child, ChangeList *list)
 
MAXON_METHOD Result< void > Connect (const GNodeHandle &source, const GNodeHandle &target, Wires modes, ChangeList *list)
 
MAXON_METHOD Result< BoolGetConnections (const GNodeHandle &source, PORT_DIR dir, const ValueReceiver< const MutableConnection & > &conns, Wires mask, GET_CONNECTIONS_MODE mode)
 
MAXON_METHOD Result< WiresGetWires (const GNodeHandle &source, const GNodeHandle &target) const
 
MAXON_METHOD Result< BoolGetConnectionValues (const GNodeHandle &source, const GNodeHandle &target, const ValueReceiver< CONNECTION_POSITION, InternedId, const ConstDataPtr & > &receiver) const
 
MAXON_METHOD Result< ConstDataPtrGetConnectionValue (const GNodeHandle &source, const GNodeHandle &target, CONNECTION_POSITION position, const InternedId &attr, const DataType &expectedType) const
 
MAXON_METHOD Result< BoolSetConnectionValue (const GNodeHandle &source, const GNodeHandle &target, CONNECTION_POSITION position, const InternedId &attr, ForwardingDataPtr &&value, ChangeList *list)
 
MAXON_METHOD Result< void > GetValues (const GNodeHandle &port, GraphAttribute::FLAGS mask, GraphAttributeMap &attribs, Bool includeInherited, Bool includeRemoved) const
 
MAXON_METHOD Result< ConstDataPtrGetValue (const GNodeHandle &port, const InternedId &attr, const DataType &expectedType) const
 
MAXON_METHOD Result< ConstDataPtrGetValue (const GNodeHandle &port, const InternedId &attr, const DataType &expectedType, Int *nesting, Bool negativeRootNesting) const
 
MAXON_METHOD Result< BoolGetBaseValues (const GNodeHandle &port, const InternedId &attr, const DataType &expectedType, const ValueReceiver< const ConstDataPtr &, Int > &values) const
 
MAXON_METHOD Result< void > TouchValue (const GNodeHandle &port, const InternedId &attr, ChangeList *list)
 
MAXON_METHOD Result< void > ChangeValue (const GNodeHandle &port, const InternedId &attr, const SubDataOperation &op, const SubDataPathBlock &path, ForwardingDataPtr &&subvalue, ChangeList *change)
 
MAXON_METHOD Result< BoolInheritValue (const GNodeHandle &port, const InternedId &attr, ChangeList *list)
 
MAXON_METHOD Result< BoolRemoveValue (const GNodeHandle &port, const InternedId &attr, ChangeList *list)
 
MAXON_METHOD Result< BoolGetAttributeModificationsSince (const GNodeHandle &node, TimeStamp stamp, const ValueReceiver< InternedId, ConstDataPtr > &receiver) const
 
MAXON_METHOD TimeStamp GetAttributeStamp (const GNodeHandle &node, const InternedId &attr) const
 
MAXON_METHOD TimeStamp GetConnectionStamp (const GNodeHandle &node, PORT_DIR direction) const
 
MAXON_METHOD Result< void > AddChildren (const Block< Tuple< InternedId, NodeSystem, GNodeHandle >> &children, ChangeList *list)
 
MAXON_METHOD Result< ChangeList > ReplaceChild (const InternedId &childId, const NodeSystem &base, const HashMap< NodePath, NodePath > &portMap, ChangeList *list)
 

Private Attributes

 MAXON_INTERFACE_SINGLE_IMPLEMENTATION
 

Friends

class GNodeIteratorBase
 
template<typename NODE >
class GNodeIterator
 
template<typename BASE >
class GNodeFunctions
 
template<typename BASE >
class MutableGNodeFunctions
 
template<typename BASE >
class NodeFunctions
 
template<typename BASE >
class PortListFunctions
 
template<typename BASE >
class MutablePortListFunctions
 
template<typename BASE >
class PortFunctions
 
template<typename BASE >
class MutablePortFunctions
 
class GNode
 
class GNodeBase
 
class MutableGNode
 
class MutableNode
 
class MutableRoot
 
class MutablePortList
 
class Port
 
class MutablePort
 
class NodeSystemImpl
 
class NodesLibImpl
 
class CompiledNodeImpl
 
class NodesGraphModelImpl
 
class NodeSystemManagerImpl
 
class NodeSystemBasedTemplateImpl
 
class CoreNodeWrapperImpl
 

Member Typedef Documentation

◆ GET_CONNECTIONS_MODE

Member Enumeration Documentation

◆ GML_OPTIONS

enum GML_OPTIONS
strong

This enum contains options for the GML output written by WriteGml.

Enumerator
NONE 

No flags.

DIRECT_ATTRIBUTES 

Writes direct attributes (those which are set directly at the node system).

BASE_ATTRIBUTES 

Writes base attributes (those which are inherited from a base node system).

DERIVED_ATTRIBUTES 

Writes derived attributes.

BASES 

Also writes the node systems which are used as bases for the node system.

ALL_BASES 

Like BASES, but also writes bases of bases etc.

NO_CONNECTIONS 

No connections will be written.

INDUCED_CONNECTIONS 

Induced connections will be written.

ATTRIBUTES 

Combination of all attribute flags, used to write all attributes.

◆ FINALIZE_FLAGS

enum FINALIZE_FLAGS
strong

MutableRoot::EndModification() passes FINALIZE_FLAGS to NodeSystemClassInterface::FinalizeModification, this is used to control which finalizations shall be done during MutableRoot::EndModification().

Enumerator
NONE 

Don't do any finalizations at all.

CLEANUP 

Run clean-up finalizations.

FOR_GROUP 

Deprecated.

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( NodeSystemInterface  ,
MAXON_REFERENCE_COPY_ON_WRITE  ,
"net.maxon.node.interface.nodesystem"  ,
MAXON_IMPLEMENTATION_MODULE("net.maxon.nodes")   
)
private

◆ GetNodeSystemClass()

MAXON_METHOD const NodeSystemClass& GetNodeSystemClass ( ) const

Returns the node system class which created this node system. Only node systems of the same node system class can be used together.

Returns
The node system class of this node system.

◆ GetDerivationHandler() [1/2]

MAXON_METHOD const NodeSystemDerivationHandler& GetDerivationHandler ( ) const

Returns the derivation handler of this node system. Node templates can override the default derivation handler when they instantiate a node system using MutableRoot::SetDerivarionHandler().

Returns
The derivation handler of this node system.

◆ GetBase() [1/2]

MAXON_METHOD const NodeSystem& GetBase ( ) const

Returns the base node system of which this node system is an instance. If this node system is not an instance of a base, the method returns a null reference.

Returns
The base of this node system.

◆ GetBases() [1/2]

MAXON_METHOD const Block<const NodeSystem>& GetBases ( ) const

Returns the base node systems of which this node system is an instance. The entry at index 0 refers to the node system of which this node system has been created as instance by CreateInstance(), this will be a null reference if the node systems hasn't been created this way. It's the same as the node system returned by GetBase(). The remaining entries list the bases which have been added by AddBase().

Returns
The bases of this node system, this will have at least one entry. The first entry may be a null reference.

◆ HasBase()

MAXON_METHOD Bool HasBase ( const IdAndVersion baseId) const

Checks if this node system has the node template asset given by baseId as a base. This is the case if

  • the node system is a direct instantiation of the template (GetTemplate() matches baseId)
  • or if this holds for any of the bases (see GetBases()), recursively including their bases as well. If the version part of baseId is empty, versions will be ignored. If the IgnoreBase attribute is set for the root node of this node system, the first base (see GetBase()) will be ignored in the check.
    Parameters
    [in]baseIdThe asset identifier of a node template.
    Returns
    True if this node system has an instantiation of the template given by baseId as a direct or indirect base, false otherwise.

◆ GetAllBaseAssets()

MAXON_METHOD Result<Array<IdAndVersion> > GetAllBaseAssets ( ) const

◆ GetAllBases() [1/2]

MAXON_METHOD Result<Bool> GetAllBases ( const ValueReceiver< const NodeSystem & > &  receiver) const

Recursively finds all the bases of the node system starting from the content of GetBases.

Parameters
[in]receiverValueReceiver or Array that will receive all the base NodeSystem found.
Returns
False if the receiver cancelled further evaluation, true otherwise.

◆ GetTemplate() [1/2]

MAXON_METHOD const NodeTemplate& GetTemplate ( ) const

Returns the node template which instantiated this node system. If this node system is no instantiation of a node template, the method returns a null reference.

See also
GetArguments
NodeTemplate::Instantiate
Returns
The node template which instantiated this node system, or a null reference.

◆ GetArguments()

MAXON_METHOD const TemplateArguments& GetArguments ( ) const

Returns the template arguments which have been used for this instantiation of a node template (if this node system is an instantiation of a node template at all).

See also
GetTemplate
Returns
The arguments of this node template instantiation.

◆ GetTemplateLookupRepository()

MAXON_METHOD const AssetRepositoryRef& GetTemplateLookupRepository ( )

Returns the asset repository which is used for asset lookup during the current modification. After MutableRoot::EndModification has been called, this will be a null reference.

Returns
The lookup repository to use during the current modification. @MAXON_ANNOTATION{refclass=false}

◆ GetRoot()

Node GetRoot ( ) const

Returns the root node of this node system as an immutable Node. You can traverse the node system starting at the root, but you can't get write access to the node system via Node. For write-access use the function BeginModification() instead.

See also
$ref usernodes_nodes
Returns
The root node of this node system.

◆ MAXON_ADD_TO_COPY_ON_WRITE_REFERENCE_CLASS()

MAXON_ADD_TO_COPY_ON_WRITE_REFERENCE_CLASS ( Result< MutableRoot > BeginModification(const AssetRepositoryRef &repo);  )

◆ IsFinalized()

MAXON_METHOD Bool IsFinalized ( ) const

Checks if this node system is in finalized state. A node system is in finalized state after MutableRoot::EndModification() has been called as long as no further modification is being made.

Returns
True if this node system is finalized (and therefore ready to use), false otherwise.

◆ CreateInstance()

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

Creates an instance of this node system. Initially the returned instance will behave exactly like this node system, but you can apply changes to the instance. No data needs to be copied to the instance, so creating an instance is a lightweight process.

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
A MutableRoot of a new node system which uses this node system as its base.

◆ CreateCopyOfSelection()

MAXON_METHOD Result<NodeSystem> CreateCopyOfSelection ( const AssetRepositoryRef &  repo,
const NodePath &  basePath,
const Block< const InternedId > &  selection 
) const

Returns a new node system which is a copy of the subgraph induced by all nodes given by basePath and selection. All nodes with a node path consisting of the basePath plus one of the identifiers of selection are copied, including their attributes and connections. Connections which don't end in one of the selected nodes are ignored.

Parameters
[in]repoThe repository to use for asset lookup during the copy operation.
[in]basePathThe base path, this has to point to a true node. selection selects direct children of the node given by basePath.
[in]selectionA selection of nodes, namely children of the node given by basePath. Identifiers for which no child exists are ignored.
Returns
A copy of the subgraph given by the selection.

◆ GetModificationStamp()

MAXON_METHOD TimeStamp GetModificationStamp ( ) const

Returns the time stamp of this node system, it can be used to test for modifications. Each call to BeginModification() increments the stamp. The time stamp is also needed for GetModificationsSince and GNodeFunctions::GetAttributeModificationsSince to get all modifications which have happened since then.

Returns
Modification time stamp of this node system.

◆ GetModificationsSince() [1/2]

MAXON_METHOD Result<Bool> GetModificationsSince ( TimeStamp  stamp,
const ValueReceiver< const GNode &, GraphModelRef::MODIFIED > &  receiver 
) const

Reports all modifications which have been made since the given stamp to the receiver. A typical usage is

TimeStamp stamp = system.GetModificationStamp(); // get the reference time stamp
... // do some modifications
system.GetModificationsSince(stamp,
[] (const GNode& node, GraphModelRef::MODIFIED mod) -> Result<Bool>
{
...
friend class GNode
Definition: nodesystem.h:916
MODIFIED
Modified variant with epoch of 0h Nov 17, 1858.
Definition: datetime.h:2
UInt64 TimeStamp
Definition: graph.h:17
#define iferr_return
Definition: resultbase.h:1524
Definition: node.h:10

The node system on which GetModificationStamp() is called needn't be the same as the one on which GetModificationsSince() is called, it suffices that the latter has been created by a number of CopyFrom operations from the first (which includes the implicit copy operation due to copy-on-write).

Parameters
[in]stampA reference time stamp. Only modifications newer than this stamp are reported.
[in]receiverModifications are reported to this receiver.
Returns
false if the receiver cancelled further evaluation, true otherwise.

◆ GetModificationsSince() [2/2]

MAXON_METHOD GraphModelRef::MODIFIED GetModificationsSince ( TimeStamp  stamp) const

Returns flags which tell which kinds of changes have happened since the given time stamp. From the returned value you can't tell exactly which nodes or ports are affected, but you can tell for example if only attributes have changed or also the structure.

Parameters
[in]stampA reference time stamp. Only modifications newer than this stamp are reported.
Returns
Combination of flags to indicate the kinds of changes that have happened.

◆ GetTopologicalLayer() [1/2]

MAXON_METHOD Int GetTopologicalLayer ( const NodePath &  port) const

Returns an Int value which corresponds to a topological layer index for the given port. The connections within a node system build a directed acyclic graph, and the node system sets up a corresponding topological layering of all ports within MutableRoot::ValidateTopology(). Ports within the same layer aren't reachable from each other. Whenever port x can be reached from port y via a number of connections, the layer of x is greater than the layer of y. However the reverse is not true, so different layer indices don't imply reachability. You can use the fact that two ports are in the same layer for parallelization: In that case computations on these ports are usually independent.

For the topological layering only top-level ports are considered, connections of nested ports are treated as if they were at their enclosing top-level ports. Therefore the layer of a nested port is the same as the layer of its enclosing port.

Parameters
[in]portA path to a port of this node system. This may be a port of the root node, but also of any other arbitrarily nested node.
Returns
The index of the layer of the (enclosing top-level-) port in the topological layering, or a negative number if port doesn't point to a port.

◆ GetTopologicalLayer() [2/2]

MAXON_METHOD Int GetTopologicalLayer ( const PathBlock port) const

Returns an Int value which corresponds to a topological layer index for the given port. The connections within a node system build a directed acyclic graph, and the node system sets up a corresponding topological layering of all ports within MutableRoot::ValidateTopology(). Ports within the same layer aren't reachable from each other. Whenever port x can be reached from port y via a number of connections, the layer of x is greater than the layer of y. However the reverse is not true, so different layer indices don't imply reachability. You can use the fact that two ports are in the same layer for parallelization: In that case computations on these ports are usually independent.

For the topological layering only top-level ports are considered, connections of nested ports are treated as if they were at their enclosing top-level ports. Therefore the layer of a nested port is the same as the layer of its enclosing port.

Parameters
[in]portA path to a port of this node system. This may be a port of the root node, but also of any other arbitrarily nested node.
Returns
The index of the layer of the (enclosing top-level-) port in the topological layering, or a negative number if port doesn't point to a port.

◆ GetTopLevelPorts()

MAXON_METHOD Result<Bool> GetTopLevelPorts ( Bool  reverseOrder,
const ValueReceiver< const Port & > &  receiver 
) const

Yields all top-level ports of this node system to receiver in topological order. This comprises really all top-level ports, so not only ports of the root node, but also of its children and any other arbitrarily nested node.

See also
GetTopologicalLayer
Parameters
[in]reverseOrderTrue if the ports shall be reported in reverse topological order, false otherwise.
[in]receiverA callback which receives the top-level ports.
Returns
false if the receiver cancelled further evaluation, true otherwise.

◆ SetValue()

MAXON_METHOD Result<Bool> SetValue ( const GNodeHandle node,
const InternedId attr,
ForwardingDataPtr &&  value,
ChangeList *  list,
Bool  checkAndInvalidate = true 
)

Sets the value of #attr to value for node. This will override any value which would otherwise be inherited for the attribute from a base.

Parameters
[in]nodeThe handle for the g-node.
[in]attrThe attribute whose value shall be set.
[in]valueThe new value for the attribute.
[in]listAn optional ChangeList to track the changes.
[in]checkAndInvalidateTrue by default. Use false to suppress check, invalidation and update of time stamp. False may only be used for attributes which aren't needed during validation.
Returns
True if the value has been changed, false otherwise. @MAXON_ANNOTATION{refclass=false}

◆ GetNodeSystemData()

MAXON_METHOD Result<NodeSystemData> GetNodeSystemData ( ) const

Extracts the NodeSystemData for serialization. A NodeSystem itself can't be serialized.

Returns
NodeSystemData of this node system.

◆ MAXON_ENUM_FLAGS_CLASS() [1/2]

◆ WriteGml()

MAXON_METHOD Result<void> WriteGml ( UrlOrOutputStream &&  output,
GML_OPTIONS  opts 
) const

Writes this node system to a GML file (Graph Modeling Language).

Parameters
[in]outputThe output stream to write to.
[in]optsOptions for the output.

◆ PrivateGetChildEntryCount()

MAXON_METHOD Int PrivateGetChildEntryCount ( const GNodeHandle node) const

@MAXON_ANNOTATION{refclass=false}

◆ PrivateGetRoot()

MAXON_METHOD GNodeHandle PrivateGetRoot ( ) const

◆ MAXON_ENUM_FLAGS_CLASS() [2/2]

◆ SetDerivationHandler()

MAXON_METHOD Result<void> SetDerivationHandler ( const NodeSystemDerivationHandler &  handler)
private

◆ SetTemplate()

MAXON_METHOD Result<void> SetTemplate ( const AssetRepositoryRef &  lookup,
const NodeTemplate &  templ,
const TemplateArguments args,
Bool  setValues 
)
private

◆ GetInnerNodes()

MAXON_METHOD Result<Bool> GetInnerNodes ( const GNodeHandle node,
NODE_KIND  mask,
Bool  includeNode,
const ValueReceiver< const MutableGNode & > &  receiver 
)
private

◆ GetParent()

MAXON_METHOD Result<GNodeHandle> GetParent ( const GNodeHandle node) const
private

◆ GetAncestor()

MAXON_METHOD Result<GNodeHandle> GetAncestor ( const GNodeHandle node,
NODE_KIND  kind 
) const
private

◆ GetPortList()

MAXON_METHOD Result<GNodeHandle> GetPortList ( const GNodeHandle node,
PORT_DIR  dir 
) const
private

◆ FindChild()

MAXON_METHOD Result<GNodeHandle> FindChild ( const GNodeHandle node,
const InternedId name,
NODE_KIND  kind 
) const
private

◆ FindInnerNode()

MAXON_METHOD Result<GNodeHandle> FindInnerNode ( const GNodeHandle node,
const PathBlock innerPath 
) const
private

◆ GetBase() [2/2]

MAXON_METHOD const NodeSystem& GetBase ( const GNodeHandle node) const
private

◆ GetBases() [2/2]

MAXON_METHOD const Block<const NodeSystem>& GetBases ( const GNodeHandle node) const
private

◆ GetAllBases() [2/2]

MAXON_METHOD Result<Bool> GetAllBases ( const GNodeHandle node,
const ValueReceiver< const NodeSystem & > &  receiver 
) const
private

◆ AddBase()

MAXON_METHOD Result<void> AddBase ( const NodeSystem other)
private

◆ GetTemplate() [2/2]

MAXON_METHOD const NodeTemplate& GetTemplate ( const GNodeHandle node) const
private

◆ GetAllTemplates()

MAXON_METHOD Result<Bool> GetAllTemplates ( const GNodeHandle node,
const ValueReceiver< const NodeTemplate & > &  receiver 
) const
private

◆ GetDerivationHandler() [2/2]

MAXON_METHOD const NodeSystemDerivationHandler& GetDerivationHandler ( const GNodeHandle node) const
private

◆ FindHandle() [1/2]

MAXON_METHOD Result<GNodeHandle> FindHandle ( const PathBlock path) const
private

◆ FindHandle() [2/2]

MAXON_METHOD GNodeHandle FindHandle ( const NodePath &  path) const
private

◆ PrivateValidate()

MAXON_METHOD Bool PrivateValidate ( const GNodeHandle handle) const
private

◆ GetFlags()

MAXON_METHOD GNODE_FLAGS GetFlags ( const GNodeHandle port) const
private

◆ InitIterator()

MAXON_METHOD Result<void> InitIterator ( const GNodeHandle node,
GNodeIteratorBase iterator 
) const
private

◆ MoveToNext()

MAXON_METHOD Result<void> MoveToNext ( GNodeIteratorBase iterator) const
private

◆ Validate()

MAXON_METHOD Result<void> Validate ( ChangeList *  change)
private

◆ ValidateTopology()

MAXON_METHOD Result<void> ValidateTopology ( )
private

◆ ValidatePorts()

MAXON_METHOD Result<void> ValidatePorts ( ChangeList *  change)
private

◆ BeginModificationImpl()

MAXON_METHOD Result<void> BeginModificationImpl ( const AssetRepositoryRef &  lookup)
private

◆ EndModificationImpl()

MAXON_METHOD Result<void> EndModificationImpl ( ChangeList *  change,
FINALIZE_FLAGS  finalize 
)
private

◆ Compact()

MAXON_METHOD Result<void> Compact ( )
private

◆ Apply()

MAXON_METHOD Result<ChangeList> Apply ( const ChangeList &  toApply,
Bool  inverse,
ChangeList *  list 
)
private

◆ Update()

MAXON_METHOD Result<void> Update ( const Block< const Tuple< AssetReference, AssetBase >> &  updates,
const AssetRepositoryRef &  lookup,
ChangeList *  list 
)
private

◆ AddChild() [1/2]

MAXON_METHOD Result<GNodeHandle> AddChild ( const Id child,
const NodeSystem base,
ChangeList *  list 
)
private

◆ ReplaceBase()

MAXON_METHOD Result<ChangeList> ReplaceBase ( const NodeSystem base,
ChangeList *  list 
)
private

◆ ReplaceChildren()

MAXON_METHOD Result<ChangeList> ReplaceChildren ( const Block< const Tuple< InternedId, NodeSystem >> &  newChildren,
ChangeList *  list 
)
private

◆ MoveToGroup()

MAXON_METHOD Result<GNodeHandle> MoveToGroup ( MutableRoot &&  groupRoot,
const Id groupId,
const Block< const InternedId > &  selection,
Bool  matchPorts,
const FixedSizeArray< Block< const Tuple< NodePath, NodePath, NodePath >>, 2 > &  mapping,
ChangeList *  list 
)
private

◆ MoveToNodeSystem()

MAXON_METHOD Result<NodeSystem> MoveToNodeSystem ( const GNodeHandle node,
ChangeList *  list 
)
private

◆ Ungroup()

MAXON_METHOD Result<HashMap<InternedId, InternedId> > Ungroup ( const GNodeHandle node,
ChangeList *  list 
)
private

◆ Merge()

MAXON_METHOD Result<HomogenousTupleType<3, HashMap<InternedId, InternedId> > > Merge ( const NodeSystem other,
ChangeList *  list 
)
private

◆ Duplicate()

MAXON_METHOD Result<HomogenousTupleType<3, HashMap<InternedId, InternedId> > > Duplicate ( const Block< const NodePath > &  selection,
Bool  withConnections,
ChangeList *  list 
)
private

◆ AddChild() [2/2]

MAXON_METHOD Result<GNodeHandle> AddChild ( const GNodeHandle node,
const Id port,
GNODE_FLAGS  flags,
ChangeList *  list 
)
private

◆ InheritChild()

MAXON_METHOD Result<void> InheritChild ( const GNodeHandle parent,
const InternedId childId,
ChangeList *  list 
)
private

◆ Remove()

MAXON_METHOD Result<void> Remove ( const GNodeHandle child,
ChangeList *  list 
)
private

◆ Connect()

MAXON_METHOD Result<void> Connect ( const GNodeHandle source,
const GNodeHandle target,
Wires  modes,
ChangeList *  list 
)
private

◆ GetConnections()

MAXON_METHOD Result<Bool> GetConnections ( const GNodeHandle source,
PORT_DIR  dir,
const ValueReceiver< const MutableConnection & > &  conns,
Wires  mask,
GET_CONNECTIONS_MODE  mode 
)
private

◆ GetWires()

MAXON_METHOD Result<Wires> GetWires ( const GNodeHandle source,
const GNodeHandle target 
) const
private

◆ GetConnectionValues()

MAXON_METHOD Result<Bool> GetConnectionValues ( const GNodeHandle source,
const GNodeHandle target,
const ValueReceiver< CONNECTION_POSITION, InternedId, const ConstDataPtr & > &  receiver 
) const
private

◆ GetConnectionValue()

MAXON_METHOD Result<ConstDataPtr> GetConnectionValue ( const GNodeHandle source,
const GNodeHandle target,
CONNECTION_POSITION  position,
const InternedId attr,
const DataType expectedType 
) const
private

◆ SetConnectionValue()

MAXON_METHOD Result<Bool> SetConnectionValue ( const GNodeHandle source,
const GNodeHandle target,
CONNECTION_POSITION  position,
const InternedId attr,
ForwardingDataPtr &&  value,
ChangeList *  list 
)
private

◆ GetValues()

MAXON_METHOD Result<void> GetValues ( const GNodeHandle port,
GraphAttribute::FLAGS  mask,
GraphAttributeMap attribs,
Bool  includeInherited,
Bool  includeRemoved 
) const
private

◆ GetValue() [1/2]

MAXON_METHOD Result<ConstDataPtr> GetValue ( const GNodeHandle port,
const InternedId attr,
const DataType expectedType 
) const
private

◆ GetValue() [2/2]

MAXON_METHOD Result<ConstDataPtr> GetValue ( const GNodeHandle port,
const InternedId attr,
const DataType expectedType,
Int nesting,
Bool  negativeRootNesting 
) const
private

◆ GetBaseValues()

MAXON_METHOD Result<Bool> GetBaseValues ( const GNodeHandle port,
const InternedId attr,
const DataType expectedType,
const ValueReceiver< const ConstDataPtr &, Int > &  values 
) const
private

◆ TouchValue()

MAXON_METHOD Result<void> TouchValue ( const GNodeHandle port,
const InternedId attr,
ChangeList *  list 
)
private

◆ ChangeValue()

MAXON_METHOD Result<void> ChangeValue ( const GNodeHandle port,
const InternedId attr,
const SubDataOperation &  op,
const SubDataPathBlock path,
ForwardingDataPtr &&  subvalue,
ChangeList *  change 
)
private

◆ InheritValue()

MAXON_METHOD Result<Bool> InheritValue ( const GNodeHandle port,
const InternedId attr,
ChangeList *  list 
)
private

◆ RemoveValue()

MAXON_METHOD Result<Bool> RemoveValue ( const GNodeHandle port,
const InternedId attr,
ChangeList *  list 
)
private

◆ GetAttributeModificationsSince()

MAXON_METHOD Result<Bool> GetAttributeModificationsSince ( const GNodeHandle node,
TimeStamp  stamp,
const ValueReceiver< InternedId, ConstDataPtr > &  receiver 
) const
private

◆ GetAttributeStamp()

MAXON_METHOD TimeStamp GetAttributeStamp ( const GNodeHandle node,
const InternedId attr 
) const
private

◆ GetConnectionStamp()

MAXON_METHOD TimeStamp GetConnectionStamp ( const GNodeHandle node,
PORT_DIR  direction 
) const
private

◆ AddChildren()

MAXON_METHOD Result<void> AddChildren ( const Block< Tuple< InternedId, NodeSystem, GNodeHandle >> &  children,
ChangeList *  list 
)
private

◆ ReplaceChild()

MAXON_METHOD Result<ChangeList> ReplaceChild ( const InternedId childId,
const NodeSystem base,
const HashMap< NodePath, NodePath > &  portMap,
ChangeList *  list 
)
private

◆ GetReferencedAssets()

MAXON_METHOD Result<Bool> GetReferencedAssets ( Bool  onlyUpdatable,
const ValueReceiver< const AssetReference & > &  receiver 
) const

Yields all direct references which this asset instance makes to other assets. The AssetReference objects are used later for the update mechanism. The method UpdatableAssetInterface::Update gets a block of tuples (AssetReference, AssetBase) as input, and each tuple indicates to which asset an AssetReference shall be updated. So for example if an asset has two links to the same asset this has to be reported as two AssetReference objects, and when only the first one is passed to UpdatableAssetInterface::Update only the first link has to be updated, while the second has to remain unchanged.

Parameters
[in]onlyUpdatableIf true only references which use updatable links shall be reported (update policy different from ASSET_UPDATE_POLICY::NEVER), otherwise all references.
[in]receiverReceiver to which references are reported.
Returns
False if the receiver cancelled further evaluation, true otherwise.

Friends And Related Function Documentation

◆ GNodeIteratorBase

friend class GNodeIteratorBase
friend

◆ GNodeIterator

friend class GNodeIterator
friend

◆ GNodeFunctions

friend class GNodeFunctions
friend

◆ MutableGNodeFunctions

friend class MutableGNodeFunctions
friend

◆ NodeFunctions

friend class NodeFunctions
friend

◆ PortListFunctions

friend class PortListFunctions
friend

◆ MutablePortListFunctions

friend class MutablePortListFunctions
friend

◆ PortFunctions

friend class PortFunctions
friend

◆ MutablePortFunctions

friend class MutablePortFunctions
friend

◆ GNode

friend class GNode
friend

◆ GNodeBase

friend class GNodeBase
friend

◆ MutableGNode

friend class MutableGNode
friend

◆ MutableNode

friend class MutableNode
friend

◆ MutableRoot

friend class MutableRoot
friend

◆ MutablePortList

friend class MutablePortList
friend

◆ Port

friend class Port
friend

◆ MutablePort

friend class MutablePort
friend

◆ NodeSystemImpl

friend class NodeSystemImpl
friend

◆ NodesLibImpl

friend class NodesLibImpl
friend

◆ CompiledNodeImpl

friend class CompiledNodeImpl
friend

◆ NodesGraphModelImpl

friend class NodesGraphModelImpl
friend

◆ NodeSystemManagerImpl

friend class NodeSystemManagerImpl
friend

◆ NodeSystemBasedTemplateImpl

friend class NodeSystemBasedTemplateImpl
friend

◆ CoreNodeWrapperImpl

friend class CoreNodeWrapperImpl
friend

Member Data Documentation

◆ MAXON_INTERFACE_SINGLE_IMPLEMENTATION

MAXON_INTERFACE_SINGLE_IMPLEMENTATION
private

◆ VALUE_CHAIN

constexpr WIRE_MODE VALUE_CHAIN
staticconstexpr

◆ VALUE_SECONDARY

constexpr WIRE_MODE VALUE_SECONDARY
staticconstexpr

◆ VALUE_DEFAULT

constexpr WIRE_MODE VALUE_DEFAULT
staticconstexpr

◆ VALUE_COUNTERCHAIN

constexpr WIRE_MODE VALUE_COUNTERCHAIN
staticconstexpr

◆ DEPENDENCY_TYPE

constexpr WIRE_MODE DEPENDENCY_TYPE
staticconstexpr

◆ DEPENDENCY_COMPONENT

constexpr WIRE_MODE DEPENDENCY_COMPONENT
staticconstexpr