ImportAdapterInterface Class Reference

#include <nodes_import.h>

Inheritance diagram for ImportAdapterInterface:

Detailed Description

An ImportAdapter is called right after node system data has been read from a stream to adapt the data from the serialized version to the current version. For example, such an adapter can rename identifiers of referenced node templates or change attribute values.

You have to register an ImportAdapter at the ImportAdapters registry. Then it will be called on serialization to add version information to the stream, and on de-serialization to adapt to the current version.

Public Member Functions

MAXON_METHOD Result< void > BeforeWrite (SerializationNodeData &root) const
 
MAXON_METHOD Result< void > AfterRead (SerializationNodeData &root) const
 

Private Member Functions

 MAXON_INTERFACE (ImportAdapterInterface, MAXON_REFERENCE_CONST, "net.maxon.node.interface.importadapter", MAXON_IMPLEMENTATION_MODULE("net.maxon.nodes"))
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( ImportAdapterInterface  ,
MAXON_REFERENCE_CONST  ,
"net.maxon.node.interface.importadapter"  ,
MAXON_IMPLEMENTATION_MODULE("net.maxon.nodes")   
)
private

◆ BeforeWrite()

MAXON_METHOD Result<void> BeforeWrite ( SerializationNodeData root) const

Adds version information to the node data starting at #root before serialization. For example the implementation can tag certain nodes with version numbers so that the Adapt method knows their serialized version and can take appropriate actions to adapt to the current version.

Returns
The current version of this adapter, to be used for serialization.

◆ AfterRead()

MAXON_METHOD Result<void> AfterRead ( SerializationNodeData root) const

Adapts the node system data starting at #root. This method is called on de-serialization of node system data to allow for adaptations between different versions. #root gives write access to the de-serialized data.

Parameters
[in,out]rootThe SerializationNodeData root node of the de-serialized node system data.