GraphModelInterface Class Reference

#include <graph.h>

Inheritance diagram for GraphModelInterface:

Detailed Description

GraphModelInterface is an abstraction of a hierarchical graph. A GraphModelInterface has a single root node (see GetRoot()). The root node and any other node may have an arbitrary number of child nodes. Also each node may have a number of input ports and output ports, and those ports may have nested ports, too. So nodes and ports of a graph can be arranged in a single tree, for example:

In fact, GraphModelInterface represents nodes and ports by the same class GraphNode. To distinguish between the different kinds of a GraphNode, a value of type NODE_KIND is returned by GraphNode::GetKind(). The example tree shows the possible kinds in parentheses:

It is not required for an implementation of GraphModelInterface to support arbitrary nestings. For example, the implementation for nodes supports arbitrarily nested ports, but depending on its filter settings it doesn't support nodes nested within other nodes.

In addition to the tree of nodes and ports, a hierarchical graph also has a number of connections between ports. They are represented by GraphConnection. Typically a connection goes from an output port to an input port, but this is not always the case. The following connections are allowed:

  • An output port of a node may have a connection to an input port of a sibling node (so both nodes must have the same direct parent).
  • An input port of a child node may have a connection from an input port of its direct parent node.
  • An output port of a child node may have a connection to an output port of its direct parent node.
  • An input port of a node may have a connection to an output port of that same node (so the connections just tunnels the value through the node).

In all cases it doesn't matter if the ports are top-level ports or nested ports. This is an example graph which shows all four cases: @graph +-Root-------------------------------------—+ | ,-------------—> p o | +-N------—+ / | | | p o -* | o x --> o x —> x o \ +-M--—+ | o y --> o y —> y o `--> o p q o --> q o | +--------—+ +----—+ | +------------------------------------------—+ @endgraph

Each node may have attributes. An attribute is identified by an InternedId, typically this id is defined together with the type of the attribute value by MAXON_ATTRIBUTE.

Public Types

enum class  GET_CONNECTIONS_MODE {
  NONE ,
  CONNECTIONS ,
  INDUCED_DEPENDENCIES ,
  DERIVATION_FILTER ,
  EXTERNAL_CONNECTIONS ,
  WITHOUT_INHIBITED ,
  INCLUDE_HIDDEN ,
  INTERNAL_CONNECTIONS ,
  SKIP_REROUTER
}
 
enum class  MODIFIED {
  NONE ,
  COMPLETE ,
  DIRECT_ATTRIBUTE ,
  DIRECT_META_ATTRIBUTE ,
  INHERITED_ATTRIBUTE ,
  SYNTHESIZED_ATTRIBUTE ,
  USER_STATE_ATTRIBUTE ,
  NODE_ADDED ,
  CHILD_REMOVED ,
  INPUT_CONNECTION ,
  OUTPUT_CONNECTION ,
  SPECIAL0 ,
  SPECIAL1 ,
  SPECIAL_NAME ,
  ALL_MASK ,
  DERIVED_ATTRIBUTE_MASK ,
  DIRECT_ATTRIBUTE_MASK ,
  DATA_ATTRIBUTE_MASK ,
  ATTRIBUTE_MASK ,
  CONNECTION_MASK ,
  NODE_MASK ,
  STRUCTURE_MASK
}
 

Public Member Functions

enum maxon::GraphModelInterface::GET_CONNECTIONS_MODE MAXON_ENUM_FLAGS_CLASS (GET_CONNECTIONS_MODE)
 
MAXON_METHOD const NodePath & GetRootPath ()
 
MAXON_METHOD GraphNode GetRoot ()
 
MAXON_METHOD Bool IsReadOnly ()
 
MAXON_METHOD GraphNode GetNode (const NodePath &path, Bool filtered=true)
 
MAXON_METHOD Result< GraphNodeGetNode (const PathBlock &path, Bool filtered=true)
 
MAXON_METHOD Result< void > Validate ()
 
MAXON_METHOD void ResetUserState (const InternedId &attr)
 
MAXON_METHOD const GraphAttribute & GetGraphAttribute (const InternedId &attr)
 
MAXON_METHOD GraphAttribute::FLAGS GetGraphAttributeFlags (const InternedId &attr)
 
MAXON_FUNCTION Result< GraphTransactionBeginTransaction (const DataDictionary &userData=GetPtrSizedZeroRef< DataDictionary >())
 
