12 #ifndef __UN_Graph_h__
13 #define __UN_Graph_h__
26 template <
typename GRAPH_DATA,
38 : myGraphData( graph_data )
44 {
return myGraphData; }
46 {
return myGraphData; }
51 {
return myGraphData; }
52 explicit operator bool()
const
60 return NODE( myGraphData, UN_GraphUtils::rootNode( myGraphData ));
67 return UN_GraphUtils::isValidNodeName( myGraphData, name );
75 return UN_GraphUtils::findValidUniqueNodeName( myGraphData,
name );
81 return UN_GraphUtils::nodeNames( myGraphData );
92 UN_GraphUtils::findNode( myGraphData, node_path ));
103 UN_GraphUtils::findStickyNote( myGraphData, sticky_note_path ));
132 return rootNode().descendantNodeRange();
162 return rootNode().descendantWireRange();
176 {
return myGraphData == other.myGraphData; }
178 {
return !( *
this == other ); }
185 GRAPH_DATA * myGraphData =
nullptr;
195 UN_Node, UN_Wire, UN_StickyNote >
224 node_name_or_path, node_type, node_category ));
230 UN_GraphUtils::deleteNode(
graphData(), node_name_or_path );
240 UN_GraphUtils::createStickyNote(
graphData(),
241 sticky_note_name_or_path, sticky_note_text ));
247 UN_GraphUtils::deleteStickyNote(
graphData(), sticky_note_name_or_path);
264 UN_ConstNode, UN_ConstWire, UN_ConstStickyNote>
STICKY_NOTE findStickyNote(const UT_StringRef &sticky_note_path) const
bool operator!=(const UN_ConstGraph &other) const
Comparison operators.
UN_WireIDList::const_iterator ChildWireIterator
A range for traversing the wires contained directly inside a node.
UN_Node createNode(const UT_StringRef &node_name_or_path=UT_StringRef(), const UT_StringRef &node_type=UT_StringRef(), const UT_StringRef &node_category=UT_StringRef()) const
Creates a node in the graph.
UN_StickyNote createStickyNote(const UT_StringRef &sticky_note_name_or_path=UT_StringRef(), const UT_StringRef &sticky_note_text=UT_StringRef()) const
Creates a sticky note in the graph.
UN_GraphBase(GRAPH_DATA *graph_data)
Constructs a handle that references the given wire in the given graph.
UT_StringHolder findValidUniqueNodeName(const UT_StringRef &name=UT_StringRef()) const
bool isValidNodeName(const UT_StringRef &name) const
bool operator!=(const UN_Graph &other) const
Comparison operators.
UN_GraphBase()=default
Constructs a handle for an invalid wire.
bool operator==(const UN_Graph &other) const
Comparison operators.
GLboolean GLboolean GLboolean GLboolean a
typename UN_Node::DescendantWireIterator AllWireIterator
An iterator and a range for all the connection wires in this graph.
AllWireRange allWireRange() const
typename UN_Node::DescendantNodeIterator AllNodeIterator
typename UN_Node::ChildNodeIterator TopNodeIterator
Iterarates over the top-level nodes of the graph.
void setFromOptions(const UN_Options &graph_opts) const
Load and set the graph based on the given options.
typename UN_Node::ChildWireIterator TopWireIterator
An iterator and a range for the top-level wires inside this graph.
UN_ConstGraph(const UN_GraphData *graph_data)
Constructor that creates handle for the given graph data.
UN_API void setFromOptions(UN_GraphData *graph_data, const UN_Options &graph_opts)
Load and set the graph based on the given options.
NODE findNode(const UT_StringRef &node_path) const
UN_OptionsPtr asOptions() const
UN_Graph(UN_GraphData *graph_data)
Constructor that creates handle for the given graph data.
UT_Array< UT_StringHolder > nodeNames() const
Returns the names of the graph's top-level nodes.
bool operator==(const UN_ConstGraph &other) const
Comparison operators.
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
bool operator!=(const UN_GraphBase &other) const
Comparison operators.
GLuint const GLchar * name
UT_Array< NODE > topNodes() const
Returns the top level nodes directly inside this graph.
GLboolean GLboolean GLboolean b
UN_API UN_OptionsPtr asOptions(const UN_GraphData *graph_data)
TopNodeRange topNodeRange() const
Returns a range for iterating over graph's top-level nodes.
TopWireRange topWireRange() const
Returns a range for iterating over graph's top-level connection wires.
const UN_GraphData * constGraphData() const
Returns the owner container of the underlying graph data structures.
A map of string to various well defined value types.
UT_Array< WIRE > topWires() const
Returns the wires connecting top level nodes directly inside this graph.
void deleteStickyNote(const UT_StringRef &sticky_note_name_or_path) const
Removes and deletes the sticky note from this graph.
void deleteNode(const UT_StringRef &node_name_or_path) const
Removes and deletes the node from this graph.
bool isValid() const
Returns true if this is a valid graph; false otherwise.
UN_ConstGraph(const UN_Graph &graph)
Constructs a const handle from a mutable graph handle.
bool operator==(const UN_GraphBase &other) const
Comparison operators.
AllNodeRange allNodeRange() const
UN_NodeIDList::const_iterator ChildNodeIterator
An iterator and a range for iterating over child node IDs.
GRAPH_DATA * graphData() const
Returns the owner container of the underlying graph data structures.
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
UT_UniquePtr< UN_Options > UN_OptionsPtr