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

#include <UN_Port.h>

+ Inheritance diagram for UN_Port:

Public Member Functions

 UN_Port ()=default
 Constructs a handle for an invalid node. More...
 
 UN_Port (UN_GraphData *graph_data, UN_PortID node_id)
 Constructs a handle referencing the given node in the given graph. More...
 
UN_Graph graph () const
 Returns the graph whithin which this port exists. More...
 
UN_Node node () const
 Returns the node to which this port belongs. More...
 
void setName (const UT_StringRef &name) const
 Sets the port name that identifies it on the node. More...
 
void setLabel (const UT_StringRef &label) const
 Sets the port label. More...
 
void setTags (const UT_StringArray &tags) const
 Sets the tags for the port (copy-assignment). More...
 
void setTags (UT_StringArray &&tags) const
 Sets the tags for the port (move-assignment). More...
 
UT_StringArray stealTags () const
 
template<typename OP >
void updateTags (const OP &op) const
 
UN_Wire connectSrcPort (const UN_Port &src_port) const
 
UN_Wire connectDstPort (const UN_Port &dst_port) const
 
void destroy () const
 Deletes this port from the graph. More...
 
bool operator== (const UN_Port &other) const
 Comparison operators. More...
 
bool operator!= (const UN_Port &other) const
 Comparison operators. More...
 
- Public Member Functions inherited from UN_PortBase< UN_Handle, UN_GraphData, UN_Port, UN_Wire >
UN_PortID portID () const
 Returns the unique ID of the port this handle refers to. More...
 
UN_PortKind kind () const
 Returns the kind of a port. Ie, an input or an output. More...
 
bool isInput () const
 
bool isOutput () const
 
const UT_StringHoldername () const
 Returns the port name that identifies it on the node. More...
 
const UT_StringHoldertypeName () const
 Returns the port's type that determines the connection compatibility. More...
 
const UT_StringHolderlabel () const
 Returns the port's label. More...
 
const UT_StringArraytags () const
 Returns the port's tags. More...
 
UN_DataSize srcWireCount () const
 Returns the number of source ports connected to the given port. More...
 
UN_DataSize dstWireCount () const
 Returns the number of destination ports connected to the given port. More...
 
UN_DataSize wireCount () const
 
bool isConnectedToSrc () const
 Returns true if this port is connected to any source port. More...
 
bool isConnectedToSrc (const UN_ConstPort &src_port) const
 Returns true if this port is connected to the given source port. More...
 
bool isConnectedToDst () const
 Returns true if this port is connected to any destination port. More...
 
bool isConnectedToDst (const UN_ConstPort &dst_port) const
 Returns true if this port is connected to the given destination port. More...
 
bool isConnected () const
 Returns true if this port is connected to any other port. More...
 
bool isConnected (const UN_ConstPort &port) const
 
SrcWireRange srcWireRange () const
 
DstWireRange dstWireRange () const
 
UT_Array< UN_WiresrcWires () const
 
UT_Array< UN_WiredstWires () const
 
SrcPortRange srcPortRange () const
 
DstPortRange dstPortRange () const
 
UN_Port srcPort () const
 
UN_Port dstPort () const
 
UT_Array< UN_PortsrcPorts () const
 
UT_Array< UN_PortdstPorts () const
 
UN_GraphDatagraphData () const
 Returns the owner of the underlying graph data structures. More...
 
const UN_GraphDataconstGraphData () const
 Returns the owner of the underlying graph data structures. More...
 
bool isValid () const
 Returns true if this port is valid within the graph; false otherwise. More...
 
 operator bool () const
 Returns true if this port is valid within the graph; false otherwise. More...
 
- Public Member Functions inherited from UN_Handle
 UN_Handle ()
 Constructs a reference handle for an invalid entity in the graph. More...
 
 UN_Handle (UN_GraphData *graph_data, UN_DataID data_id)
 Constructs reference handle to the data for a given entity in the graph. More...
 
UN_GraphDatagraphData () const
 Returns the graph that owns, manages, and operates on the data object. More...
 
const UN_GraphDataconstGraphData () const
 Returns the graph that owns, manages, and operates on the data object. More...
 
- Public Member Functions inherited from UN_ConstHandle
 UN_ConstHandle ()
 Constructs a reference handle for an invalid entity in the graph. More...
 
 UN_ConstHandle (const UN_GraphData *graph_data, UN_DataID data_id)
 Constructs reference handle to the data for a given entity in the graph. More...
 