MAXON_METHOD Int GetTransactionCount ()
 
MAXON_METHOD Result< GraphNodeAddChild (const Id &childId, const Id &nodeId, const DataDictionary &args=DataDictionary::NullValue())
 
 MAXON_OBSERVABLE (void, ObservableTransactionStarted,(const GraphModelRef &graph, const DataDictionary &userData), ObservableCombinerRunAllComponent)
 
 MAXON_OBSERVABLE (void, ObservableTransactionCommitted,(const GraphModelRef &graph, const DataDictionary &userData), ObservableCombinerRunAllComponent)
 
 MAXON_OBSERVABLE (void, ObservableTransactionRolledBack,(const GraphModelRef &graph), ObservableCombinerRunAllComponent)
 
MAXON_METHOD TimeStamp GetModificationStamp ()
 
enum maxon::GraphModelInterface::MODIFIED MAXON_ENUM_FLAGS_CLASS (MODIFIED)
 
MAXON_METHOD Result< BoolGetModificationsSince (TimeStamp stamp, const ValueReceiver< const GraphNode &, MODIFIED > &receiver, Bool filtered=true)
 
MAXON_METHOD MODIFIED GetModificationsSince (TimeStamp stamp)
 
MAXON_METHOD const ChangeList & GetChangeList ()
 
MAXON_METHOD Result< ChangeList > StartNewChangeList ()
 
MAXON_METHOD Result< ChangeList > Apply (const ChangeList &list, Bool inverse)
 
MAXON_METHOD Result< GraphModelRef > CreateCopyOfSelection (const Block< const GraphNode > &selection)
 
MAXON_METHOD Result< HomogenousTupleType< 3, HashMap< InternedId, InternedId > > > Merge (const GraphModelRef &other)
 
MAXON_METHOD const DataGetUserState (const NodePath &path, const InternedId &attr)
 
MAXON_METHOD Result< HomogenousTupleType< 3, HashMap< InternedId, InternedId > > > Duplicate (const Block< const GraphNode > &selection, Bool withConnections)
 

Protected Member Functions

MAXON_METHOD NODE_KIND GetKind (const GraphNode &node)
 
MAXON_METHOD const NodePath & GetPath (const GraphNode &node)
 
MAXON_METHOD Result< BoolGetChildren (const GraphNode &node, const ValueReceiver< const GraphNode & > &callback, NODE_KIND filter=NODE_KIND::ALL_MASK)
 
MAXON_METHOD Result< GraphNodeGetParent (const GraphNode &node)
 
MAXON_METHOD Result< GraphNodeGetAncestor (const GraphNode &node, NODE_KIND kind)
 
MAXON_METHOD Result< GraphNodeFindChild (const GraphNode &node, const InternedId &name, NODE_KIND kind=NODE_KIND::ALL_MASK)
 
MAXON_METHOD Result< GraphNodeFindInnerNode (const GraphNode &node, const PathBlock &innerPath)
 
MAXON_METHOD Result< BoolGetInnerNodes (const GraphNode &node, NODE_KIND mask, Bool includeNode, const ValueReceiver< const GraphNode & > &receiver)
 
MAXON_METHOD Result< void > Remove (const GraphNode &node)
 
MAXON_METHOD Result< void > RemovePorts (const GraphNode &parent, const Block< const InternedId > &ports)
 
MAXON_METHOD Result< GraphNodeAddPort (const GraphNode &parent, const Id &name)
 
MAXON_METHOD Result< BaseArray< GraphNode > > AddPorts (const GraphNode &parent, Int index, Int count)
 
MAXON_METHOD Result< BoolGetConnections (const GraphNode &node, PORT_DIR dir, const ValueReceiver< const GraphConnection & > &callback, Wires mask=Wires::All(), GraphModelInterface::GET_CONNECTIONS_MODE mode=GraphModelInterface::GET_CONNECTIONS_MODE::CONNECTIONS)
 
MAXON_METHOD Result< BoolPrivateGetConnections (const GraphNode &node, PORT_DIR dir, const ValueReceiver< const GraphConnection & > &callback, Wires inputMask, Wires outputMask, GraphModelInterface::GET_CONNECTIONS_MODE mode)
 
MAXON_METHOD Result< WiresGetWires (const GraphNode &source, const GraphNode &target)
 
MAXON_METHOD Result< void > Connect (const GraphNode &source, const GraphNode &target, Wires wires=WIRE_MODE::CONNECT_DEFAULT)
 
