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.
|
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< GraphNode > | GetNode (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< GraphTransaction > | BeginTransaction (const DataDictionary &userData=GetPtrSizedZeroRef< DataDictionary >()) |
|
MAXON_METHOD Int | GetTransactionCount () |
|
MAXON_METHOD Result< GraphNode > | AddChild (const Id &childId, const Id &nodeId, const DataDictionary &args=DataDictionary::DefaultValue()) |
|
| 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< Bool > | GetModificationsSince (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 Result< HomogenousTupleType< 3, HashMap< InternedId, InternedId > > > | Duplicate (const Block< const GraphNode > &selection, Bool withConnections) |
|
MAXON_METHOD const Data * | GetUserState (const NodePath &path, const InternedId &attr) |
|
MAXON_METHOD Bool | IsRoot (const GraphNode &node) |
|
MAXON_FUNCTION const NodePath & | GetViewRootPath () |
|
MAXON_FUNCTION GraphNode | GetViewRoot () |
|
|
MAXON_METHOD NODE_KIND | GetKind (const GraphNode &node) |
|
MAXON_METHOD const NodePath & | GetPath (const GraphNode &node) |
|
MAXON_METHOD Result< Bool > | GetChildren (const GraphNode &node, const ValueReceiver< const GraphNode & > &callback, NODE_KIND filter=NODE_KIND::ALL_MASK) |
|
MAXON_METHOD Result< GraphNode > | GetParent (const GraphNode &node) |
|
MAXON_METHOD Result< GraphNode > | GetAncestor (const GraphNode &node, NODE_KIND kind) |
|
MAXON_METHOD Result< GraphNode > | FindChild (const GraphNode &node, const InternedId &name, NODE_KIND kind=NODE_KIND::ALL_MASK) |
|
MAXON_METHOD Result< GraphNode > | FindInnerNode (const GraphNode &node, const PathBlock &innerPath) |
|
MAXON_METHOD Result< Bool > | GetInnerNodes (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< GraphNode > | AddPort (const GraphNode &parent, const Id &name) |
|
MAXON_METHOD Result< BaseArray< GraphNode > > | AddPorts (const GraphNode &parent, Int index, Int count) |
|
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) |
|
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) |
|
MAXON_METHOD Result< Wires > | GetWires (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< Bool > | GetConnectionValues (const GraphNode &source, const GraphNode &target, const ValueReceiver< CONNECTION_POSITION, InternedId, const ConstDataPtr & > &receiver) |
|
MAXON_METHOD Result< ConstDataPtr > | GetConnectionValue (const GraphNode &source, const GraphNode &target, CONNECTION_POSITION position, const InternedId &attr, const DataType &expectedType) |
|
MAXON_METHOD Result< Bool > | SetConnectionValue (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< ConstDataPtr > | GetValue (const GraphNode &node, const InternedId &attr, const DataType &expectedType) |
|
MAXON_METHOD Result< ConstDataPtr > | GetStoredValue (const GraphNode &node, const InternedId &attr, const DataType &expectedType) |
|
MAXON_METHOD Result< Bool > | GetBaseValues (const GraphNode &node, const InternedId &attr, const DataType &expectedType, const ValueReceiver< const ConstDataPtr &, Int > &valueReceiver) |
|
MAXON_METHOD Result< Bool > | SetValue (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< Bool > | RemoveValue (const GraphNode &node, const InternedId &attr) |
|
MAXON_METHOD Result< Bool > | InheritValue (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< Bool > | GetMessages (const GraphNode &node, const InternedId &attr, const ValueReceiver< const GraphMessage & > &receiver) |
|
MAXON_METHOD Result< Bool > | GetAttributeModificationsSince (const GraphNode &node, TimeStamp stamp, const ValueReceiver< InternedId, ConstDataPtr > &receiver) |
|
MAXON_METHOD Result< TimeStamp > | GetAttributeStamp (const GraphNode &node, const InternedId &attr) |
|
MAXON_METHOD Result< TimeStamp > | GetConnectionStamp (const GraphNode &node, PORT_DIR direction) |
|
MAXON_METHOD Result< Int > | BeginTransactionImpl (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< Bool > | IsConnectable (const GraphNode &src, const GraphNode &trg) |
|