UN_DataID dataID () const
 
const UN_GraphDatagraphData () const
 Returns the underlying graph data object. More...
 
const UN_GraphDataconstGraphData () const
 Returns the underlying graph data object. More...
 

Additional Inherited Members

- Public Types inherited from UN_PortBase< UN_Handle, UN_GraphData, UN_Port, UN_Wire >
using SrcWireIterator = UN_HandleIterator< UN_Wire, UN_GraphData, UN_PortUtils::WireIterator >
 
using SrcWireRange = UT_IteratorRange< SrcWireIterator >
 
using DstWireIterator = UN_HandleIterator< UN_Wire, UN_GraphData, UN_PortUtils::WireIterator >
 
using DstWireRange = UT_IteratorRange< DstWireIterator >
 
using SrcPortIterator = UN_HandleIterator< UN_Port, UN_GraphData, UN_PortUtils::PortIterator< true >>
 And iterator and a range for iterating over connected source ports. More...
 
using SrcPortRange = UT_IteratorRange< SrcPortIterator >
 
using DstPortIterator = UN_HandleIterator< UN_Port, UN_GraphData, UN_PortUtils::PortIterator< false >>
 And iterator and a range for iterating over connected destination ports. More...
 
using DstPortRange = UT_IteratorRange< DstPortIterator >
 
- Protected Member Functions inherited from UN_PortBase< UN_Handle, UN_GraphData, UN_Port, UN_Wire >
 UN_PortBase ()=default
 Constructs a handle for an invalid port. More...
 
 UN_PortBase (UN_GraphData *graph_data, UN_PortID port_id)
 Constructs a handle that references the given port in the given graph. More...
 
- Protected Member Functions inherited from UN_ConstHandle
bool isNumericallyValid () const
 
bool operator== (const UN_ConstHandle &other) const
 
bool operator!= (const UN_ConstHandle &other) const
 

Detailed Description

A handle that references a mutable port in a graph. It abstracts the APIs that operate on this port's data, which is stored inside graph's data containers. It is a non-const (read-write) handle, so allows both queries and mutations of the port's data.

Definition at line 346 of file UN_Port.h.

Constructor & Destructor Documentation

UN_Port::UN_Port ( )
default

Constructs a handle for an invalid node.

UN_Port::UN_Port ( UN_GraphData graph_data,
UN_PortID  node_id 
)
inline

Constructs a handle referencing the given node in the given graph.

Definition at line 354 of file UN_Port.h.

Member Function Documentation

UN_Wire UN_Port::connectDstPort ( const UN_Port dst_port) const

Connects this port to a destination port to which it provides (sends) data or a value. Returns the newly created connection wire (may be invalid, if error).

UN_Wire UN_Port::connectSrcPort ( const UN_Port src_port) const

Connects this port to a source port from which it takes (receives) data or a value. Returns the newly created connection wire (may be invalid, if error).

void UN_Port::destroy ( ) const
inline

Deletes this port from the graph.

Definition at line 426 of file UN_Port.h.

UN_Graph UN_Port::graph ( ) const

Returns the graph whithin which this port exists.

UN_Node UN_Port::node ( ) const

Returns the node to which this port belongs.

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

Comparison operators.

Definition at line 363 of file UN_Port.h.

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

Comparison operators.

Definition at line 361 of file UN_Port.h.

void UN_Port::setLabel ( const UT_StringRef label) const
inline

Sets the port label.

Definition at line 381 of file UN_Port.h.

void UN_Port::setName ( const UT_StringRef name) const
inline

Sets the port name that identifies it on the node.

Definition at line 375 of file UN_Port.h.

void UN_Port::setTags ( const UT_StringArray tags) const
inline

Sets the tags for the port (copy-assignment).

Definition at line 387 of file UN_Port.h.

void UN_Port::setTags ( UT_StringArray &&  tags) const
inline

Sets the tags for the port (move-assignment).

Definition at line 393 of file UN_Port.h.

UT_StringArray UN_Port::stealTags ( ) const
inline

Returns the tags moved out of the port. This is useful in combination with rvalue ref version of setTags() to optimize the edits to the tag list.

Definition at line 401 of file UN_Port.h.

template<typename OP >
void UN_Port::updateTags ( const OP &  op) const
inline

Edits port's tags array in-place. Intended usage: n.updateTags([&value](auto &t) { t.set("key", value) });

Definition at line 410 of file UN_Port.h.


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