MAXON_METHOD Result< void > RemoveConnections (const GraphNode &port, PORT_DIR dir, Wires mask)
 
MAXON_METHOD Result< void > CopyConnectionsFrom (const GraphNode &dest, const GraphNode &source, PORT_DIR direction, Bool includeInner)
 
MAXON_METHOD Result< BoolGetConnectionValues (const GraphNode &source, const GraphNode &target, const ValueReceiver< CONNECTION_POSITION, InternedId, const ConstDataPtr & > &receiver)
 
MAXON_METHOD Result< ConstDataPtrGetConnectionValue (const GraphNode &source, const GraphNode &target, CONNECTION_POSITION position, const InternedId &attr, const DataType &expectedType)
 
MAXON_METHOD Result< BoolSetConnectionValue (const GraphNode &source, const GraphNode &target, CONNECTION_POSITION position, const InternedId &attr, ForwardingDataPtr &&value)
 
MAXON_METHOD Result< void > GetValues (const GraphNode &node, GraphAttributeInterface::FLAGS mask, GraphAttributeMap &map)
 
MAXON_METHOD Result< ConstDataPtrGetValue (const GraphNode &node, const InternedId &attr, const DataType &expectedType)
 
MAXON_METHOD Result< ConstDataPtrGetStoredValue (const GraphNode &node, const InternedId &attr, const DataType &expectedType)
 
MAXON_METHOD Result< BoolGetBaseValues (const GraphNode &node, const InternedId &attr, const DataType &expectedType, const ValueReceiver< const ConstDataPtr &, Int > &valueReceiver)
 
MAXON_METHOD Result< BoolSetValue (const GraphNode &node, const InternedId &attr, ForwardingDataPtr &&value, Bool checkAndInvalidate)
 
MAXON_METHOD Result< void > TouchValue (const GraphNode &node, const InternedId &attr)
 
MAXON_METHOD Result< void > ChangeValue (const GraphNode &node, const InternedId &attr, const SubDataOperation &op, const SubDataPathBlock &path, ForwardingDataPtr &&subvalue)
 
MAXON_METHOD Result< BoolRemoveValue (const GraphNode &node, const InternedId &attr)
 
MAXON_METHOD Result< BoolInheritValue (const GraphNode &node, const InternedId &attr)
 
MAXON_METHOD Result< void > CopyValuesFrom (const GraphNode &dest, const GraphNode &source, Bool includeInner)
 
MAXON_METHOD Result< GraphAttribute::FLAGS > GetMessageFlags (const GraphNode &node, const InternedId &attr)
 
MAXON_METHOD Result< BoolGetMessages (const GraphNode &node, const InternedId &attr, const ValueReceiver< const GraphMessage & > &receiver)
 
MAXON_METHOD Result< BoolGetAttributeModificationsSince (const GraphNode &node, TimeStamp stamp, const ValueReceiver< InternedId, ConstDataPtr > &receiver)
 
MAXON_METHOD Result< TimeStampGetAttributeStamp (const GraphNode &node, const InternedId &attr)
 
MAXON_METHOD Result< TimeStampGetConnectionStamp (const GraphNode &node, PORT_DIR direction)
 
MAXON_METHOD Result< IntBeginTransactionImpl (const DataDictionary &userData)
 
MAXON_METHOD Result< void > CommitImpl (const DataDictionary &userData, Int nesting, Bool validate)
 
MAXON_METHOD void RollbackImpl (Int nesting)
 
MAXON_METHOD void CopyConstruct (GraphNode &node, const GraphNode &src)
 
MAXON_METHOD void Destruct (GraphNode &node)
 
MAXON_METHOD Bool IsValid (const GraphNode &node)
 
MAXON_METHOD Bool IsSame (const GraphNode &a, const GraphNode &b)
 
MAXON_METHOD String NodeToString (const GraphNode &node, const FormatStatement *fs)
 
MAXON_METHOD Result< BoolIsConnectable (const GraphNode &src, const GraphNode &trg)
 

Private Member Functions

 MAXON_INTERFACE (GraphModelInterface, MAXON_REFERENCE_NORMAL, "net.maxon.graph.interface.graphmodel")
 

Friends

class GraphNode
 
class GraphTransaction
 
template<typename BASE >
class GraphNodeFunctions
 

Member Enumeration Documentation

◆ GET_CONNECTIONS_MODE

enum GET_CONNECTIONS_MODE
strong

