HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UN_PortUtils.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UN_PortUtils.h ( UN Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __UN_PortUtils_h__
13 #define __UN_PortUtils_h__
14 
15 
16 #include "UN_API.h"
17 #include "UN_GraphData.h"
18 
19 
20 // Port utility functions that take UN_GraphData and UN_PortID parameters.
21 namespace UN_PortUtils
22 {
23  /// Returns true if the port by the given ID is valid in the given graph.
24  static inline bool
25  isValid( const UN_GraphData *graph_data, UN_PortID port_id )
26  {
27  return graph_data && graph_data->isValid( port_id );
28  }
29 
30  /// Deletes the given port from the graph data structures.
31  static inline void
32  deletePort( UN_GraphData *graph_data, UN_PortID port_id )
33  {
34  if( isValid( graph_data, port_id ))
35  graph_data->deletePort( port_id );
36  }
37 
38  /// Returns what kind of a port this is: an input or an output.
39  static inline UN_PortKind
40  portKind( const UN_GraphData *graph_data, UN_PortID port_id )
41  {
42  return graph_data
43  ? graph_data->portData().kind( port_id )
45  }
46 
47  /// Sets the port name that identifies it on the node.
48  static inline void
49  setName( UN_GraphData *graph_data, UN_PortID port_id,
50  const UT_StringRef &name )
51  {
52  if( graph_data )
53  graph_data->setPortName( port_id, name );
54  }
55 
56  /// Returns the port name that identifies it on the node.
57  static inline const UT_StringHolder &
58  name( const UN_GraphData *graph_data, UN_PortID port_id )
59  {
60  return graph_data
61  ? graph_data->portData().name( port_id )
63  }
64 
65  /// Sets the port type, which determines connection compatibility.
66  static inline void
67  setTypeName( UN_GraphData *graph_data, UN_PortID port_id,
68  const UT_StringRef &type_name )
69  {
70  if( graph_data )
71  graph_data->portData().setTypeName( port_id, type_name );
72  }
73 
74  /// Returns the port type, which determines connection compatibility.
75  static inline const UT_StringHolder &
76  typeName( const UN_GraphData *graph_data, UN_PortID port_id )
77  {
78  return graph_data
79  ? graph_data->portData().typeName( port_id )
81  }
82 
83  /// Sets the port label.
84  static inline void
85  setLabel( UN_GraphData *graph_data, UN_PortID port_id,
86  const UT_StringRef &name )
87  {
88  if( graph_data )
89  graph_data->portData().setLabel( port_id, name );
90  }
91 
92  /// Returns the port label.
93  static inline const UT_StringHolder &
94  label( const UN_GraphData *graph_data, UN_PortID port_id )
95  {
96  return graph_data
97  ? graph_data->portData().label( port_id )
99  }
100 
101  /// Sets the tags for the port (copy-assignment).
102  static inline void
103  setTags( UN_GraphData *graph_data, UN_PortID port_id,
104  const UT_StringArray &tags )
105  {
106  if( graph_data )
107  graph_data->portData().setTags( port_id, tags );
108  }
109 
110  /// Sets the tags for the port (move-assignment).
111  static inline void
112  setTags( UN_GraphData *graph_data, UN_PortID port_id,
113  UT_StringArray &&tags )
114  {
115  if( graph_data )
116  graph_data->portData().setTags( port_id, std::move(tags) );
117  }
118 
119  /// Returns the tags moved out of the port data.
120  static inline UT_StringArray
121  stealTags( UN_GraphData *graph_data, UN_PortID port_id )
122  {
123  return graph_data
124  ? graph_data->portData().stealTags( port_id )
126  }
127 
128  /// Sets tags in-place, which is faster than setting the whole dictionary.
129  /// Intended usage:
130  /// updateTags(g, n, [&value](auto &t) { t.set("key", value) });
131  template <typename OP>
132  static inline void
133  updateTags( UN_GraphData *graph_data, UN_PortID port_id, const OP &op )
134  {
135  if( graph_data )
136  graph_data->portData().updateTags( port_id, op );
137  }
138 
139  /// Returns the port's tags.
140  static inline const UT_StringArray &
141  tags( const UN_GraphData *graph_data, UN_PortID port_id )
142  {
143  return graph_data
144  ? graph_data->portData().tags( port_id )
146  }
147 
148 
149  /// Connects the source port to the destination port and returns the
150  /// resulting wire that represents that connection.
151  // TODO: FIXME: add a 'mode' parm to specify whether to replace, append, or
152  // prepend the new connection. Currently we replace.
153  UN_API UN_WireID
154  connectPorts( UN_GraphData *graph_data,
155  UN_PortID src_port_id, UN_PortID dst_port_id );
156 
157  /// Returns IDs of the wires that connect this port to its source ports.
158  /// Ie, connection wires from which this port takes (receives) data.
159  static inline const UN_WireIDList &
160  srcWires( const UN_GraphData *graph_data, UN_PortID dst_port_id )
161  {
162  static const UN_WireIDList theEmptyList;
163 
164  return isValid( graph_data, dst_port_id )
165  ? graph_data->srcWires( dst_port_id )
166  : theEmptyList;
167  }
168 
169  /// Return IDs of the wires that connect this port to its destination ports.
170  /// Ie, connection wires to which this port provides (sends) data.
171  static inline const UN_WireIDList &
172  dstWires( const UN_GraphData *graph_data, UN_PortID src_port_id )
173  {
174  static const UN_WireIDList theEmptyList;
175 
176  return isValid( graph_data, src_port_id )
177  ? graph_data->dstWires( src_port_id )
178  : theEmptyList;
179  }
180 
181  // An iterator and a range for iterating over port connection wires.
182  using WireIterator = UN_WireIDList::const_iterator;
184 
185  /// Returns a range for traversing the source wires of the given port.
186  /// Ie, wires from which this port takes (receives) data.
187  /// NOTE, the iterators hold a reference to the underlying wire array,
188  /// and therefore wires can't be added/removed during the iteration.
189  /// For adding/removing wires, use srcWires() function and make a copy.
191  srcWireRange( const UN_GraphData *graph_data, UN_PortID dst_port_id );
192 
193  /// Returns a range for traversing the destination wires of the given port.
194  /// Ie, wires to which this port provides (sends) data.
195  /// NOTE, the iterators hold a reference to the underlying wire array,
196  /// and therefore wires can't be added/removed during the iteration.
197  /// For adding/removing wires, use dstWires() function and make a copy.
199  dstWireRange( const UN_GraphData *graph_data, UN_PortID src_port_id );
200 
201  /// Returns the number of source ports connected to the given port.
202  static inline UN_DataSize
203  srcWireCount( const UN_GraphData *graph_data, UN_PortID dst_port_id )
204  {
205  return graph_data
206  ? UN_DataSize( graph_data->srcWires( dst_port_id ).size() )
207  : UN_DataSize();
208  }
209 
210  /// Returns the number of destination ports connected to the given port.
211  static inline UN_DataSize
212  dstWireCount( const UN_GraphData *graph_data, UN_PortID src_port_id )
213  {
214  return graph_data
215  ? UN_DataSize( graph_data->dstWires( src_port_id ).size() )
216  : UN_DataSize();
217  }
218 
219  /// Returns the number of ports connected to the given port,
220  /// either as a source or a destination port.
221  static inline UN_DataSize
222  wireCount( const UN_GraphData *graph_data, UN_PortID port_id )
223  {
224  return graph_data
225  ? UN_DataSize( graph_data->srcWires( port_id ).size() +
226  graph_data->dstWires( port_id ).size() )
227  : UN_DataSize();
228  }
229 
230  /// Returns the number of source ports connected to the given port.
231  static inline UN_DataSize
232  srcPortCount( const UN_GraphData *graph_data, UN_PortID dst_port_id )
233  {
234  return srcWireCount( graph_data, dst_port_id );
235  }
236 
237  /// Returns the number of destination ports connected to the given port.
238  static inline UN_DataSize
239  dstPortCount( const UN_GraphData *graph_data, UN_PortID src_port_id )
240  {
241  return dstWireCount( graph_data, src_port_id );
242  }
243 
244  /// Returns the number of ports connected to the given port,
245  /// either as a source or a destination port.
246  static inline UN_DataSize
247  portCount( const UN_GraphData *graph_data, UN_PortID port_id )
248  {
249  return wireCount( graph_data, port_id );
250  }
251 
252  /// @{ Returns the ID of the first source wire/port
253  /// connected to the given destination port.
254  /// Or returns an invalid ID if no source port is connected to it.
255  /// This is a convenience method for very common graphs,
256  /// where ports can have at most one source.
257  UN_API UN_WireID
258  srcWire( const UN_GraphData *graph_data, UN_PortID dst_port_id );
259  UN_API UN_PortID
260  srcPort( const UN_GraphData *graph_data, UN_PortID dst_port_id );
261  /// @}
262 
263  /// @{ Returns the ID of the first destination wire/port
264  /// connected to the given source port.
265  /// Or returns an invalid ID if no destination port is connected to it.
266  /// This is a convenience method for some graphs,
267  /// where ports can have at most one destination.
268  UN_API UN_WireID
269  dstWire( const UN_GraphData *graph_data, UN_PortID src_port_id );
270  UN_API UN_PortID
271  dstPort( const UN_GraphData *graph_data, UN_PortID src_port_id );
272  /// @}
273 
274  /// An iterator for traversing the ports connected to the given port.
275  /// NOTE, it holds a reference to the given wires array, and therefore
276  /// node ports can't be safely added/removed during the iteration.
277  template <bool IS_SOURCE_ITERATOR>
279  {
280  public:
281  using iterator_category = std::input_iterator_tag;
282  using value_type = UN_PortID;
283  using difference_type = std::ptrdiff_t;
284  using pointer = value_type*;
286 
287  /// Constructor for the start iterator.
288  PortIterator( const UN_GraphData *graph_data,
289  const UN_WireIDList::const_iterator &wire_id_iterator )
290  : myGraphData( graph_data )
291  , myWireIDIterator( wire_id_iterator )
292  {}
293 
294  /// Equality comparison operator.
295  bool operator ==( const PortIterator &other ) const
296  {
297  return myWireIDIterator == other.myWireIDIterator
298  && myGraphData == other.myGraphData;
299  }
300 
301  /// Inequality comparison operator.
302  bool operator !=( const PortIterator &other ) const
303  {
304  return !(operator==(other));
305  }
306 
307  /// Increment operator.
309  {
310  ++myWireIDIterator;
311  return *this;
312  }
313 
314  /// Returns the current port ID.
315  UN_PortID operator*() const
316  {
317  if( !myGraphData )
318  return UN_PortID();
319  if constexpr (IS_SOURCE_ITERATOR)
320  return myGraphData->srcPort( *myWireIDIterator );
321  else
322  return myGraphData->dstPort( *myWireIDIterator );
323  }
324 
325  /// Returns the underlying graph in which the current node exists.
326  const UN_GraphData *graph() const
327  {
328  return myGraphData;
329  }
330 
331  private:
332  /// The graph that owns the data objects.
333  const UN_GraphData *myGraphData = nullptr;
334 
335  /// The underlying wire iterator to which to delegate the calls.
336  UN_WireIDList::const_iterator myWireIDIterator;
337  };
338 
339  /// A range for traversing the source ports of the given port.
340  using SrcPortIterator = PortIterator< /*is_src=*/ true >;
342 
343  /// Returns a range for traversing the source ports of the given port.
344  /// Ie, ports from which this port takes (receives) data.
345  /// NOTE, the iterators hold a reference to the underlying wire array,
346  /// and therefore ports can't be added/removed during the iteration.
347  /// For adding/removing ports, use srcPorts() function.
349  srcPortRange( const UN_GraphData *graph_data, UN_PortID dst_port_id );
350 
351  /// A range for traversing the destination ports of the given port.
352  using DstPortIterator = PortIterator< /*is_src=*/ false >;
354 
355  /// Returns a range for traversing the destination ports of the given port.
356  /// Ie, ports to which this port provides (sends) data.
357  /// NOTE, the iterators hold a reference to the underlying wire array,
358  /// and therefore ports can't be added/removed during the iteration.
359  /// For adding/removing ports, use dstPorts() function.
361  dstPortRange( const UN_GraphData *graph_data, UN_PortID src_port_id );
362 
363  /// Returns the IDs of the ports connected as sources to the given port.
364  /// Ie, ports from which this port takes (receives) data.
365  UN_API UN_PortIDList
366  srcPorts( const UN_GraphData *graph_data, UN_PortID dst_port_id );
367 
368  /// Returns the IDs of the ports connected as destinations to the given port.
369  /// Ie, ports to which this port provides (sends) data.
370  UN_API UN_PortIDList
371  dstPorts( const UN_GraphData *graph_data, UN_PortID src_port_id );
372 
373  /// Returns true if the given port is connected to any source port.
374  static inline bool
375  isConnectedToSrc( const UN_GraphData *graph_data, UN_PortID dst_port_id )
376  {
377  return srcPortCount( graph_data, dst_port_id ) > 0;
378  }
379 
380  /// Returns true if the given destination port is connected to
381  /// (and takes/receives data from) the given source port.
382  static inline bool
383  isConnectedToSrc( const UN_GraphData *graph_data, UN_PortID dst_port_id,
384  UN_PortID src_port_id )
385  {
386  for( auto p : srcPortRange( graph_data, dst_port_id ))
387  if( p == src_port_id )
388  return true;
389 
390  return false;
391  }
392 
393  /// Returns true if the given port is connected to any destination port.
394  static inline bool
395  isConnectedToDst( const UN_GraphData *graph_data, UN_PortID src_port_id )
396  {
397  return dstPortCount( graph_data, src_port_id ) > 0;
398  }
399 
400  /// Returns true if the given source port is connected to
401  /// (and provides/sends data to) the given destination port.
402  static inline bool
403  isConnectedToDst( const UN_GraphData *graph_data, UN_PortID src_port_id,
404  UN_PortID dst_port_id )
405  {
406  for( auto p : dstPortRange( graph_data, src_port_id ))
407  if( p == dst_port_id )
408  return true;
409 
410  return false;
411  }
412 
413  /// Returns true if the given port is connected to any other port.
414  static inline bool
415  isConnected( const UN_GraphData *graph_data, UN_PortID port_id )
416  {
417  return isConnectedToSrc( graph_data, port_id )
418  || isConnectedToDst( graph_data, port_id );
419  }
420 
421  /// Returns true if the given ports are connected together,
422  /// either as source and destination, or vice versa.
423  static inline bool
424  isConnected( const UN_GraphData *graph_data,
425  UN_PortID port_id, UN_PortID src_or_dst_port_id )
426  {
427  return isConnectedToSrc( graph_data, port_id, src_or_dst_port_id )
428  || isConnectedToDst( graph_data, port_id, src_or_dst_port_id );
429  }
430 }
431 
432 #endif
433 
const UT_StringHolder & typeName(UN_PortID port_id) const
Returns the name of the port's type.
Definition: UN_PortData.h:224
UN_API WireRange dstWireRange(const UN_GraphData *graph_data, UN_PortID src_port_id)
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
UT_StringArray stealTags(UN_PortID port_id)
Returns port's tags moved from the data buffer entry.
Definition: UN_PortData.h:278
__hostdev__ bool isValid(GridType gridType, GridClass gridClass)
return true if the combination of GridType and GridClass is valid.
Definition: NanoVDB.h:860
UN_API UN_WireID srcWire(const UN_GraphData *graph_data, UN_PortID dst_port_id)
PortIterator(const UN_GraphData *graph_data, const UN_WireIDList::const_iterator &wire_id_iterator)
Constructor for the start iterator.
Definition: UN_PortUtils.h:288
UN_API WireRange srcWireRange(const UN_GraphData *graph_data, UN_PortID dst_port_id)
void setTags(UN_PortID port_id, const UT_StringArray &tags)
Sets new tags on a port via copy-assignment.
Definition: UN_PortData.h:260
std::ptrdiff_t difference_type
Definition: UN_PortUtils.h:283
const UT_StringHolder & name(UN_PortID port_id) const
Returns the port name that identifies it on the node.
Definition: UN_PortData.h:210
void setTypeName(UN_PortID port_id, const UT_StringRef &type_name)
Sets the name of the port's type.
Definition: UN_PortData.h:216
void deletePort(UN_PortID port)
Deletes the port.
#define UN_API
Definition: UN_API.h:11
bool operator!=(const PortIterator &other) const
Inequality comparison operator.
Definition: UN_PortUtils.h:302
static const UT_StringArray theDefTags
Definition: UN_PortData.h:379
UN_WireIDList::const_iterator WireIterator
Definition: UN_PortUtils.h:182
UN_API SrcPortRange srcPortRange(const UN_GraphData *graph_data, UN_PortID dst_port_id)
UN_PortID operator*() const
Returns the current port ID.
Definition: UN_PortUtils.h:315
bool isValid(UN_NodeID node) const
Definition: UN_GraphData.h:472
void updateTags(UN_PortID port_id, const OP &op)
Definition: UN_PortData.h:254
bool operator==(const PortIterator &other) const
Equality comparison operator.
Definition: UN_PortUtils.h:295
void setPortName(UN_PortID port_id, const UT_StringRef &name)
Sets the name of the given port.
UN_PortKind kind(UN_PortID port_id) const
Returns the port's kind indicating whether it is an input or an output.
Definition: UN_PortData.h:189
UN_API UN_WireID connectPorts(UN_GraphData *graph_data, UN_PortID src_port_id, UN_PortID dst_port_id)
static const UT_StringHolder theEmptyString
constexpr std::enable_if< I< type_count_base< T >::value, int >::type tuple_type_size(){return subtype_count< typename std::tuple_element< I, T >::type >::value+tuple_type_size< T, I+1 >);}template< typename T > struct type_count< T, typename std::enable_if< is_tuple_like< T >::value >::type >{static constexpr int value{tuple_type_size< T, 0 >)};};template< typename T > struct subtype_count{static constexpr int value{is_mutable_container< T >::value?expected_max_vector_size:type_count< T >::value};};template< typename T, typename Enable=void > struct type_count_min{static const int value{0};};template< typename T >struct type_count_min< T, typename std::enable_if<!is_mutable_container< T >::value &&!is_tuple_like< T >::value &&!is_wrapper< T >::value &&!is_complex< T >::value &&!std::is_void< T >::value >::type >{static constexpr int value{type_count< T >::value};};template< typename T > struct type_count_min< T, typename std::enable_if< is_complex< T >::value >::type >{static constexpr int value{1};};template< typename T >struct type_count_min< T, typename std::enable_if< is_wrapper< T >::value &&!is_complex< T >::value &&!is_tuple_like< T >::value >::type >{static constexpr int value{subtype_count_min< typename T::value_type >::value};};template< typename T, std::size_t I >constexpr typename std::enable_if< I==type_count_base< T >::value, int >::type tuple_type_size_min(){return 0;}template< typename T, std::size_t I > constexpr typename std::enable_if< I< type_count_base< T >::value, int >::type tuple_type_size_min(){return subtype_count_min< typename std::tuple_element< I, T >::type >::value+tuple_type_size_min< T, I+1 >);}template< typename T > struct type_count_min< T, typename std::enable_if< is_tuple_like< T >::value >::type >{static constexpr int value{tuple_type_size_min< T, 0 >)};};template< typename T > struct subtype_count_min{static constexpr int value{is_mutable_container< T >::value?((type_count< T >::value< expected_max_vector_size)?type_count< T >::value:0):type_count_min< T >::value};};template< typename T, typename Enable=void > struct expected_count{static const int value{0};};template< typename T >struct expected_count< T, typename std::enable_if<!is_mutable_container< T >::value &&!is_wrapper< T >::value &&!std::is_void< T >::value >::type >{static constexpr int value{1};};template< typename T > struct expected_count< T, typename std::enable_if< is_mutable_container< T >::value >::type >{static constexpr int value{expected_max_vector_size};};template< typename T >struct expected_count< T, typename std::enable_if<!is_mutable_container< T >::value &&is_wrapper< T >::value >::type >{static constexpr int value{expected_count< typename T::value_type >::value};};enum class object_category:int{char_value=1, integral_value=2, unsigned_integral=4, enumeration=6, boolean_value=8, floating_point=10, number_constructible=12, double_constructible=14, integer_constructible=16, string_assignable=23, string_constructible=24, other=45, wrapper_value=50, complex_number=60, tuple_value=70, container_value=80,};template< typename T, typename Enable=void > struct classify_object{static constexpr object_category value{object_category::other};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_integral< T >::value &&!std::is_same< T, char >::value &&std::is_signed< T >::value &&!is_bool< T >::value &&!std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::integral_value};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_integral< T >::value &&std::is_unsigned< T >::value &&!std::is_same< T, char >::value &&!is_bool< T >::value >::type >{static constexpr object_category value{object_category::unsigned_integral};};template< typename T >struct classify_object< T, typename std::enable_if< std::is_same< T, char >::value &&!std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::char_value};};template< typename T > struct classify_object< T, typename std::enable_if< is_bool< T >::value >::type >{static constexpr object_category value{object_category::boolean_value};};template< typename T > struct classify_object< T, typename std::enable_if< std::is_floating_point< T >::value >::type >{static constexpr object_category value{object_category::floating_point};};template< typename T >struct classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&std::is_assignable< T &, std::string >::value >::type >{static constexpr object_category value{object_category::string_assignable};};template< typename T >struct classify_object< T, typename std::enable_if<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&!std::is_assignable< T &, std::string >::value &&(type_count< T >::value==1)&&std::is_constructible< T, std::string >::value >::type >{static constexpr object_category value{object_category::string_constructible};};template< typename T > struct classify_object< T, typename std::enable_if< std::is_enum< T >::value >::type >{static constexpr object_category value{object_category::enumeration};};template< typename T > struct classify_object< T, typename std::enable_if< is_complex< T >::value >::type >{static constexpr object_category value{object_category::complex_number};};template< typename T > struct uncommon_type{using type=typename std::conditional<!std::is_floating_point< T >::value &&!std::is_integral< T >::value &&!std::is_assignable< T &, std::string >::value &&!std::is_constructible< T, std::string >::value &&!is_complex< T >::value &&!is_mutable_container< T >::value &&!std::is_enum< T >::value, std::true_type, std::false_type >::type;static constexpr bool value=type::value;};template< typename T >struct classify_object< T, typename std::enable_if<(!is_mutable_container< T >::value &&is_wrapper< T >::value &&!is_tuple_like< T >::value &&uncommon_type< T >::value)>::type >{static constexpr object_category value{object_category::wrapper_value};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&is_direct_constructible< T, double >::value &&is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::number_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&!is_direct_constructible< T, double >::value &&is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::integer_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< uncommon_type< T >::value &&type_count< T >::value==1 &&!is_wrapper< T >::value &&is_direct_constructible< T, double >::value &&!is_direct_constructible< T, int >::value >::type >{static constexpr object_category value{object_category::double_constructible};};template< typename T >struct classify_object< T, typename std::enable_if< is_tuple_like< T >::value &&((type_count< T >::value >=2 &&!is_wrapper< T >::value)||(uncommon_type< T >::value &&!is_direct_constructible< T, double >::value &&!is_direct_constructible< T, int >::value)||(uncommon_type< T >::value &&type_count< T >::value >=2))>::type >{static constexpr object_category value{object_category::tuple_value};};template< typename T > struct classify_object< T, typename std::enable_if< is_mutable_container< T >::value >::type >{static constexpr object_category value{object_category::container_value};};template< typename T, enable_if_t< classify_object< T >::value==object_category::char_value, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"CHAR";}template< typename T, enable_if_t< classify_object< T >::value==object_category::integral_value||classify_object< T >::value==object_category::integer_constructible, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"INT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::unsigned_integral, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"UINT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::floating_point||classify_object< T >::value==object_category::number_constructible||classify_object< T >::value==object_category::double_constructible, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"FLOAT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::enumeration, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"ENUM";}template< typename T, enable_if_t< classify_object< T >::value==object_category::boolean_value, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"BOOLEAN";}template< typename T, enable_if_t< classify_object< T >::value==object_category::complex_number, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"COMPLEX";}template< typename T, enable_if_t< classify_object< T >::value >=object_category::string_assignable &&classify_object< T >::value<=object_category::other, detail::enabler >=detail::dummy >constexpr const char *type_name(){return"TEXT";}template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value >=2, detail::enabler >=detail::dummy >std::string type_name();template< typename T, enable_if_t< classify_object< T >::value==object_category::container_value||classify_object< T >::value==object_category::wrapper_value, detail::enabler >=detail::dummy >std::string type_name();template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value==1, detail::enabler >=detail::dummy >inline std::string type_name(){return type_name< typename std::decay< typename std::tuple_element< 0, T >::type >::type >);}template< typename T, std::size_t I >inline typename std::enable_if< I==type_count_base< T >::value, std::string >::type tuple_name(){return std::string{};}template< typename T, std::size_t I >inline typename std::enable_if<(I< type_count_base< T >::value), std::string >::type tuple_name(){auto str=std::string{type_name< typename std::decay< typename std::tuple_element< I, T >::type >::type >)}+ ','+tuple_name< T, I+1 >);if(str.back()== ',') str.pop_back();return str;}template< typename T, enable_if_t< classify_object< T >::value==object_category::tuple_value &&type_count_base< T >::value >=2, detail::enabler > > std::string type_name()
Recursively generate the tuple type name.
Definition: CLI11.h:1729
const UN_WireIDList & dstWires(UN_PortID port) const
Definition: UN_GraphData.h:421
UNI_PortKind
Specifies the port kind, ie, wheter it is an input or an output port.
Definition: UNI_Include.h:21
UN_API UN_WireID dstWire(const UN_GraphData *graph_data, UN_PortID src_port_id)
void setLabel(UN_PortID port_id, const UT_StringRef &label)
Sets the port's label.
Definition: UN_PortData.h:230
UN_API bool isConnectedToSrc(const UN_GraphData *dst_graph_data, UN_PortID dst_port_id, const UN_ConstPort &src_port)
const UN_GraphData * graph() const
Returns the underlying graph in which the current node exists.
Definition: UN_PortUtils.h:326
GLuint const GLchar * name
Definition: glcorearb.h:786
UN_API UN_PortIDList dstPorts(const UN_GraphData *graph_data, UN_PortID src_port_id)
UN_API bool isConnectedToDst(const UN_GraphData *src_graph_data, UN_PortID src_port_id, const UN_ConstPort &dst_port)
UN_API UN_PortID srcPort(const UN_GraphData *graph_data, UN_PortID dst_port_id)
UN_PortID srcPort(UN_WireID wire) const
Definition: UN_GraphData.h:441
const UN_WireIDList & srcWires(UN_PortID port) const
Definition: UN_GraphData.h:416
UN_API DstPortRange dstPortRange(const UN_GraphData *graph_data, UN_PortID src_port_id)
const UT_StringArray & tags(UN_PortID port_id) const
Returns port's tags.
Definition: UN_PortData.h:272
UN_PortData & portData()
Returns the container of data for the ports in the graph.
Definition: UN_GraphData.h:502
const UT_StringHolder & label(UN_PortID port_id) const
Returns the port's label.
Definition: UN_PortData.h:236
UN_API UN_WireIDList srcWires(const UN_GraphData *graph_data, UN_NodeID node_id, UN_PortKind port_kind)
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)
PortIterator & operator++()
Increment operator.
Definition: UN_PortUtils.h:308
UN_PortID dstPort(UN_WireID wire) const
Definition: UN_GraphData.h:446
std::input_iterator_tag iterator_category
Definition: UN_PortUtils.h:281
UN_API UN_WireIDList dstWires(const UN_GraphData *graph_data, UN_NodeID node_id, UN_PortKind port_kind)
UN_API UN_PortIDList srcPorts(const UN_GraphData *graph_data, UN_PortID dst_port_id)