HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UN_PortData.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_PortData.h ( UN Library, C++)
7  *
8  * COMMENTS:
9  * Core functionality for a utility-based ports.
10  */
11 
12 #ifndef __UN_PortData_h__
13 #define __UN_PortData_h__
14 
15 #include "UN_API.h"
16 #include "UN_Data.h"
17 #include "UN_Utils.h"
18 class UN_GraphData;
19 
20 
21 // ============================================================================
24 
25 // ============================================================================
26 /// Container of data for all the ports in the graph.
27 ///
28 /// NOTE: This class is generally not trivially relocatable, because
29 /// its base class (UN_Data) is not trivially relocatable (see comment there).
30 
31 class UN_API UN_PortData : public UN_Data
32 {
33 public:
34  /// Constructors and destructors.
36  ~UN_PortData() = default;
37 
40 
41 protected:
42  /// This container can have large data, so generally, forbid
43  /// the costly copy operations to the public.
44  /// Knowledgable friends and derived classes can still use them.
45  friend UN_GraphData;
46  UN_PortData(const UN_PortData&) = default;
47  UN_PortData & operator=(const UN_PortData&) = default;
48 
49 public:
50  /// Increases the capacity of the data buffer arrays to the given minimum,
51  /// unless the capacity is already greater or equal to that minimum,
52  /// in which case the capacity remains unchanged.
53  void setCapacityIfNeeded(UN_DataSize min_capacity);
54 
55  /// @{ Returns port's custom data container, if one was provided.
57  {
59  }
60 
62  {
63  return UTverify_cast<const UN_CustomPortData*>( customData() );
64  }
65  /// @}
66 
67  /// Merges another port data container into this one.
68  /// Returns a mapping between the port IDs in the merge source
69  /// and destination (this) data buffers.
70  UN_PortIDRemap merge( const UN_PortData &src_port_data );
71 
72  // TODO: FIXME: maybe factor it out to a (non-virtual) base class
73  // with other data classes.
74  /// @{ Configure the port based on the information in the given option entry
75  void merge( UN_PortID port_id,
76  const UT_OptionEntry &port_entry );
77  void merge( UN_PortID parm_id,
78  const UN_Options &port_opts );
79  /// @}
80 
81  /// Returns the options object representing this port data.
82  // TODO: FIXME: is the include_name still needed?
83  // TODO: FIXME: sweep all classes to clean up and unify asOptions()
84  // TODO: FIXME: should pass config dictionary of what/how to save UN objects
85  // rather than having a series of parameters on the method.
86  /// @param include_name If true, the result will contain the entry for
87  /// the node name; otherwise, the name will be skipped.
88  UN_OptionsPtr asOptionsClassic( UN_PortID port_id,
89  bool include_name = true ) const;
90 
91 
92  /// Adds a slot for a new port in this container.
93  /// Returns an ID that should be used to refer to this new port
94  /// for accessing its data (eg, name, connection wire, etc).
95  UN_PortID addPort();
96 
97  /// Clears the data for the given port to the default state.
98  void clearPort( UN_PortID port_id );
99 
100  /// Removes the port from this container and frees the
101  /// data slot it occupied. After calling this method the container will
102  /// have no knowledge of the port by this ID.
103  /// Returns true on successs; false if the port was not found.
104  bool removePort( UN_PortID port_id );
105 
106  /// Frees the data slots occupied by all the ports.
107  /// @param 'reset_next_id' If true, the node ID generator is reset to zero.
108  void removeAllPorts( bool reset_next_id );
109 
110  /// Returns true if the given ID refers to a valid port entry
111  /// in the data buffers. Ie, such a port exists and is valid.
112  bool isValid( UN_PortID port_id ) const
113  { return UN_Data::isValid( port_id ); }
114 
115 
116  /// Iterator for traversing valid port IDs.
118  {
119  public:
120  using value_type = UN_PortID;
121 
123  : UN_DataIndexMap::IDIterator( id_iterator )
124  {}
125 
127  { return UN_PortID( UN_DataIndexMap::IDIterator::operator*() ); }
128  };
129 
130  /// Iterator for traversing valid port IDs in an ascending order.
132  {
133  public:
134  using value_type = UN_PortID;
135 
137  : UN_DataIndexMap::OrderedIDIterator( id_iterator )
138  {}
139 
141  { return UN_PortID( UN_DataIndexMap::OrderedIDIterator::operator*() ); }
142  };
143 
144 
145  /// Returns a range for iterating valid port IDs.
147  IDRange idRange() const
148  {
149  auto id_range( UN_Data::idRange() );
150  return IDRange( id_range.begin(), id_range.end() );
151  }
152 
153  /// Returns a range for iterating valid port IDs.
156  {
157  auto id_range( UN_Data::orderedIDRange() );
158  return OrderedIDRange( id_range.begin(), id_range.end() );
159  }
160 
161  /// Returns a list of all the valid port IDs in the graph.
162  UN_PortIDList portIDs() const
163  {
164  SYS_STATIC_ASSERT( sizeof(UN_PortID) == sizeof(UN_DataID) );
165  return reinterpret_cast<UN_PortIDList&&>( std::move( dataIDs() ));
166  }
167 
168  /// Returns a list of all the valid port IDs in the graph.
169  UN_PortIDList sortedPortIDs() const
170  {
171  SYS_STATIC_ASSERT( sizeof(UN_PortID) == sizeof(UN_DataID) );
172  return reinterpret_cast<UN_PortIDList&&>( std::move(sortedDataIDs() ));
173  }
174 
175 
176 public:
177  /// Sets the port's kind indicating whether it is an input or an output.
178  void setKind( UN_PortID port_id, UN_PortKind port_kind )
179  {
180  // The port is either input or output; no need for invalid.
181  // Invalid is used elsewhere to indicate error in queries, etc.
182  // Here, we use a bit array to conserve space and pack more data
183  // into cache lines, so it's either input or output.
184  UT_ASSERT( port_kind != UN_PortKind::Invalid );
185  setData( myKind, port_id, port_kind == UN_PortKind::Input );
186  }
187 
188  /// Returns the port's kind indicating whether it is an input or an output.
189  UN_PortKind kind( UN_PortID port_id ) const
190  {
191  auto index = portIndex( port_id );
192  if( index )
193  return myKind[ index ] ? UN_PortKind::Input : UN_PortKind::Output;
194 
195  return UN_PortKind::Invalid;
196  }
197 
198 protected:
199  /// Sets the port name that identifies it on the node.
200  // Only the friend UN_GraphData can call it because it may need to
201  // enforce a unique port name.
202  void setName( UN_PortID port_id, const UT_StringRef &name )
203  {
204  UT_ASSERT( !myCheckValidPortNames || UN_Utils::isValidPortName( name ));
205  setData( myName, port_id, name );
206  }
207 
208 public:
209  /// Returns the port name that identifies it on the node.
210  const UT_StringHolder & name( UN_PortID port_id ) const
211  {
212  return getDataRef( myName, port_id, UT_StringHolder::theEmptyString );
213  }
214 
215  /// Sets the name of the port's type.
216  void setTypeName( UN_PortID port_id, const UT_StringRef &type_name )
217  {
218  UT_ASSERT( !myCheckValidPortTypeNames
219  || UN_Utils::isValidPortTypeName( type_name ));
220  setData( myTypeName, port_id, type_name );
221  }
222 
223  /// Returns the name of the port's type.
224  const UT_StringHolder & typeName( UN_PortID port_id ) const
225  {
226  return getDataRef(myTypeName, port_id, UT_StringHolder::theEmptyString);
227  }
228 
229  /// Sets the port's label.
230  void setLabel( UN_PortID port_id, const UT_StringRef &label )
231  {
232  setData( myLabel, port_id, label );
233  }
234 
235  /// Returns the port's label.
236  const UT_StringHolder & label( UN_PortID port_id ) const
237  {
238  return getDataRef( myLabel, port_id, UT_StringHolder::theEmptyString );
239  }
240 
241  // TODO: FIXME: consider refactoring buffers into UN-friendly objects
242  // for reuse. Eg UN_StringArrayBuffer, wchich would have
243  // set(), get(), steal(), and update(). Then UN_NodeData class
244  // would just return that buffer object.
245  // The calls would loo like node_data.tags().set(id, val);
246  //
247  // Another variation would be to return a data entry handle
248  // that has set(), get(), steal(), and update() methods.
249  // node_data.tags(id).set(val).
250 
251  /// Updates the port tags in-place.
252  /// Usage: updateTags(id, [&t](auto &tags) { tags.append(t); });
253  template <typename OP>
254  void updateTags( UN_PortID port_id, const OP &op )
255  {
256  updateData( myTags, port_id, op );
257  }
258 
259  /// Sets new tags on a port via copy-assignment.
260  void setTags( UN_PortID port_id, const UT_StringArray &tags )
261  {
262  setData( myTags, port_id, tags );
263  }
264 
265  /// Sets new tags on a port via move-assignment.
266  void setTags( UN_PortID port_id, UT_StringArray &&tags )
267  {
268  setData( myTags, port_id, std::move(tags) );
269  }
270 
271  /// Returns port's tags.
272  const UT_StringArray & tags( UN_PortID port_id ) const
273  {
274  return getDataRef( myTags, port_id, theDefTags );
275  }
276 
277  /// Returns port's tags moved from the data buffer entry.
278  UT_StringArray stealTags( UN_PortID port_id )
279  {
280  return stealData( myTags, port_id, theDefTags );
281  }
282 
283 
284  /// Sets the data value in a generic buffer for a given port.
285  template<typename T>
286  void setGenericData( UN_GenericBufferID buf_id, UN_PortID port_id,
287  const T &value )
288  { UN_Data::setGenericData( buf_id, port_id, value ); }
289 
290  /// Sets the data value in a generic buffer via move.
291  template<typename T>
292  void setGenericData( UN_GenericBufferID buf_id, UN_PortID port_id,
293  T &&value )
294  { UN_Data::setGenericData( buf_id, port_id, std::forward<T>(value) ); }
295 
296  /// Returns a const ref to the data value in a generic buffer.
297  template<typename T>
299  UN_PortID port_id ) const
300  { return UN_Data::genericDataRef<T>( buf_id, port_id ); }
301 
302  /// Returns a copy of a data value from a generic buffer.
303  template<typename T>
304  T genericDataVal( UN_GenericBufferID buf_id, UN_PortID port_id ) const
305  { return UN_Data::genericDataVal<T>( buf_id, port_id ); }
306 
307 
308  /// Moves the data value out of a generic buffer.
309  template<typename T>
310  T stealGenericData( UN_GenericBufferID buf_id, UN_PortID port_id )
311  { return UN_Data::stealGenericData<T>( buf_id, port_id ); }
312 
313  /// Updates the data value in a generic buffer in-place via a callable.
314  template<typename T, typename OP>
315  void updateGenericData( UN_GenericBufferID buf_id, UN_PortID port_id,
316  const OP &op )
317  { UN_Data::updateGenericData<T>( buf_id, port_id, op ); }
318 
319 
320  /// Asserts that the port names are alphanumeric.
321  void setCheckValidPortNames( bool flag )
322  { myCheckValidPortNames = flag; }
323 
324  /// Asserts that the port type names are alphanumeric.
325  void setCheckValidPortTypeNames( bool flag )
326  { myCheckValidPortTypeNames = flag; }
327 
328 protected:
329  /// Returns the port's data index into the data buffer arrays.
330  UN_PortIndex portIndex( UN_PortID id ) const
331  {
332  return UN_PortIndex( UN_Data::dataIndex( id ));
333  }
334 
335 private:
336  /// Returns the current size of the internals data buffers.
337  /// The number of valid entries (slots) in data buffers is less than
338  /// or equal to that number, since some data slots may be free.
339  UN_DataSize coreDataBufferSize() const
340  {
341  UN_DataSize size( myName.size() );
342  UT_ASSERT( isCoreDataSizeConsistent( size ));
343  return size;
344  }
345 
346  /// Handles merging of another port data container into this one.
347  void mergeCoreData( const UN_PortData &src,
348  const UN_DataMergeInfo &merge_info );
349 
350  /// Adds a new data slot to accommodate a new data piece at the given index.
351  void addCoreData( UN_PortIndex port_index );
352 
353  /// Clears the data for the given port to the default state.
354  void clearCoreData( UN_PortIndex port_index );
355 
356  /// Frees the data slot occupied by the given port,
357  /// clearing it if necessary.
358  void removeCoreData() //, index)
359  // Nothing urgent to free; will clear lazily
360  { UT_ASSERT( isDataSizeConsistent() ); }
361 
362  /// Frees all the data slots.
363  void removeAllCoreData();
364 
365  /// Sets the capacity of core data buffers if needed.
366  void setCoreDataCapacityIfNeeded( UN_DataSize min_capacity );
367 
368  /// @{ Returns true if the sizes of all core data buffers are equal.
369  bool isCoreDataSizeConsistent( UN_DataSize expected_size ) const;
370  bool isCoreDataSizeConsistent() const
371  { return isCoreDataSizeConsistent( myKind.size() ); }
372  /// @}
373 
374  /// Returns true if the sizes of data buffers and index map are equal.
375  bool isDataSizeConsistent() const;
376 
377 public:
378  // The default values for the UN port data.
379  static inline const UT_StringArray theDefTags;
380 
381 private:
382  /// The port's kind. Ie, input vs. output (input == 1 or an output == 0).
383  static constexpr bool UN_INPUT_PORT = true;
384  static constexpr bool UN_OUTPUT_PORT = false;
385  static constexpr bool UN_DEFAULT_PORT_KIND =
386  //arbitrary; assume input
387  UN_PortData::UN_INPUT_PORT;
388  UN_BoolDataBuffer myKind;
389 
390  /// The name of the port.
391  UN_StringDataBuffer myName;
392 
393  /// The type of the port.
394  UN_StringDataBuffer myTypeName;
395 
396  /// The label of the port (for GUI)
397  UN_StringDataBuffer myLabel;
398 
399  /// Port's tags.
401 
402  /// Check an assertion that the port names are alphanumeric.
403  bool myCheckValidPortNames = false;
404 
405  /// Check an assertion that the port type names are alphanumeric.
406  bool myCheckValidPortTypeNames = false;
407 };
408 
409 
410 #endif
const UT_StringHolder & typeName(UN_PortID port_id) const
Returns the name of the port's type.
Definition: UN_PortData.h:224
IDRange idRange() const
Definition: UN_Data.h:55
#define SYS_STATIC_ASSERT(expr)
void setName(UN_PortID port_id, const UT_StringRef &name)
Sets the port name that identifies it on the node.
Definition: UN_PortData.h:202
void setTags(UN_PortID port_id, UT_StringArray &&tags)
Sets new tags on a port via move-assignment.
Definition: UN_PortData.h:266
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
UN_PortIDList sortedPortIDs() const
Returns a list of all the valid port IDs in the graph.
Definition: UN_PortData.h:169
UT_StringArray stealTags(UN_PortID port_id)
Returns port's tags moved from the data buffer entry.
Definition: UN_PortData.h:278
void setGenericData(UN_GenericBufferID buf_id, UN_PortID port_id, const T &value)
Sets the data value in a generic buffer for a given port.
Definition: UN_PortData.h:286
GLsizei const GLfloat * value
Definition: glcorearb.h:824
void setTags(UN_PortID port_id, const UT_StringArray &tags)
Sets new tags on a port via copy-assignment.
Definition: UN_PortData.h:260
bool isValid(UN_DataID data_id) const
Definition: UN_Data.h:140
void updateGenericData(UN_GenericBufferID buf_id, UN_PortID port_id, const OP &op)
Updates the data value in a generic buffer in-place via a callable.
Definition: UN_PortData.h:315
value_type operator*() const
Definition: UN_PortData.h:126
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
SYS_FORCE_INLINE TO_T UTverify_cast(FROM_T from)
Definition: UT_Assert.h:242
void setCheckValidPortNames(bool flag)
Asserts that the port names are alphanumeric.
Definition: UN_PortData.h:321
Iterator for traversing valid data IDs in the map.
#define UN_API
Definition: UN_API.h:11
UN_Data & operator=(UN_Data &&)
static const UT_StringArray theDefTags
Definition: UN_PortData.h:379
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
UN_DataIndex dataIndex(UN_DataID id) const
Definition: UN_Data.h:147
void setCheckValidPortTypeNames(bool flag)
Asserts that the port type names are alphanumeric.
Definition: UN_PortData.h:325
void updateTags(UN_PortID port_id, const OP &op)
Definition: UN_PortData.h:254
V stealData(B &buffer, UN_DataID id, const V &default_value)
Helper method to return a value moved from an entry in the data buffer.
Definition: UN_Data.h:213
bool isValid(UN_PortID port_id) const
Definition: UN_PortData.h:112
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
const T & genericDataRef(UN_GenericBufferID buf_id, UN_PortID port_id) const
Returns a const ref to the data value in a generic buffer.
Definition: UN_PortData.h:298
Iterator for traversing valid port IDs in an ascending order.
Definition: UN_PortData.h:131
UN_CustomData * customData()
Returns the custom data container, if one was provided.
Definition: UN_Data.h:47
void setGenericData(UN_GenericBufferID buf_id, UN_DataID id, const T &value)
Sets the data value in a generic buffer for a given data ID.
Definition: UN_Data.h:275
static const UT_StringHolder theEmptyString
OrderedIDRange orderedIDRange() const
Definition: UN_PortData.h:155
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
T stealGenericData(UN_GenericBufferID buf_id, UN_PortID port_id)
Moves the data value out of a generic buffer.
Definition: UN_PortData.h:310
IDRange idRange() const
Definition: UN_PortData.h:147
UNI_PortKind
Specifies the port kind, ie, wheter it is an input or an output port.
Definition: UNI_Include.h:21
UN_DataIDList dataIDs() const
Returns a list of all the valid IDs in this container.
Definition: UN_Data.h:64
void setLabel(UN_PortID port_id, const UT_StringRef &label)
Sets the port's label.
Definition: UN_PortData.h:230
Data buffer specialization for boolean (bit) values.
UN_CustomPortData * customPortData()
Returns port's custom data container, if one was provided.
Definition: UN_PortData.h:56
GLuint const GLchar * name
Definition: glcorearb.h:786
UN_DataIndexMap::IDRange IDRange
Returns a range for iterating valid IDs.
Definition: UN_Data.h:54
void updateData(B &buffer, UN_DataID id, const OP &op)
Definition: UN_Data.h:229
Maintains a mapping from data ID to data index in the data buffer.
GLsizeiptr size
Definition: glcorearb.h:664
void setGenericData(UN_GenericBufferID buf_id, UN_PortID port_id, T &&value)
Sets the data value in a generic buffer via move.
Definition: UN_PortData.h:292
A map of string to various well defined value types.
Definition: UT_Options.h:87
OrderedIDIterator(const UN_DataIndexMap::OrderedIDIterator &id_iterator)
Definition: UN_PortData.h:136
Iterator for traversing valid data IDs in the map in an ordered fashion.
IDIterator(const UN_DataIndexMap::IDIterator &id_iterator)
Definition: UN_PortData.h:122
UT_UniquePtr< UN_CustomPortData > UN_CustomPortDataPtr
Definition: UN_PortData.h:23
GLuint index
Definition: glcorearb.h:786
T genericDataVal(UN_GenericBufferID buf_id, UN_PortID port_id) const
Returns a copy of a data value from a generic buffer.
Definition: UN_PortData.h:304
void setData(B &buffer, UN_DataID id, const V &value)
Helper method to copy-assign the value to an entry in the data buffer.
Definition: UN_Data.h:173
UN_PortIDList portIDs() const
Returns a list of all the valid port IDs in the graph.
Definition: UN_PortData.h:162
const UT_StringArray & tags(UN_PortID port_id) const
Returns port's tags.
Definition: UN_PortData.h:272
UN_PortIndex portIndex(UN_PortID id) const
Returns the port's data index into the data buffer arrays.
Definition: UN_PortData.h:330
value_type operator*() const
Definition: UN_PortData.h:140
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:165
OutGridT XformOp bool bool MergePolicy merge
UN_DataSize size() const
Returns the number of valid data items in the buffer.
Definition: UN_Data.h:72
UN_DataIDList sortedDataIDs() const
Returns a sorted list of all the valid IDs in this container.
Definition: UN_Data.h:68
const UT_StringHolder & label(UN_PortID port_id) const
Returns the port's label.
Definition: UN_PortData.h:236
void clearPort()
UN_DataIndexMap::OrderedIDRange OrderedIDRange
Returns a range for iterating valid IDs in an ascending order.
Definition: UN_Data.h:59
friend UN_GraphData
Definition: UN_PortData.h:45
const UN_CustomPortData * customPortData() const
Returns port's custom data container, if one was provided.
Definition: UN_PortData.h:61
Definition: UNI_ID.h:25
const V & getDataRef(const B &buffer, UN_DataID id, const V &default_value) const
Helper method to return a const ref to an entry in the data buffer.
Definition: UN_Data.h:190
void setKind(UN_PortID port_id, UN_PortKind port_kind)
Sets the port's kind indicating whether it is an input or an output.
Definition: UN_PortData.h:178
OrderedIDRange orderedIDRange() const
Definition: UN_Data.h:60
UT_UniquePtr< UN_Options > UN_OptionsPtr
Definition: UN_Include.h:640
GLenum src
Definition: glcorearb.h:1793
Iterator for traversing valid port IDs.
Definition: UN_PortData.h:117