This enum is needed for GraphNode::GetConnections to control which connections shall be reported. At least one of CONNECTIONS or INDUCED_DEPENDENCIES has to be set.

Enumerator
NONE 

No flags.

CONNECTIONS 

Report normal connections, the default.

INDUCED_DEPENDENCIES 

Report induced dependencies (due to loop dependencies or sequencing).

DERIVATION_FILTER 

Apply the derivation filter.

EXTERNAL_CONNECTIONS 

Only report connections which leave the node to which the port belongs (so they are external to the node).

WITHOUT_INHIBITED 

Don't report inhibited connections (those where Wires::inhibit is present).

INCLUDE_HIDDEN 

Report connections where the hidden flag is set or which go to hidden ports.

INTERNAL_CONNECTIONS 

Only report connections which don't leave the node to which the port belongs (so they are internal to the node).

SKIP_REROUTER 

Hop over rerouter nodes.

◆ MODIFIED

enum MODIFIED
strong

These flags are reported by GetModificationsSince() to tell which properties of the node have changed.

Enumerator
NONE 

No flag.

COMPLETE 

The graph has changed completely. This is only reported for the root node.

DIRECT_ATTRIBUTE 

Direct non-meta attributes of the node have changed.

DIRECT_META_ATTRIBUTE 

Direct meta attributes of the node have changed (see GraphAttributeInterface::FLAGS::META).

INHERITED_ATTRIBUTE 

Inherited attributes (derived from left to right) of the node have changed.

SYNTHESIZED_ATTRIBUTE 

Synthesized attributes (derived from right to left) of the node have changed.

USER_STATE_ATTRIBUTE 

User state attributes of the node have changed (see GraphAttributeInterface::FLAGS::USER_STATE).

NODE_ADDED 

The node has been added.

CHILD_REMOVED 

Children of the node have been removed.

INPUT_CONNECTION 

Input connections of the port have changed.

OUTPUT_CONNECTION 

Output connections of the port have changed.

SPECIAL0 

This is set to indicate a special change, the exact meaning is graph-specific.

SPECIAL1 

This is set to indicate a special change, the exact meaning is graph-specific.

SPECIAL_NAME 

This is set to indicate a change which affects names of nodes or ports.

ALL_MASK 

A mask containing all possible MODIFIED bits.

DERIVED_ATTRIBUTE_MASK 

Derived attributes of the node have changed.

DIRECT_ATTRIBUTE_MASK 

Mask to test for changes to direct attributes (whether meta or non-meta).

DATA_ATTRIBUTE_MASK 

Mask to test for changes to attributes belonging to the data model of the graph (non-meta, non-user-state attributes).

ATTRIBUTE_MASK 

Mask to test for attribute changes.

CONNECTION_MASK 

Mask to test for connection changes of ports.

NODE_MASK 

Mask to test for added or removed nodes.

STRUCTURE_MASK 

Mask to test for any structural change (changed connections, added or removed nodes).

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( GraphModelInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.graph.interface.graphmodel"   
)
private

◆ MAXON_ENUM_FLAGS_CLASS() [1/2]

◆ GetRootPath()

MAXON_METHOD const NodePath& GetRootPath ( )

Returns the path of the root node of this graph. Usually this is an empty path, but a graph model may be a view of a nested part of an enclosing graph. In the latter case the path points to the root node of the nested part.

Returns
The path of the root node of this graph.

◆ GetRoot()

MAXON_METHOD GraphNode GetRoot ( )

Returns the root node of this graph. The whole graph can be traversed starting from the root node.

Returns
The root node of this graph.

◆ IsReadOnly()

MAXON_METHOD Bool IsReadOnly ( )

Checks if this graph is read-only. You can't modify read-only graphs.

Returns
true if this graph is read-only, otherwise false.

◆ GetNode() [1/2]

MAXON_METHOD GraphNode GetNode ( const NodePath &  path,
Bool  filtered = true 
)

Returns the GraphNode corresponding to path. If no such node exists in the graph, an empty node is returned.

Parameters
[in]pathA node path. This has to be an absolute path, so if the current graph is view of a nested part of an enclosing graph, the path has to be the full path starting at the root of the enclosing graph.
[in]filteredWith the default value of true the filter settings (if any) of this graph will be used. When false this is disabled, then you'll get a valid GraphNode even for paths which don't belong to this graph, but e.g. to nested graphs which are hidden by the filter settings.
Returns
The GraphNode corresponding to the path. This is empty when there is no such node in the graph.

