HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UN_Graph Class Reference

#include <UN_Graph.h>

Public Types

using NodeIterator = UN_Node::ChildIterator
 Iterarates over the top-level nodes of the graph. More...
 
using NodeRange = UT_IteratorRange< NodeIterator >
 
using AllNodeIterator = UN_Node::DescendantIterator
 
using AllNodeRange = UT_IteratorRange< AllNodeIterator >
 
using WireIterator = UN_Node::ChildWireIterator
 An iterator and a range for the top-level wires inside this graph. More...
 
using WireRange = UT_IteratorRange< WireIterator >
 
using AllWireIterator = UN_Node::DescendantWireIterator
 An iterator and a range for all the connection wires in this graph. More...
 
using AllWireRange = UT_IteratorRange< AllWireIterator >
 

Public Member Functions

 UN_Graph ()
 Defaul constructor that creates an invalid UN_Graph handle. More...
 
 UN_Graph (UN_GraphData *graph_data)
 
UN_Node rootNode () const
 
UT_StringHolder findUniqueNodeName (const UT_StringRef &name=UT_StringRef()) const
 Returns a name that is not used by any of the top level nodes. More...
 
UN_Node createNode (const UT_StringRef &name=UT_StringRef(), const UT_StringRef &type=UT_StringRef(), const UT_StringRef &category=UT_StringRef()) const
 Creates a new top-level node in the graph. More...
 
UN_Node findNode (const UT_StringRef &node_name) const
 
void deleteNode (const UT_StringRef &node_name) const
 Removes and deletes the top-level node from this graph. More...
 
UT_Array< UT_StringHoldernodeNames () const
 Returns the names of the graph's top-level nodes. More...
 
NodeRange nodeRange () const
 Returns a range for iterating over graph's top-level nodes. More...
 
AllNodeRange allNodeRange () const
 Returns a range for iterating over graph's top-level nodes. More...
 
WireRange wireRange () const
 Returns a range for iterating over graph's top-level connection wires. More...
 
AllWireRange allWireRange () const
 Returns a range for iterating over graph's top-level connection wires. More...
 
UT_Options asOptions () const
 
void setFromOptions (const UT_Options &graph_opts) const
 Configure the graph based on the given options. More...
 
 ~UN_Graph ()
 Default destructor, constructors and assignment operators. More...
 
 UN_Graph (const UN_Graph &)
 Default destructor, constructors and assignment operators. More...
 
 UN_Graph (UN_Graph &&)
 Default destructor, constructors and assignment operators. More...
 
UN_Graphoperator= (const UN_Graph &)
 Default destructor, constructors and assignment operators. More...
 
UN_Graphoperator= (UN_Graph &&)
 Default destructor, constructors and assignment operators. More...
 
bool isValid () const
 Returns true if this is a valid graph; false otherwise. More...
 
 operator bool () const
 Returns true if this is a valid graph; false otherwise. More...
 
bool operator== (const UN_Graph &other) const
 Comparison operators. More...
 
bool operator!= (const UN_Graph &other) const
 Comparison operators. More...
 

Detailed Description

A light-weight handle/pointer for the graph data.

The actual graph data and logic is implemented in UN_GraphData owned by UN_Context.

UN_Graph serves as a handle/pointer for clients to refer to that graph data.

Definition at line 30 of file UN_Graph.h.

Member Typedef Documentation

Iterarates over all the nodes in the graph; the top-level nodes and their descendants too.

Definition at line 105 of file UN_Graph.h.

Definition at line 106 of file UN_Graph.h.

An iterator and a range for all the connection wires in this graph.

Definition at line 121 of file UN_Graph.h.

Definition at line 122 of file UN_Graph.h.

Iterarates over the top-level nodes of the graph.

Definition at line 96 of file UN_Graph.h.

Definition at line 97 of file UN_Graph.h.

An iterator and a range for the top-level wires inside this graph.

Definition at line 113 of file UN_Graph.h.

Definition at line 114 of file UN_Graph.h.

Constructor & Destructor Documentation

UN_Graph::UN_Graph ( )

Defaul constructor that creates an invalid UN_Graph handle.

UN_Graph::UN_Graph ( UN_GraphData *  graph_data)

Constructor that creates a valid UN_Graph handle (if parm is not null). Takes a pointer to the graph data owned by the graph owner.

UN_Graph::~UN_Graph ( )

Default destructor, constructors and assignment operators.

UN_Graph::UN_Graph ( const UN_Graph )

Default destructor, constructors and assignment operators.

UN_Graph::UN_Graph ( UN_Graph &&  )

Default destructor, constructors and assignment operators.

Member Function Documentation

AllNodeRange UN_Graph::allNodeRange ( ) const

Returns a range for iterating over graph's top-level nodes.

AllWireRange UN_Graph::allWireRange ( ) const

Returns a range for iterating over graph's top-level connection wires.

UT_Options UN_Graph::asOptions ( ) const

Returns the options object representing this graph. This can be then used for serialization to JSON, etc.

UN_Node UN_Graph::createNode ( const UT_StringRef name = UT_StringRef(),
const UT_StringRef type = UT_StringRef(),
const UT_StringRef category = UT_StringRef() 
) const

Creates a new top-level node in the graph.

void UN_Graph::deleteNode ( const UT_StringRef node_name) const

Removes and deletes the top-level node from this graph.

UN_Node UN_Graph::findNode ( const UT_StringRef node_name) const

Returns a top-level node by the given name. Note, the return object may be invalid if no such node was found.

UT_StringHolder UN_Graph::findUniqueNodeName ( const UT_StringRef name = UT_StringRef()) const

Returns a name that is not used by any of the top level nodes.

bool UN_Graph::isValid ( ) const
inline

Returns true if this is a valid graph; false otherwise.

Definition at line 49 of file UN_Graph.h.

UT_Array< UT_StringHolder > UN_Graph::nodeNames ( ) const

Returns the names of the graph's top-level nodes.

NodeRange UN_Graph::nodeRange ( ) const

Returns a range for iterating over graph's top-level nodes.

UN_Graph::operator bool ( ) const
inlineexplicit

Returns true if this is a valid graph; false otherwise.

Definition at line 51 of file UN_Graph.h.

bool UN_Graph::operator!= ( const UN_Graph other) const
inline

Comparison operators.

Definition at line 58 of file UN_Graph.h.

UN_Graph& UN_Graph::operator= ( const UN_Graph )

Default destructor, constructors and assignment operators.

UN_Graph& UN_Graph::operator= ( UN_Graph &&  )

Default destructor, constructors and assignment operators.

bool UN_Graph::operator== ( const UN_Graph other) const
inline

Comparison operators.

Definition at line 56 of file UN_Graph.h.

UN_Node UN_Graph::rootNode ( ) const

Returns the root node of the graph's node parental hierarchy. The root is a special node that holds graph's top-level nodes. It cannot be deleted or renamed.

void UN_Graph::setFromOptions ( const UT_Options graph_opts) const

Configure the graph based on the given options.

WireRange UN_Graph::wireRange ( ) const

Returns a range for iterating over graph's top-level connection wires.


The documentation for this class was generated from the following file: