GraphLib Class Reference

#include <graph.h>

Detailed Description

GraphLib contains some static functions for graphs.

Static Public Member Functions

static MAXON_METHOD Result< GraphAttribute > CreateAttribute (const InternedId &attr, GraphAttributeInterface::FLAGS flags)
 
static MAXON_METHOD Result< GraphMessage > CreateMessage (GraphAttributeInterface::FLAGS flags, const NodePath &origin, const ConstDataPtr &value)
 
static MAXON_METHOD Result< GraphModelRef > CreateSimpleGraphModel ()
 
static MAXON_METHOD Result< void > WriteGml (const GraphModelRef &graph, UrlOrOutputStream &&output)
 
static MAXON_METHOD ErrorInterface::PartFormatter CreatePathFormatter (const GraphModelRef &graph)
 
static MAXON_METHOD Result< NodePath > ExtractNodePath (const String &message)
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (GraphLib, MAXON_REFERENCE_STATIC, "net.maxon.graph.interface.graphlib", MAXON_IMPLEMENTATION_MODULE("net.maxon.nodes"))
 

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( GraphLib  ,
MAXON_REFERENCE_STATIC  ,
"net.maxon.graph.interface.graphlib"  ,
MAXON_IMPLEMENTATION_MODULE("net.maxon.nodes")   
)
private

◆ CreateAttribute()

static MAXON_METHOD Result<GraphAttribute> CreateAttribute ( const InternedId attr,
GraphAttributeInterface::FLAGS  flags 
)
static

Creates a GraphAttribute with the given name and flags

Parameters
[in]attrThe name of the attribute.
[in]flagsThe flags of the attribute.
Returns
A new GraphAttribute with the given name and flags.

◆ CreateMessage()

static MAXON_METHOD Result<GraphMessage> CreateMessage ( GraphAttributeInterface::FLAGS  flags,
const NodePath &  origin,
const ConstDataPtr value 
)
static

Creates a GraphMessage.

Parameters
[in]flagsThe flags of the message.
[in]originThe origin of the message.
[in]valueThe ToString function of value will be called to implement GraphMessageInterface::Format.
Returns
A new GraphMessage for the given parameters.

◆ CreateSimpleGraphModel()

static MAXON_METHOD Result<GraphModelRef> CreateSimpleGraphModel ( )
static

Creates a new instance of a simple implementation of GraphModelInterface. The simple graph model only manages plain nodes, ports and connections, but it doesn't support advanced features like inheritance from base graphs, derived attributes, implicit connections, rollback of transactions or change lists.

Returns
A new GraphModelRef which uses a simple implementation of GraphModelInterface.

◆ WriteGml()

static MAXON_METHOD Result<void> WriteGml ( const GraphModelRef &  graph,
UrlOrOutputStream &&  output 
)
static

Writes a graph to a GML file (Graph Modeling Language).

Parameters
[in]graphThe graph to write.
[in]outputThe output stream to write to.

◆ CreatePathFormatter()

static MAXON_METHOD ErrorInterface::PartFormatter CreatePathFormatter ( const GraphModelRef &  graph)
static

Returns a PartFormatter which formats NodePath and GraphNode parts using their effective names. Also DataType parts are formatted with the help of DataTypeBuilderInterface::GetDataTypeName.

Parameters
[in]graphThe graph to use for name lookup.
Returns
A PartFormatter which can be used to format node-related error messages.

◆ ExtractNodePath()

static MAXON_METHOD Result<NodePath> ExtractNodePath ( const String message)
static

Extracts a node path from the given message. If the message was formatted by the formatter created by CreatePathFormatter, this function will find the first occurrence of a formatted node path and return its original NodePath. Otherwise it will return an empty node path (unless the message happens to contain a substring which matches a formatted node path).

Parameters
[in]messageAn error message created by CreatePathFormatter.
Returns
The NodePath of the first path contained in the message, or an empty path if no path can be found.