◆ GetNode() [2/2]

MAXON_METHOD Result<GraphNode> GetNode ( const PathBlock path,
Bool  filtered = true 
)

Returns the GraphNode corresponding to path. If no such node exists in the graph, an empty node is returned.

Parameters
[in]pathA node path. This has to be an absolute path, so if the current graph is view of a nested part of an enclosing graph, the path has to be the full path starting at the root of the enclosing graph.
[in]filteredWith the default value of true the filter settings (if any) of this graph will be used. When false this is disabled, then you'll get a valid GraphNode even for paths which don't belong to this graph, but e.g. to nested graphs which are hidden by the filter settings.
Returns
The GraphNode corresponding to the path. This is empty when there is no such node in the graph.

◆ Validate()

MAXON_METHOD Result<void> Validate ( )

Validates the graph. This is an implementation-specific operation and should be invoked when a batch of changes has been applied to the graph and the graph should be brought into a valid state again. For example, the implementation of GraphModelInterface for nodes may update the type of an output port of a polymorphic node based on the types of the input ports.

◆ ResetUserState()

MAXON_METHOD void ResetUserState ( const InternedId attr)

Removes all values for the given user state attribute attr from this graph (so from all of its nodes).

Parameters
[in]attrA user state attribute.

◆ GetGraphAttribute()

MAXON_METHOD const GraphAttribute& GetGraphAttribute ( const InternedId attr)

Returns the GraphAttribute which this graph model uses for the attribute identified by attr. The model may return a null reference if it 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).

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

◆ GetGraphAttributeFlags()

MAXON_METHOD GraphAttribute::FLAGS GetGraphAttributeFlags ( const InternedId attr)

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

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

◆ BeginTransaction()

MAXON_FUNCTION Result<GraphTransaction> BeginTransaction ( const DataDictionary &  userData = GetPtrSizedZeroRef< DataDictionary >())

Begins a new transaction within which modifications can be made. You have to do this in order to modify the graph, modifications outside of transactions are not allowed (with the exception of changing user state attributes).

If there already is an active transaction, this will create a nested transaction. Otherwise a non-nested transaction starts, only then the observable GraphModelInterface::ObservableTransactionStarted informs its observers about the start of a transaction.

Parameters
[in]userDataUser data to pass to the observers of GraphModelInterface::ObservableTransactionStarted. Because nested transactions don't trigger the observable, the user data of them is ignored.
Returns
A GraphTransaction object to commit or rollback the transaction at a later point of time.

◆ GetTransactionCount()

MAXON_METHOD Int GetTransactionCount ( )

◆ AddChild()

MAXON_METHOD Result<GraphNode> AddChild ( const Id childId,
const Id nodeId,
const DataDictionary &  args = DataDictionary::NullValue() 
)

Adds an instance of the node given by the identifier nodeId as child of the root node to this graph. If #childId is empty, a UUID will be chosen as identifier of the child, otherwise #childId. In the latter case it is an error if this root node already has a child with that identifier.

Parameters
[in]childIdIdentifier for the child node (if empty, a UUID is chosen).
[in]nodeIdIdentifier for the type of the node to add. How this is resolved to an actual node type is model-specific.
[in]argsArguments to use for the node creation. The exact meaning is model-specific.
Returns
A GraphNode referencing the added child.

◆ MAXON_OBSERVABLE() [1/3]

