32 namespace UN_PortUtils
57 template <
typename BASE_CLASS,
69 : BASE_CLASS( graph_data, port_id )
75 {
return BASE_CLASS::graphData(); }
77 {
return BASE_CLASS::constGraphData(); }
82 {
return UN_PortID( BASE_CLASS::dataID() ); }
87 return UN_PortUtils::isValid(
91 explicit operator bool()
const
308 return connectedPorts<
true>(
graphData(),
316 return connectedPorts<
false>(
graphData(),
322 template <
bool IS_SOURCE>
324 connectedPorts( GRAPH_DATA *graph_data,
const UN_WireIDList &wire_ids )
327 for(
auto &&wire_id: wire_ids )
329 if constexpr (IS_SOURCE)
330 result.emplace_back( graph_data, graph_data->
srcPort(wire_id));
332 result.emplace_back( graph_data, graph_data->
dstPort(wire_id));
354 UN_Port( UN_GraphData *graph_data, UN_PortID node_id )
409 template <
typename OP>
418 UN_Wire connectSrcPort(
const UN_Port &src_port )
const;
423 UN_Wire connectDstPort(
const UN_Port &dst_port )
const;
440 const UN_GraphData, UN_ConstPort, UN_ConstWire >
UT_IteratorRange< DstPortIterator > DstPortRange
void setName(const UT_StringRef &name) const
Sets the port name that identifies it on the node.
UN_API WireRange dstWireRange(const UN_GraphData *graph_data, UN_PortID src_port_id)
UN_PortBase()=default
Constructs a handle for an invalid port.
bool operator!=(const UN_ConstPort &other) const
Comparison operators.
bool isConnectedToDst(const UN_ConstPort &dst_port) const
Returns true if this port is connected to the given destination port.
GLuint GLsizei const GLchar * label
DstWireRange dstWireRange() const
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
UN_API WireRange srcWireRange(const UN_GraphData *graph_data, UN_PortID dst_port_id)
UN_PortID portID() const
Returns the unique ID of the port this handle refers to.
UN_HandleIterator< PORT, GRAPH_DATA, UN_PortUtils::PortIterator< false >> DstPortIterator
And iterator and a range for iterating over connected destination ports.
GLboolean GLboolean GLboolean GLboolean a
UT_Array< PORT > srcPorts() const
GRAPH_DATA * graphData() const
Returns the owner of the underlying graph data structures.
const UT_StringHolder & label() const
Returns the port's label.
**But if you need a result
UN_DataSize srcWireCount() const
Returns the number of source ports connected to the given port.
SrcWireRange srcWireRange() const
UN_HandleIterator< WIRE, GRAPH_DATA, UN_PortUtils::WireIterator > DstWireIterator
UT_IteratorRange< SrcWireIterator > SrcWireRange
UN_WireIDList::const_iterator WireIterator
UN_API SrcPortRange srcPortRange(const UN_GraphData *graph_data, UN_PortID dst_port_id)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
UT_StringArray stealTags() const
const UN_GraphData * constGraphData() const
Returns the owner of the underlying graph data structures.
bool isValid() const
Returns true if this port is valid within the graph; false otherwise.
UT_IteratorRange< DstWireIterator > DstWireRange
void setTags(UT_StringArray &&tags) const
Sets the tags for the port (move-assignment).
void destroy() const
Deletes this port from the graph.
UT_Array< WIRE > srcWires() const
SrcPortRange srcPortRange() const
UN_ConstPort(const UN_GraphData *graph_data, UN_PortID port_id)
Constructs a handle referencing the given port in the given graph.
UNI_PortKind
Specifies the port kind, ie, wheter it is an input or an output port.
bool isConnectedToDst() const
Returns true if this port is connected to any destination port.
UN_API bool isConnectedToSrc(const UN_GraphData *dst_graph_data, UN_PortID dst_port_id, const UN_ConstPort &src_port)
UN_ConstPort(const UN_Port &port)
Constructs a const handle from a mutable port handle.
GLuint const GLchar * name
GLboolean GLboolean GLboolean b
UN_API bool isConnectedToDst(const UN_GraphData *src_graph_data, UN_PortID src_port_id, const UN_ConstPort &dst_port)
DstPortRange dstPortRange() const
UN_HandleIterator< PORT, GRAPH_DATA, UN_PortUtils::PortIterator< true >> SrcPortIterator
And iterator and a range for iterating over connected source ports.
UN_API UN_PortID srcPort(const UN_GraphData *graph_data, UN_PortID dst_port_id)
UT_Array< PORT > dstPorts() const
UT_Array< WIRE > dstWires() const
bool isConnected(const UN_ConstPort &port) const
bool operator!=(const UN_ConstHandle &other) const
bool operator==(const UN_ConstHandle &other) const
UN_PortKind kind() const
Returns the kind of a port. Ie, an input or an output.
UN_API DstPortRange dstPortRange(const UN_GraphData *graph_data, UN_PortID src_port_id)
const UT_StringArray & tags() const
Returns the port's tags.
UN_HandleIterator< WIRE, GRAPH_DATA, UN_PortUtils::WireIterator > SrcWireIterator
void setTags(const UT_StringArray &tags) const
Sets the tags for the port (copy-assignment).
UN_Port(UN_GraphData *graph_data, UN_PortID node_id)
Constructs a handle referencing the given node in the given graph.
const UT_StringHolder & name() const
Returns the port name that identifies it on the node.
UN_DataSize dstWireCount() const
Returns the number of destination ports connected to the given port.
bool isConnectedToSrc() const
Returns true if this port is connected to any source port.
UN_DataSize wireCount() const
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
UN_API UN_PortID dstPort(const UN_GraphData *graph_data, UN_PortID src_port_id)
UN_API bool isConnected(const UN_GraphData *graph_data, UN_PortID port_id, const UN_ConstPort &src_or_dst_port)
bool isConnected() const
Returns true if this port is connected to any other port.
UT_IteratorRange< SrcPortIterator > SrcPortRange
const UT_StringHolder & typeName() const
Returns the port's type that determines the connection compatibility.
void updateTags(const OP &op) const
bool operator==(const UN_Port &other) const
Comparison operators.
bool isConnectedToSrc(const UN_ConstPort &src_port) const
Returns true if this port is connected to the given source port.
bool operator!=(const UN_Port &other) const
Comparison operators.
UN_PortBase(GRAPH_DATA *graph_data, UN_PortID port_id)
Constructs a handle that references the given port in the given graph.
void setLabel(const UT_StringRef &label) const
Sets the port label.
bool operator==(const UN_ConstPort &other) const
Comparison operators.