SerializationNodeData Class Reference

#include <nodes_import.h>

Detailed Description

SerializationNodeData represents the data of a Node, PortList or Port for serialization. It can be adapted by an ImportAdapter to the current version, for example if attribute values shall be modified. @MAXON_ANNOTATION{noUnresolved}

Public Types

enum class  CHILD_MODE {
  ADD ,
  INHERIT ,
  REMOVE
}
 

Public Member Functions

MAXON_METHOD const NodePath & GetPath () const
 
MAXON_METHOD MapInterface< InternedId, Data > & GetAttributes ()
 
MAXON_METHOD MapInterface< NodePath, Wires > & GetTargets ()
 
MAXON_METHOD IdAndVersionGetBaseTemplate ()
 
MAXON_METHOD DataDictionary & GetBaseTemplateArguments ()
 
MAXON_METHOD Result< BoolGetChildren (const ValueReceiver< SerializationNodeData & > &receiver)
 
MAXON_METHOD SerializationNodeDataFindChild (const Id &child)
 
MAXON_METHOD void RemoveChild (const Id &child)
 
enum maxon::nodes::SerializationNodeData::CHILD_MODE MAXON_ENUM_LIST_CLASS (CHILD_MODE)
 
MAXON_METHOD Result< SerializationNodeData * > FindOrAddChild (const InternedId &child, CHILD_MODE mode, const IdAndVersion &base=GetZeroRef< IdAndVersion >(), const DataDictionary &baseArgs=DataDictionary::NullValue(), ASSET_UPDATE_POLICY updatePolicy=ASSET_UPDATE_POLICY::IMPLICIT)
 
MAXON_METHOD ASSET_UPDATE_POLICYGetUpdatePolicy ()
 
MAXON_METHOD CHILD_MODE GetChildMode () const
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (SerializationNodeData, MAXON_REFERENCE_NONE, "net.maxon.node.interface.serializationdata")
 

Member Enumeration Documentation

◆ CHILD_MODE

enum CHILD_MODE
strong

This enum is used for the mode parameter of FindOrAddChild.

Enumerator
ADD 

Add the child node, it doesn't exist in a base.

INHERIT 

Inherit the child node, it already exists in a base.

REMOVE 

Remove the child node which would otherwise be inherited from a base.

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( SerializationNodeData  ,
MAXON_REFERENCE_NONE  ,
"net.maxon.node.interface.serializationdata"   
)
private

◆ GetPath()

MAXON_METHOD const NodePath& GetPath ( ) const

Returns the complete node path of this node.

Returns
Path of this node.

◆ GetAttributes()

MAXON_METHOD MapInterface<InternedId, Data>& GetAttributes ( )

Returns the attributes of this node. An ImportAdapter can use this to modify, add or remove attribute values.

Returns
Attributes of this node as a map.

◆ GetTargets()

MAXON_METHOD MapInterface<NodePath, Wires>& GetTargets ( )

Returns the targets of this port. The map represents the outgoing connections of a port where the target port is identified by its path. An ImportAdapter can modify the connections by direct modification of the map.

Returns
Outgoing connections of this port as a map.

◆ GetBaseTemplate()

MAXON_METHOD IdAndVersion& GetBaseTemplate ( )

Returns the asset identifier of the base template of the node system data. An ImportAdapter can modify the identifier to handle renamings of node assets. The asset identifier is defined only for true nodes, but not if this serialization node represents a port or port list.

Returns
Asset identifier of the base template.

◆ GetBaseTemplateArguments()

MAXON_METHOD DataDictionary& GetBaseTemplateArguments ( )

Returns the template arguments for the base template of the node system data. Template arguments are defined only for true nodes, but not if this serialization node represents a port or port list.

Returns
Template arguments for base template.

◆ GetChildren()

MAXON_METHOD Result<Bool> GetChildren ( const ValueReceiver< SerializationNodeData & > &  receiver)

Yields the children of this node to #receiver.

Parameters
[in]receiverAll children are reported to this receiver.

◆ FindChild()

MAXON_METHOD SerializationNodeData* FindChild ( const Id child)

Finds the child of this node with the given identifer.

Parameters
[in]childIdentifier of the child.
Returns
Found child or nullptr.

◆ RemoveChild()

MAXON_METHOD void RemoveChild ( const Id child)

Removes the child of this node with the given identifer (if it exists).

Parameters
[in]childIdentifier of the child.

◆ MAXON_ENUM_LIST_CLASS()

◆ FindOrAddChild()

MAXON_METHOD Result<SerializationNodeData*> FindOrAddChild ( const InternedId child,
CHILD_MODE  mode,
const IdAndVersion base = GetZeroRef< IdAndVersion >(),
const DataDictionary &  baseArgs = DataDictionary::NullValue(),
ASSET_UPDATE_POLICY  updatePolicy = ASSET_UPDATE_POLICY::IMPLICIT 
)

Adds a new child node entry to the serialization data, or returns the already existing one. The added parameter has to be set correctly:

  • Either the node would already exist in the deserialized NodeSystem even without the added child entry. That's when the node is inherited from a base, and you just want to override some of its properties or need access to nested nodes. Then you have to use CHILD_MODE::INHERIT for mode, and it's not necessary to set the base template.
  • Or the node wouldn't exist in the deserialized NodeSystem. Then you have to use CHILD_MODE::ADD for added, and in case of a true node (instead of a port) you have to set the correct values for the base template.
  • Or you want to remove a node which otherwise would be inherited from a base, then you have to use CHILD_MODE::REMOVE. If the child node entry already existed before, the given arguments for the base template are ignored.
    Parameters
    [in]childIdentifier of the child.
    [in]modeCHILD_MODE::ADD if the child node didn't exist in the deserialized NodeSystem without the new child node entry, CHILD_MODE::INHERIT if the child node is inherited from a base, or CHILD_MODE::REMOVE if you want to flag an inherited node as to be removed.
    [in]baseIdentifier of the base template to use for the node. Only needed for true nodes when mode is CHILD_MODE::ADD.
    [in]baseArgsIdentifier of the base template arguments to use for the node. Only needed for true nodes when mode is CHILD_MODE::ADD.
    [in]updatePolicyThe update policy to use when the base template is resolved. Only needed for true nodes when mode is CHILD_MODE::ADD.
    Returns
    Added (or already existing) child node.

◆ GetUpdatePolicy()

MAXON_METHOD ASSET_UPDATE_POLICY& GetUpdatePolicy ( )

Returns a reference to the asset update policy for the base template of the node system data. The update policy is used only for true nodes, but not if this serialization node represents a port or port list.

Returns
Asset update policy for the base template.

◆ GetChildMode()

MAXON_METHOD CHILD_MODE GetChildMode ( ) const

Returns the child mode of this entry.

Returns
Child mode of entry.