MAXON_OBSERVABLE ( void  ,
ObservableTransactionStarted  ,
(const GraphModelRef &graph, const DataDictionary &userData ,
ObservableCombinerRunAllComponent   
)

Informs about the start of a transaction. This is called during BeginTransaction(), but only for outmost transactions (which aren't nested within other transactions).

Parameters
[in]graphThe graph at which the observer was registered.
[in]userDataThe user data given to GraphModelRef::BeginTransaction(). In case of nested transactions, this is the user data of the outmost (i.e. first) invocation.

◆ MAXON_OBSERVABLE() [2/3]

MAXON_OBSERVABLE ( void  ,
ObservableTransactionCommitted  ,
(const GraphModelRef &graph, const DataDictionary &userData ,
ObservableCombinerRunAllComponent   
)

Informs about the commit of a transaction. This is called during GraphTransaction::Commit(), but only for outmost transactions (which aren't nested within other transactions).

Parameters
[in]graphThe graph at which the observer was registered.
[in]userDataThe user data given to GraphTransaction::Commit(). In case of nested transactions, this is the merger of the user datas given to all commits.

◆ MAXON_OBSERVABLE() [3/3]

MAXON_OBSERVABLE ( void  ,
ObservableTransactionRolledBack  ,
(const GraphModelRef &graph)  ,
ObservableCombinerRunAllComponent   
)

Informs about the rollback of a transaction. This is called during GraphTransaction::Rollback(), but only for outmost transactions (which aren't nested within other transactions).

Parameters
[in]graphThe graph at which the observer was registered.

◆ GetModificationStamp()

MAXON_METHOD TimeStamp GetModificationStamp ( )

Returns a time stamp of this graph which can be used to test for modifications. Each transaction or change of user state increments the stamp. The time stamp is also needed for GetModificationsSince and GraphNodeFunctions::GetAttributeModificationsSince to get all modifications which have happened since then.

Returns
Modification time stamp of the graph.

◆ MAXON_ENUM_FLAGS_CLASS() [2/2]

enum maxon::GraphModelInterface::MODIFIED MAXON_ENUM_FLAGS_CLASS ( MODIFIED  )

◆ GetModificationsSince() [1/2]

MAXON_METHOD Result<Bool> GetModificationsSince ( TimeStamp  stamp,
const ValueReceiver< const GraphNode &, MODIFIED > &  receiver,
Bool  filtered = true 
)

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

TimeStamp stamp = graph.GetModificationStamp(); // get the reference time stamp
... // do some modifications
graph.GetModificationsSince(stamp,
[] (const GraphNode& node, GraphModelRef::MODIFIED mod) -> Result<Bool>
{
...
friend class GraphNode
Definition: graph.h:938
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:1519
Definition: node.h:10
Parameters
[in]stampA reference time stamp. Only modifications newer than this stamp are reported.
[in]receiverModifications are reported to this receiver.
[in]filteredWith the default value of true the filter settings (if any) of this graph will be used, so modifications to nodes which don't pass the filter aren't reported.
Returns
false if the receiver cancelled further evaluation, true otherwise.

◆ GetModificationsSince() [2/2]

MAXON_METHOD MODIFIED GetModificationsSince ( TimeStamp  stamp)

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.

◆ GetChangeList()

MAXON_METHOD const ChangeList& GetChangeList ( )

Returns the change list to which this graph model currently logs its modifications. A newly created graph model doesn't automatically create a change list, so to start logging you need to call StartNewChangeList() once. The change list can be used to undo or redo the changes or even to apply them to a different graph, see Apply().

Returns
Current change list, may be a null reference.

◆ StartNewChangeList()

MAXON_METHOD Result<ChangeList> StartNewChangeList ( )

Starts a new change list and returns the previous one. Afterwards the graph will log all modifications to the newly created change list. The new change list can be obtained with GetChangeList() or as the result of the next call to StartNewChangeList(). The returned change list contains all modifications which have been made since the previous call to StartNewChangeList(). You can pass it to Apply() to undo or redo the changes or apply them to a different graph.

Returns
Change list which contains the modifications since the previous call to StartNewChangeList().

◆ Apply()

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

Applies the given change list to this graph. For an undo set inverse to true, for a redo or if you want to apply the change list to a different graph use false.

Parameters
[in]listChange list to apply.
[in]inverseUse true if the inverse of the change list shall be applied (for an undo), false otherwise.
Returns
A new change list which contains those changes of list which couldn't be applied, for example the change of an attribute value at a node which doesn't exist in this graph.

◆ CreateCopyOfSelection()

MAXON_METHOD Result<GraphModelRef> CreateCopyOfSelection ( const Block< const GraphNode > &  selection)

Returns a new graph model which is a copy of the subgraph given by the selection.

Parameters
[in]selectionA selection of nodes. Nodes which aren't direct children of this graph are ignored.
Returns
A copy of the subgraph given by the selection.

◆ Merge()

MAXON_METHOD Result<HomogenousTupleType<3, HashMap<InternedId, InternedId> > > Merge ( const GraphModelRef &  other)

Merges the other graph into this graph. Top-level nodes and ports are added into this graph using new unique identifiers to prevent naming conflicts. The mapping from the original identifiers of other to the new ones is returned.

Parameters
[in]otherAnother graph to merge into this graph.
Returns
The mapping from original identifiers of other to the identifiers used for the merge:
  • first contains the mapping of top-level nodes.
  • second contains the mapping of top-level input ports.
  • third contains the mapping of top-level output ports.

◆ GetUserState()

MAXON_METHOD const Data* GetUserState ( const NodePath &  path,
const InternedId attr 
)

◆ GetKind()

MAXON_METHOD NODE_KIND GetKind ( const GraphNode node)
protected

◆ GetPath()

MAXON_METHOD const NodePath& GetPath ( const GraphNode node)
protected

◆ GetChildren()

MAXON_METHOD Result<Bool> GetChildren ( const GraphNode node,
const ValueReceiver< const GraphNode & > &  callback,
NODE_KIND  filter = NODE_KIND::ALL_MASK 
)
protected

◆ GetParent()

MAXON_METHOD Result<GraphNode> GetParent ( const GraphNode node)
protected

◆ GetAncestor()

MAXON_METHOD Result<GraphNode> GetAncestor ( const GraphNode node,
NODE_KIND  kind 
)
protected

◆ FindChild()

MAXON_METHOD Result<GraphNode> FindChild ( const GraphNode node,
const InternedId name,
NODE_KIND  kind = NODE_KIND::ALL_MASK 
)
protected

◆ FindInnerNode()

MAXON_METHOD Result<GraphNode> FindInnerNode ( const GraphNode node,
const PathBlock innerPath 
)
protected

◆ GetInnerNodes()

MAXON_METHOD Result<Bool> GetInnerNodes ( const GraphNode node,
NODE_KIND  mask,
Bool  includeNode,
const ValueReceiver< const GraphNode & > &  receiver 
)
protected

◆ Remove()

MAXON_METHOD Result<void> Remove ( const GraphNode node)
protected

◆ RemovePorts()

MAXON_METHOD Result<void> RemovePorts ( const GraphNode parent,
const Block< const InternedId > &  ports 
)
protected

◆ AddPort()

MAXON_METHOD Result<GraphNode> AddPort ( const GraphNode parent,
const Id name 
)
protected

◆ AddPorts()

MAXON_METHOD Result<BaseArray<GraphNode> > AddPorts ( const GraphNode parent,
Int  index,
Int  count 
)
protected

◆ GetConnections()

MAXON_METHOD Result<Bool> GetConnections ( const GraphNode node,
PORT_DIR  dir,
const ValueReceiver< const GraphConnection & > &  callback,
Wires  mask = Wires::All(),
GraphModelInterface::GET_CONNECTIONS_MODE  mode = GraphModelInterface::GET_CONNECTIONS_MODE::CONNECTIONS 
)
protected

◆ PrivateGetConnections()

MAXON_METHOD Result<Bool> PrivateGetConnections ( const GraphNode node,
PORT_DIR  dir,
const ValueReceiver< const GraphConnection & > &  callback,
Wires  inputMask,
Wires  outputMask,
GraphModelInterface::GET_CONNECTIONS_MODE  mode 
)
protected

◆ GetWires()

MAXON_METHOD Result<Wires> GetWires ( const GraphNode source,
const GraphNode target 
)
protected

◆ Connect()

MAXON_METHOD Result<void> Connect ( const GraphNode source,
const GraphNode target,
Wires  wires = WIRE_MODE::CONNECT_DEFAULT 
)
protected

◆ RemoveConnections()

MAXON_METHOD Result<void> RemoveConnections ( const GraphNode port,
PORT_DIR  dir,
Wires  mask 
)
protected

◆ CopyConnectionsFrom()

MAXON_METHOD Result<void> CopyConnectionsFrom ( const GraphNode dest,
const GraphNode source,
PORT_DIR  direction,
Bool  includeInner 
)
protected

◆ GetConnectionValues()

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

◆ GetConnectionValue()

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

◆ SetConnectionValue()

MAXON_METHOD Result<Bool> SetConnectionValue ( const GraphNode source,
const GraphNode target,
CONNECTION_POSITION  position,
const InternedId attr,
ForwardingDataPtr &&  value 
)
protected

◆ GetValues()

MAXON_METHOD Result<void> GetValues ( const GraphNode node,
GraphAttributeInterface::FLAGS  mask,
GraphAttributeMap map 
)
protected

◆ GetValue()

MAXON_METHOD Result<ConstDataPtr> GetValue ( const GraphNode node,
const InternedId attr,
const DataType expectedType 
)
protected

◆ GetStoredValue()

MAXON_METHOD Result<ConstDataPtr> GetStoredValue ( const GraphNode node,
const InternedId attr,
const DataType expectedType 
)
protected

◆ GetBaseValues()

MAXON_METHOD Result<Bool> GetBaseValues ( const GraphNode node,
const InternedId attr,
const DataType expectedType,
const ValueReceiver< const ConstDataPtr &, Int > &  valueReceiver 
)
protected

◆ SetValue()

MAXON_METHOD Result<Bool> SetValue ( const GraphNode node,
const InternedId attr,
ForwardingDataPtr &&  value,
Bool  checkAndInvalidate 
)
protected

◆ TouchValue()

MAXON_METHOD Result<void> TouchValue ( const GraphNode node,
const InternedId attr 
)
protected

◆ ChangeValue()

MAXON_METHOD Result<void> ChangeValue ( const GraphNode node,
const InternedId attr,
const SubDataOperation &  op,
const SubDataPathBlock path,
ForwardingDataPtr &&  subvalue 
)
protected

◆ RemoveValue()

MAXON_METHOD Result<Bool> RemoveValue ( const GraphNode node,
const InternedId attr 
)
protected

◆ InheritValue()

MAXON_METHOD Result<Bool> InheritValue ( const GraphNode node,
const InternedId attr 
)
protected

◆ CopyValuesFrom()

MAXON_METHOD Result<void> CopyValuesFrom ( const GraphNode dest,
const GraphNode source,
Bool  includeInner 
)
protected

◆ GetMessageFlags()

MAXON_METHOD Result<GraphAttribute::FLAGS> GetMessageFlags ( const GraphNode node,
const InternedId attr 
)
protected

◆ GetMessages()

MAXON_METHOD Result<Bool> GetMessages ( const GraphNode node,
const InternedId attr,
const ValueReceiver< const GraphMessage & > &  receiver 
)
protected

◆ GetAttributeModificationsSince()

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

◆ GetAttributeStamp()

MAXON_METHOD Result<TimeStamp> GetAttributeStamp ( const GraphNode node,
const InternedId attr 
)
protected

◆ GetConnectionStamp()

MAXON_METHOD Result<TimeStamp> GetConnectionStamp ( const GraphNode node,
PORT_DIR  direction 
)
protected

◆ BeginTransactionImpl()

MAXON_METHOD Result<Int> BeginTransactionImpl ( const DataDictionary &  userData)
protected

◆ CommitImpl()

MAXON_METHOD Result<void> CommitImpl ( const DataDictionary &  userData,
Int  nesting,
Bool  validate 
)
protected

◆ RollbackImpl()

MAXON_METHOD void RollbackImpl ( Int  nesting)
protected

◆ CopyConstruct()

MAXON_METHOD void CopyConstruct ( GraphNode node,
const GraphNode src 
)
protected

◆ Destruct()

MAXON_METHOD void Destruct ( GraphNode node)
protected

◆ IsValid()

MAXON_METHOD Bool IsValid ( const GraphNode node)
protected

◆ IsSame()

MAXON_METHOD Bool IsSame ( const GraphNode a,
const GraphNode b 
)
protected

◆ NodeToString()

MAXON_METHOD String NodeToString ( const GraphNode node,
const FormatStatement fs 
)
protected

◆ IsConnectable()

MAXON_METHOD Result<Bool> IsConnectable ( const GraphNode src,
const GraphNode trg 
)
protected

◆ Duplicate()

MAXON_METHOD Result<HomogenousTupleType<3, HashMap<InternedId, InternedId> > > Duplicate ( const Block< const GraphNode > &  selection,
Bool  withConnections 
)

Duplicates the subgraph given by the selection within this graph. The nodes and ports of the subgraph are added into this graph using new unique identifiers. The mapping from the original identifiers to the new ones is returned.

Parameters
[in]selectionA selection of nodes and ports. Nodes/ports which aren't direct children of this graph are ignored.
[in]withConnectionsTrue if incoming connections shall be duplicated as well, false otherwise.
Returns
The mapping from original identifiers to the identifiers used for the merge:
  • first contains the mapping of top-level nodes.
  • second contains the mapping of top-level input ports.
  • third contains the mapping of top-level output ports.

Friends And Related Function Documentation

◆ GraphNode

friend class GraphNode
friend

◆ GraphTransaction

friend class GraphTransaction
friend

◆ GraphNodeFunctions

friend class GraphNodeFunctions
friend