HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_Handle.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: GA_Handle.h ( GA Library, C++)
7  *
8  * COMMENTS: A lightweight probe to deal with specific attributes of
9  * a specific type.
10  */
11 
12 #pragma once
13 
14 #ifndef __GA_Handle__
15 #define __GA_Handle__
16 
17 #include "GA_API.h"
18 
19 #include "GA_ATINumeric.h"
20 #include "GA_PageArray.h"
21 
22 #include "GA_AIFNumericArray.h"
25 #include "GA_AIFSharedDictTuple.h"
26 #include "GA_ATIString.h"
27 #include "GA_ATIDict.h"
28 #include "GA_OffsetList.h"
29 #include "GA_Types.h"
30 
31 #if UT_ASSERT_LEVEL >= UT_ASSERT_LEVEL_PARANOID
32 #include "GA_IndexMap.h"
33 #endif
34 
35 #include <UT/UT_Assert.h>
36 #include <UT/UT_FixedVector.h>
37 #include <UT/UT_Matrix3.h>
38 #include <UT/UT_Matrix4.h>
39 #include <UT/UT_Quaternion.h>
40 #include <UT/UT_Storage.h>
41 #include <UT/UT_StringHolder.h>
42 #include <UT/UT_Vector2.h>
43 #include <UT/UT_Vector3.h>
44 #include <UT/UT_Vector4.h>
45 #include <UT/UT_VectorTypes.h>
46 
47 #include <SYS/SYS_Inline.h>
48 #include <SYS/SYS_Types.h>
49 #include <SYS/SYS_TypeTraits.h>
50 
51 
52 class GA_Attribute;
53 class GA_Detail;
54 class GA_Range;
55 class UT_StringArray;
56 
57 
58 namespace {
59 
60 class ga_OffsetToIndexTrivial
61 {
62 public:
63  ga_OffsetToIndexTrivial(GA_Offset start)
64  : myStartOffset(start)
65  {
66  }
67 
69  {
70  return GA_Index((GA_Size)(offset - myStartOffset));
71  }
72 
73 protected:
74  const GA_Offset myStartOffset;
75 
76 };
77 
78 class ga_OffsetToIndex
79 {
80 public:
81  ga_OffsetToIndex(GA_Offset startoff, const GA_ListType<GA_Offset, GA_Index> &offtoindex)
82  : myStartIndex(offtoindex(startoff))
83  , myOffsetToIndex(offtoindex)
84  {
85  }
86 
87  GA_Index operator()(GA_Offset offset) const
88  {
89  return myOffsetToIndex(offset) - myStartIndex;
90  }
91 
92 protected:
93  const GA_Index myStartIndex;
94  const GA_ListType<GA_Offset, GA_Index> &myOffsetToIndex;
95 };
96 
97 }
98 
99 /// Read-only handle for vector attribute data.
100 ///
101 /// @tparam T Return vector type for get methods. Requires T::value_type to
102 /// describe the underlying element type of the vector.
103 ///
104 /// @tparam ENABLE Use SYS_EnableIf to specialize arithmetic template
105 /// implementations (i.e. see the SCALAR implementation)
106 ///
107 template <typename T, typename ENABLE = void>
109 {
110 public:
112  typedef typename T::value_type BASETYPE;
114 
116  {
117  clear();
118  }
119  GA_ROHandleT(const GA_Attribute *attrib)
120  {
121  bind(attrib);
122  }
123  GA_ROHandleT(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
124 
125  void operator=(const GA_Attribute *attrib)
126  {
127  bind(attrib);
128  }
129 
130  void bind(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
131 
133  void bind(const GA_Attribute *attrib, int minsize=1)
134  {
135  bind(GA_ATINumeric::cast(attrib), minsize);
136  }
137 
138  void bind(const GA_ATINumeric *attrib, int minsize=1)
139  {
140  myExactMatch = nullptr;
141  myAlmostMatch = nullptr;
142  myAttrib = SYSconst_cast(attrib);
143  if (!myAttrib)
144  return;
145 
146  int actual_tuple_size = myAttrib->getTupleSize();
147  if (actual_tuple_size < minsize * theTupleSize)
148  {
149  myAttrib = nullptr;
150  return;
151  }
152 
153  if (actual_tuple_size == theTupleSize)
154  {
155  UT_Storage actual_storage = myAttrib->getData().Base::getStorage();
156  if (actual_storage == UT_StorageNum<BASETYPE>::theStorage)
157  myExactMatch = &myAttrib->getData().castType<BASETYPE>().template castTupleSize<theTupleSize>();
158  else if (actual_storage == UT_StorageNum<typename UT_StorageNum<BASETYPE>::SecondGuess>::theStorage)
159  myAlmostMatch = &myAttrib->getData().castType<typename UT_StorageNum<BASETYPE>::SecondGuess>().template castTupleSize<theTupleSize>();
160  }
161  }
162 
163  const GA_ATINumeric *getAttribute() const { return myAttrib; }
164 
166  {
167  if (myAttrib)
168  return myAttrib->getDataId();
169  return GA_INVALID_DATAID;
170  }
171 
172 
173  // Check whether the attribute is GA_TYPE_HPOINT
174  bool isRational() const
175  { return myAttrib->getTypeInfo() == GA_TYPE_HPOINT; }
176 
177  void clear()
178  {
179  myAttrib = nullptr;
180  myExactMatch = nullptr;
181  myAlmostMatch = nullptr;
182  }
183 
185  {
186  return myAttrib;
187  }
189  {
190  return !myAttrib;
191  }
192 
193  SYS_FORCE_INLINE T get(GA_Offset off, int comp=0) const
194  {
195  UT_ASSERT_P(comp == 0 &&
196  "Component offset not currently supported for vector/matrix types");
198  UT_ASSERT_P(GAisValid(off));
200 
201  if (myExactMatch)
202  return T(myExactMatch->template getVector<BASETYPE,theTupleSize>(off));
203  return getNonInlinePart(off);
204  }
205 private:
206  T getNonInlinePart(GA_Offset off) const
207  {
208  if (myAlmostMatch)
209  return T(myAlmostMatch->template getVector<BASETYPE,theTupleSize>(off));
210  return T(myAttrib->getData().getVector<BASETYPE,theTupleSize>(off));
211  }
212 public:
213 
214  /// Copies attribute values from a contiguous block of offsets
215  /// into the dest array.
216  /// NOTE: The block of offsets is assumed to have no holes, else
217  /// data could be read from offsets that don't have
218  /// corresponding elements.
219  void getBlock(GA_Offset startoff, GA_Size nelements, T *dest, int deststride = 1, int component = 0) const;
220 
221  /// Copies attribute values from a contiguous block of indices
222  /// into the dest array.
223  /// This allows there to be holes in the geometry.
224  void getBlockFromIndices(GA_Index startidx, GA_Size nelements, T *dest, int deststride = 1, int component = 0) const;
225 
227  {
228  return get(off);
229  }
231  {
232  return get(off);
233  }
234  /// Returns true iff the specified page is constant-compressed,
235  /// where a single value is stored to represent GA_PAGE_SIZE
236  /// values in the page, (or possibly fewer if only one page).
238  {
239  return myAttrib->isPageConstant(pagenum);
240  }
241  bool operator==(const GA_ROHandleT<T> &handle) const
242  {
243  return myAttrib == handle.myAttrib;
244  }
245  bool operator!=(const GA_ROHandleT<T> &handle) const
246  {
247  return myAttrib != handle.myAttrib;
248  }
249  const GA_ATINumeric *operator->() const
250  {
251  return myAttrib;
252  }
253 protected:
257 };
258 
259 /// Read-write handle for vector attribute data.
260 ///
261 /// @tparam T Return vector type for get methods. Requires T::value_type to
262 /// describe the underlying element type of the vector.
263 ///
264 template <typename T, typename ENABLE = void>
265 class GA_RWHandleT : public GA_ROHandleT<T, ENABLE>
266 {
267 public:
268  typedef void (*GAprobeAttribSetter)(GA_Attribute *atr, GA_Offset, const T &);
270  typedef typename T::value_type BASETYPE;
271 private:
272  using Base::myAttrib;
273  using Base::myExactMatch;
274  using Base::myAlmostMatch;
275 public:
276 
278  {
279  clear();
280  }
282  {
283  bind(attrib);
284  }
285  GA_RWHandleT(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
286 
287  void operator=(GA_Attribute *attrib)
288  {
289  bind(attrib);
290  }
291 
292  void bind(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
293 
295  void bind(GA_Attribute *attrib, int minsize=1)
296  {
297  bind(GA_ATINumeric::cast(attrib), minsize);
298  }
300  void bind(GA_ATINumeric *attrib, int minsize=1)
301  {
302  Base::bind(attrib, minsize);
303  }
304 
305  using Base::clear;
306 
307  GA_ATINumeric *getAttribute() const { return myAttrib; }
308 
309  void bumpDataId() const
310  {
311  if (myAttrib)
312  myAttrib->bumpDataId();
313  }
314 
316  {
317  if (myAttrib)
318  return myAttrib->getDataId();
319  return GA_INVALID_DATAID;
320  }
321 
322  SYS_FORCE_INLINE void set(GA_Offset off, const T &val) const
323  {
325  UT_ASSERT_P(GAisValid(off));
327  if (myExactMatch)
328  myExactMatch->setVector(off, reinterpret_cast<const typename UT_FixedVectorTraits<T>::FixedVectorType &>(val));
329  else if (myAlmostMatch)
330  myAlmostMatch->setVector(off, reinterpret_cast<const typename UT_FixedVectorTraits<T>::FixedVectorType &>(val));
331  else
332  myAttrib->getData().setVector(off, reinterpret_cast<const typename UT_FixedVectorTraits<T>::FixedVectorType &>(val));
333  }
334 
335  SYS_FORCE_INLINE void set(GA_Offset off, int comp, const T &val) const
336  {
337  UT_ASSERT(comp == 0 && "Component sets on vector types unsupported");
339  UT_ASSERT_P(GAisValid(off));
341  if (myExactMatch)
342  myExactMatch->setVector(off, reinterpret_cast<const typename UT_FixedVectorTraits<T>::FixedVectorType &>(val));
343  else if (myAlmostMatch)
344  myAlmostMatch->setVector(off, reinterpret_cast<const typename UT_FixedVectorTraits<T>::FixedVectorType &>(val));
345  else
346  myAttrib->getData().setVector(off, reinterpret_cast<const typename UT_FixedVectorTraits<T>::FixedVectorType &>(val));
347  }
348 
349  SYS_FORCE_INLINE void add(GA_Offset off, const T &val) const
350  {
352  UT_ASSERT_P(GAisValid(off));
354  if (myExactMatch)
355  myExactMatch->addVector(off, reinterpret_cast<const typename UT_FixedVectorTraits<T>::FixedVectorType &>(val));
356  else if (myAlmostMatch)
357  myAlmostMatch->addVector(off, reinterpret_cast<const typename UT_FixedVectorTraits<T>::FixedVectorType &>(val));
358  else
359  myAttrib->getData().addVector(off, reinterpret_cast<const typename UT_FixedVectorTraits<T>::FixedVectorType &>(val));
360  }
361 
362  SYS_FORCE_INLINE void add(GA_Offset off, int comp, const T &val) const
363  {
364  UT_ASSERT(comp == 0 && "Component sets on vector types unsupported");
366  UT_ASSERT_P(GAisValid(off));
368  if (myExactMatch)
369  myExactMatch->addVector(off, reinterpret_cast<const typename UT_FixedVectorTraits<T>::FixedVectorType &>(val));
370  else if (myAlmostMatch)
371  myAlmostMatch->addVector(off, reinterpret_cast<const typename UT_FixedVectorTraits<T>::FixedVectorType &>(val));
372  else
373  myAttrib->getData().addVector(off, reinterpret_cast<const typename UT_FixedVectorTraits<T>::FixedVectorType &>(val));
374  }
375 
376  /// Copies attribute values from the source array into a contiguous
377  /// block of offsets.
378  /// NOTE: The block of offsets is assumed to have no holes, else
379  /// data could be written to offsets that don't have
380  /// corresponding elements.
381  void setBlock(GA_Offset startoff, GA_Size nelements, const T *source, int sourcestride = 1, int component = 0) const;
382 
383  void setBlockFromIndices(GA_Index startidx, GA_Size nelements, const T *source, int sourcestride = 1, int component = 0) const;
384 
385  void makeConstant(const T &cval) const
386  {
388  myAttrib->getAIFTuple()->makeConstant(myAttrib, &cval.data()[0], sizeof(T)/sizeof(BASETYPE), 0);
389  }
390 
391  /// Sets all components of all elements of the specified page to
392  /// the given values.
393  /// NOTE: The length of values must be equal to the tuple size.
394  void setPageConstant(GA_PageNum pagenum, const BASETYPE *values) const
395  {
396  if (myExactMatch)
397  myExactMatch->setPageConstant(pagenum, values);
398  else if (myAlmostMatch)
399  myAlmostMatch->setPageConstant(pagenum, values);
400  else
401  myAttrib->getData().setPageConstant(pagenum, values);
402  }
403 
405  {
406  return myAttrib;
407  }
408 
409 };
410 
411 /// Simplify checking for scalar types
412 #define SCALAR(T) SYS_EnableIf< SYS_IsArithmetic<T>::value >::type
413 
414 /// Read-only handle for scalar attribute data.
415 ///
416 /// @tparam T Return type for get methods
417 ///
418 template <typename T>
419 class GA_ROHandleT<T, typename SCALAR(T) >
420 {
421 public:
422  typedef T (*GAprobeAttribGetter)(const GA_Attribute *atr, GA_Offset, int);
423  typedef T BASETYPE;
424 
426  {
427  clear();
428  }
429  GA_ROHandleT(const GA_Attribute *attrib)
430  {
431  bind(attrib);
432  }
433  GA_ROHandleT(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
434 
435  void operator=(const GA_Attribute *attrib)
436  {
437  bind(attrib);
438  }
439 
440  void bind(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
441 
443  void bind(const GA_Attribute *attrib, int minsize=1)
444  {
445  bind(GA_ATINumeric::cast(attrib), minsize);
446  }
447  void bind(const GA_ATINumeric *attrib, int minsize=1)
448  {
449  myExactMatch = nullptr;
450  myAlmostMatch = nullptr;
451  myAttrib = SYSconst_cast(attrib);
452  if (!myAttrib)
453  return;
454 
455  int actual_tuple_size = myAttrib->getTupleSize();
456  if (actual_tuple_size < minsize)
457  {
458  myAttrib = nullptr;
459  return;
460  }
461 
462  UT_Storage actual_storage = attrib->getData().Base::getStorage();
463  if (actual_storage == UT_StorageNum<BASETYPE>::theStorage)
464  {
465  if (actual_tuple_size == 1)
466  myExactMatch = &myAttrib->getData().castType<BASETYPE>().template castTupleSize<1>();
467  else
469  }
470  }
471 
472  const GA_ATINumeric *getAttribute() const { return myAttrib; }
473  int getTupleSize() const { return myAttrib->getTupleSize(); }
474 
476  {
477  if (myAttrib)
478  return myAttrib->getDataId();
479  return GA_INVALID_DATAID;
480  }
481 
482  // Check whether the attribute is GA_TYPE_HPOINT
483  bool isRational() const
484  { return myAttrib->getTypeInfo() == GA_TYPE_HPOINT; }
485 
486  void clear()
487  {
488  myAttrib = nullptr;
489  myExactMatch = nullptr;
490  myAlmostMatch = nullptr;
491  }
492 
494  {
495  return myAttrib;
496  }
498  {
499  return !myAttrib;
500  }
501 
502  SYS_FORCE_INLINE T get(GA_Offset off, int comp = 0) const
503  {
505  UT_ASSERT_P(GAisValid(off));
507  UT_ASSERT_P(comp >= 0 && comp < myAttrib->getTupleSize());
508  if (myExactMatch)
509  {
510  UT_ASSERT_P(comp == 0);
511  return myExactMatch->template get<T>(off);
512  }
513  return getNotInline(off, comp);
514  }
515 private:
516  T getNotInline(GA_Offset off, int comp) const
517  {
518  if (myAlmostMatch)
519  return myAlmostMatch->template get<T>(off, comp);
520  return myAttrib->getData().get<T>(off, comp);
521  }
522 public:
523  SYS_FORCE_INLINE void getV(GA_Offset off, T *data, int size) const
524  {
526  UT_ASSERT_P(size >= 0 && size <= myAttrib->getTupleSize());
527  if (myExactMatch)
528  {
529  UT_ASSERT_P(size<=1);
530  if (size==1)
531  data[0] = myExactMatch->template get<T>(off);
532  }
533  else if (myAlmostMatch)
534  {
535  for (int comp = 0; comp < size; ++comp)
536  data[comp] = myAlmostMatch->template get<T>(off, comp);
537  }
538  else
539  {
540  auto &src = myAttrib->getData();
541  for (int comp = 0; comp < size; ++comp)
542  data[comp] = src.get<T>(off, comp);
543  }
544  }
545 
546  /// Copies attribute values from a contiguous block of offsets
547  /// into the dest array.
548  /// NOTE: The block of offsets is assumed to have no holes, else
549  /// data could be read from offsets that don't have
550  /// corresponding elements.
551  void getBlock(GA_Offset startoff, GA_Size nelements, T *dest, int deststride = 1, int component = 0) const;
552 
553  /// Copies attribute values from a contiguous block of indices
554  /// into the dest array.
555  /// This allows there to be holes in the geometry.
556  void getBlockFromIndices(GA_Index startidx, GA_Size nelements, T *dest, int deststride = 1, int component = 0) const;
557 
558  SYS_FORCE_INLINE T operator()(GA_Offset off, int comp = 0) const
559  {
560  return get(off, comp);
561  }
563  {
564  return get(off);
565  }
566  /// Returns true iff the specified page is constant-compressed,
567  /// where a single value is stored to represent GA_PAGE_SIZE
568  /// values in the page, (or possibly fewer if only one page).
570  {
571  return myAttrib->isPageConstant(pagenum);
572  }
573  bool operator==(const GA_ROHandleT<T> &handle) const
574  {
575  return myAttrib == handle.myAttrib;
576  }
577  bool operator!=(const GA_ROHandleT<T> &handle) const
578  {
579  return myAttrib != handle.myAttrib;
580  }
581  const GA_ATINumeric *operator->() const
582  {
583  return myAttrib;
584  }
585 
586 protected:
590 };
591 
592 /// Read-write handle for scalar attribute data.
593 ///
594 /// @tparam T Return type for get methods
595 ///
596 template <typename T>
597 class GA_RWHandleT<T, typename SCALAR(T) > : public GA_ROHandleT<T, typename SCALAR(T) >
598 {
599 public:
602  typedef T BASETYPE;
603 private:
604  using Base::myAttrib;
605  using Base::myExactMatch;
606  using Base::myAlmostMatch;
607 public:
608 
610  {
611  clear();
612  }
614  {
615  bind(attrib);
616  }
617  GA_RWHandleT(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
618 
619  void operator=(GA_Attribute *attrib)
620  {
621  bind(attrib);
622  }
623 
624  void bind(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
625 
627  void bind(GA_Attribute *attrib, int minsize=1)
628  {
629  bind(GA_ATINumeric::cast(attrib), minsize);
630  }
631  void bind(GA_ATINumeric *attrib, int minsize=1)
632  {
633  Base::bind(attrib, minsize);
634  }
635 
636  using Base::clear;
637 
638  GA_ATINumeric *getAttribute() const { return myAttrib; }
639 
640  void bumpDataId() const
641  {
642  if (myAttrib)
643  myAttrib->bumpDataId();
644  }
645 
647  {
648  if (myAttrib)
649  return myAttrib->getDataId();
650  return GA_INVALID_DATAID;
651  }
652 
653  SYS_FORCE_INLINE void set(GA_Offset off, T val) const
654  {
656  UT_ASSERT_P(GAisValid(off));
658  if (myExactMatch)
659  myExactMatch->set(off, val);
660  else if (myAlmostMatch)
661  myAlmostMatch->set(off, val);
662  else
663  myAttrib->getData().set(off, val);
664  }
665 
666  SYS_FORCE_INLINE void add(GA_Offset off, T val) const
667  {
669  UT_ASSERT_P(GAisValid(off));
671  if (myExactMatch)
672  myExactMatch->add(off, val);
673  else if (myAlmostMatch)
674  myAlmostMatch->add(off, val);
675  else
676  myAttrib->getData().add(off, val);
677  }
678 
679  SYS_FORCE_INLINE void set(GA_Offset off, int comp, T val) const
680  {
681  UT_ASSERT_P(myAttrib != nullptr);
682  UT_ASSERT_P(comp >= 0 && comp < myAttrib->getTupleSize());
683  UT_ASSERT_P(GAisValid(off));
685  if (myExactMatch)
686  myExactMatch->set(off, comp, val);
687  else if (myAlmostMatch)
688  myAlmostMatch->set(off, comp, val);
689  else
690  myAttrib->getData().set(off, comp, val);
691  }
692  SYS_FORCE_INLINE void setV(GA_Offset off, const T *data, int size) const
693  {
695  UT_ASSERT_P(size >= 0 && size <= myAttrib->getTupleSize());
696  if (myExactMatch)
697  {
698  UT_ASSERT_P(size<=1);
699  if (size==1)
700  myExactMatch->set(off, data[0]);
701  }
702  else if (myAlmostMatch)
703  {
704  for (int comp = 0; comp < size; ++comp)
705  myAlmostMatch->set(off, comp, data[comp]);
706  }
707  else
708  {
709  auto &src = myAttrib->getData();
710  for (int comp = 0; comp < size; ++comp)
711  src.set(off, comp, data[comp]);
712  }
713  }
714 
715  SYS_FORCE_INLINE void add(GA_Offset off, int comp, T val) const
716  {
717  UT_ASSERT_P(myAttrib != nullptr);
718  UT_ASSERT_P(comp >= 0 && comp < myAttrib->getTupleSize());
719  UT_ASSERT_P(GAisValid(off));
721  if (myExactMatch)
722  myExactMatch->add(off, comp, val);
723  else if (myAlmostMatch)
724  myAlmostMatch->add(off, comp, val);
725  else
726  myAttrib->getData().add(off, comp, val);
727  }
728 
729  /// Copies attribute values from the source array into a contiguous
730  /// block of offsets.
731  /// NOTE: The block of offsets is assumed to have no holes, else
732  /// data could be written to offsets that don't have
733  /// corresponding elements.
734  void setBlock(GA_Offset startoff, GA_Size nelements, const T *source, int sourcestride=1, int component=0) const;
735 
736  void setBlockFromIndices(GA_Index startidx, GA_Size nelements, const T *source, int sourcestride = 1, int component = 0) const;
737 
738  // -1 comp means to set all components to cval.
739  void makeConstant(T cval, int comp = -1) const
740  {
742  myAttrib->getAIFTuple()->makeConstant(myAttrib, cval, comp);
743  }
744  void makeConstantV(const T *cval, int size) const
745  {
747  myAttrib->getAIFTuple()->makeConstant(myAttrib, cval, size, 0);
748  }
749  /// Sets all components of all elements of the specified page to
750  /// the given values.
751  /// NOTE: The length of values must be equal to the tuple size.
752  void setPageConstant(GA_PageNum pagenum, const T *values) const
753  {
754  if (myExactMatch)
755  myExactMatch->setPageConstant(pagenum, values);
756  else if (myAlmostMatch)
757  myAlmostMatch->setPageConstant(pagenum, values);
758  else
759  myAttrib->getData().setPageConstant(pagenum, values);
760  }
761 
763  {
764  return myAttrib;
765  }
766 
767 };
768 
769 #undef SCALAR
770 
771 /// Read-only handle for string attribute data.
772 template <typename HOLDER, typename INDEXTYPE, typename ATI>
774 {
775 public:
777  {
778  clear();
779  }
781  {
782  bind(attrib);
783  }
785  const UT_StringRef &name, int minsize=1);
786  void operator=(const GA_Attribute *attrib)
787  {
788  bind(attrib);
789  }
790  void bind(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
791 
792  /// Bind the handle to the given attribute
793  void bind(const GA_Attribute *attrib, int minsize=1)
794  {
795  myAttrib = ATI::cast(attrib);
796  if (myAttrib && myAttrib->getTupleSize() < minsize)
797  {
798  myAttrib = 0;
799  }
800  }
801 
802  /// Access to attribute
803  const GA_Attribute *getAttribute() const { return myAttrib; }
804  /// Tuple size of the attribute
805  int getTupleSize() const { return myAttrib->getTupleSize(); }
806 
808  {
809  if (myAttrib)
810  return myAttrib->getDataId();
811  return GA_INVALID_DATAID;
812  }
813 
814 
815  /// Clear the handle
816  void clear() { myAttrib = 0; }
817 
818  /// @{
819  /// Validity checks
820  SYS_FORCE_INLINE bool isValid() const { return myAttrib; }
821  SYS_FORCE_INLINE bool isInvalid() const { return !myAttrib; }
822  /// @}
823 
824  /// Get the string at the given offset
825  SYS_FORCE_INLINE const HOLDER &get(GA_Offset off, int comp = 0) const
826  {
828  UT_ASSERT_P(GAisValid(off));
829  UT_ASSERT_P(myAttrib->getIndexMap().isOffsetActive(off) || myAttrib->getIndexMap().isOffsetTransient(off));
830  return myAttrib->getHolder(off, comp);
831  }
832  /// Get the string index at the given offset
833  SYS_FORCE_INLINE INDEXTYPE getIndex(GA_Offset off, int comp = 0) const
834  {
836  UT_ASSERT_P(GAisValid(off));
837  UT_ASSERT_P(myAttrib->getIndexMap().isOffsetActive(off) || myAttrib->getIndexMap().isOffsetTransient(off));
838  return myAttrib->getHolderIndex(off, comp);
839  }
840  const ATI *operator->() const
841  {
842  return myAttrib;
843  }
844 
845  /// Copies attribute string indices from a contiguous block of offsets
846  /// into the dest array.
847  /// NOTE: The block of offsets is assumed to have no holes, else
848  /// data could be read from offsets that don't have
849  /// corresponding elements.
850  void getIndexBlock(GA_Offset startoff, GA_Size nelements, INDEXTYPE *dest, int deststride = 1, int component = 0) const;
851 
852  /// Copies attribute string indices from a contiguous block of indices
853  /// into the dest array.
854  /// This allows there to be holes in the geometry. The dest array
855  /// will be densely filled as per the index mapping.
856  void getIndexBlockFromIndices(GA_Index startidx, GA_Size nelements, INDEXTYPE *dest, int deststride = 1, int component = 0) const;
857 
858 
859 protected:
860  const ATI *myAttrib;
861 };
862 
863 /// Read-Write string handle
864 template <typename HOLDER, typename INDEXTYPE, typename ATI>
865 class GA_RWHandleTHolder : public GA_ROHandleTHolder<HOLDER, INDEXTYPE, ATI>
866 {
867 public:
869 
870 private:
871  using Base::myAttrib;
872 public:
873 
875  : Base()
876  {
877  }
879  : Base(attrib)
880  {
881  }
883  const UT_StringRef &name, int minsize=1)
884  : Base(gdp, owner, name, minsize)
885  {
886  }
887  void operator=(GA_Attribute *attrib)
888  {
889  Base::bind(attrib);
890  }
891 
892  GA_Attribute *getAttribute() const { return rwAttrib(); }
893 
894  void bumpDataId() const
895  {
896  if (rwAttrib())
897  rwAttrib()->bumpDataId();
898  }
899 
901  {
902  if (rwAttrib())
903  return rwAttrib()->getDataId();
904  return GA_INVALID_DATAID;
905  }
906 
907  /// Store the @c str at the given offset
908  SYS_FORCE_INLINE void set(GA_Offset off, const HOLDER &str) const
909  {
910  set(off, 0, str);
911  }
912  SYS_FORCE_INLINE void set(GA_Offset off, int comp, const HOLDER &str) const
913  {
914  UT_ASSERT_P(rwAttrib() != nullptr);
915  UT_ASSERT_P(GAisValid(off));
916  UT_ASSERT_P(rwAttrib()->getIndexMap().isOffsetActive(off) || rwAttrib()->getIndexMap().isOffsetTransient(off));
917  rwAttrib()->setHolder(off, str, comp);
918  }
919  /// Store the string indexed by the @c idx at the given offset
920  SYS_FORCE_INLINE void set(GA_Offset off, INDEXTYPE idx) const
921  {
922  set(off, 0, idx);
923  }
924  SYS_FORCE_INLINE void set(GA_Offset off, int comp, INDEXTYPE idx) const
925  {
926  UT_ASSERT_P(rwAttrib() != nullptr);
927  UT_ASSERT_P(GAisValid(off));
928  UT_ASSERT_P(rwAttrib()->getIndexMap().isOffsetActive(off) || rwAttrib()->getIndexMap().isOffsetTransient(off));
929  rwAttrib()->setHolderIndex(off, idx, comp);
930  }
931  ATI *operator->() const
932  {
933  return rwAttrib();
934  }
935 protected:
936  ATI *rwAttrib() const
937  { return SYSconst_cast(myAttrib); }
938 };
939 
940 /// Read-Write string handle
941 /// Batches all reference counts until a flush() or its destructor.
942 /// Because it tracks this locally, you MUST create a separate one
943 /// per thread! (Even if this were made thread safe, that would
944 /// defeat the purpose of this, which is to use thread-local reference
945 /// counts to avoid write contention)
946 /// NOTE: This bumps the data ID of any attribute it's bound to
947 /// upon destruction.
948 template <typename HOLDER, typename INDEXTYPE, typename ATI, typename DELAYEDWRITER>
950 {
951 public:
953  {
954  clear();
955  }
957  {
958  bind(attrib);
959  }
961  const UT_StringRef &name, int minsize=1);
962  void operator=(GA_Attribute *attrib)
963  {
964  bind(attrib);
965  }
966  void bind(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
967 
968  /// Bind the handle to the given attribute
969  void bind(GA_Attribute *attrib, int minsize=1)
970  {
971  myAttrib = ATI::cast(attrib);
972  if (myAttrib && myAttrib->getTupleSize() < minsize)
973  {
974  myAttrib = 0;
975  }
976  myWriter.bind(myAttrib);
977  }
978 
979  /// Access to attribute
980  GA_Attribute *getAttribute() const { return myAttrib; }
981  /// Tuple size of the attribute
982  int getTupleSize() const { return myAttrib->getTupleSize(); }
984  {
985  if (myAttrib)
986  return myAttrib->getDataId();
987  return GA_INVALID_DATAID;
988  }
989 
990  /// Clear the handle
991  void clear()
992  {
993  myAttrib = 0;
994  myWriter.bind(myAttrib); // Also flushes.
995  }
996 
997  /// @{
998  /// Validity checks
999  SYS_FORCE_INLINE bool isValid() const { return myAttrib; }
1000  SYS_FORCE_INLINE bool isInvalid() const { return !myAttrib; }
1001  /// @}
1002 
1003  /// Get the string at the given offset
1004  SYS_FORCE_INLINE HOLDER get(GA_Offset off, int comp = 0) const
1005  {
1007  UT_ASSERT_P(GAisValid(off));
1008  UT_ASSERT_P(myAttrib->getIndexMap().isOffsetActive(off) || myAttrib->getIndexMap().isOffsetTransient(off));
1009  return myAttrib->getHolder(off, comp);
1010  }
1011  /// Get the string index at the given offset
1012  SYS_FORCE_INLINE INDEXTYPE getIndex(GA_Offset off, int comp = 0) const
1013  {
1015  UT_ASSERT_P(GAisValid(off));
1016  UT_ASSERT_P(myAttrib->getIndexMap().isOffsetActive(off) || myAttrib->getIndexMap().isOffsetTransient(off));
1017  return myAttrib->getHolderIndex(off, comp);
1018  }
1019 
1020  /// Store the @c str at the given offset
1021  SYS_FORCE_INLINE void set(GA_Offset off, const HOLDER &str)
1022  {
1023  set(off, 0, str);
1024  }
1025  SYS_FORCE_INLINE void set(const GA_Range &range, const HOLDER &str)
1026  {
1027  set(range, 0, str);
1028  }
1029  SYS_FORCE_INLINE void set(GA_Offset off, int comp, const HOLDER &str)
1030  {
1032  UT_ASSERT_P(GAisValid(off));
1033  UT_ASSERT_P(myAttrib->getIndexMap().isOffsetActive(off) || myAttrib->getIndexMap().isOffsetTransient(off));
1034  myWriter.setHolder(off, str, comp);
1035  }
1036  SYS_FORCE_INLINE void set(const GA_Range &range, int comp, const HOLDER &str)
1037  {
1038  myWriter.setHolder(range, str, comp);
1039  }
1040  /// Store the string indexed by the @c idx at the given offset
1041  SYS_FORCE_INLINE void set(GA_Offset off, INDEXTYPE idx)
1042  {
1043  set(off, 0, idx);
1044  }
1045  SYS_FORCE_INLINE void set(const GA_Range &range, INDEXTYPE idx)
1046  {
1047  set(range, 0, idx);
1048  }
1049  SYS_FORCE_INLINE void set(GA_Offset off, int comp, INDEXTYPE idx)
1050  {
1052  UT_ASSERT_P(GAisValid(off));
1053  UT_ASSERT_P(myAttrib->getIndexMap().isOffsetActive(off) || myAttrib->getIndexMap().isOffsetTransient(off));
1054  myWriter.setHolderIndex(off, idx, comp);
1055  }
1056  SYS_FORCE_INLINE void set(const GA_Range &range, int comp, INDEXTYPE idx)
1057  {
1058  myWriter.setStringIndex(range, idx, comp);
1059  }
1060 
1062  {
1063  return myWriter.hasChanges();
1064  }
1065 protected:
1066  ATI *myAttrib;
1067  DELAYEDWRITER myWriter;
1068 };
1069 
1070 namespace GA_HandleDetail
1071 {
1072 // Helper for determining AIF type given the array type T
1073 template <typename T> struct ArrayAIF;
1074 template <> struct ArrayAIF<UT_Int16Array> { typedef GA_AIFNumericArray type; };
1075 template <> struct ArrayAIF<UT_Int32Array> { typedef GA_AIFNumericArray type; };
1076 template <> struct ArrayAIF<UT_Int64Array> { typedef GA_AIFNumericArray type; };
1077 template <> struct ArrayAIF<UT_ValArray<fpreal16>> { typedef GA_AIFNumericArray type; };
1078 template <> struct ArrayAIF<UT_Fpreal32Array> { typedef GA_AIFNumericArray type; };
1079 template <> struct ArrayAIF<UT_Fpreal64Array> { typedef GA_AIFNumericArray type; };
1080 template <> struct ArrayAIF<UT_StringArray> { typedef GA_AIFSharedStringArray type; };
1082 // Helper for determining if we have an acceptable array type
1083 template <typename T> struct IsArray { static const bool value = false; };
1084 template <> struct IsArray<UT_Int16Array> { static const bool value = true; };
1085 template <> struct IsArray<UT_Int32Array> { static const bool value = true; };
1086 template <> struct IsArray<UT_Int64Array> { static const bool value = true; };
1087 template <> struct IsArray<UT_ValArray<fpreal16>> { static const bool value = true; };
1088 template <> struct IsArray<UT_Fpreal32Array> { static const bool value = true; };
1089 template <> struct IsArray<UT_Fpreal64Array> { static const bool value = true; };
1090 template <> struct IsArray<UT_StringArray> { static const bool value = true; };
1091 template <> struct IsArray<UT_Array<UT_OptionsHolder>> { static const bool value = true; };
1092 }
1093 
1094 #define ENABLE_ARRAY(T) SYS_EnableIf< GA_HandleDetail::IsArray<T>::value >::type
1095 
1096 /// Read-only handle for array attribute data
1097 template <typename T>
1098 class GA_ROHandleT<T, typename ENABLE_ARRAY(T)>
1099 {
1100 public:
1102 
1104  {
1105  clear();
1106  }
1108  {
1109  bind(attrib);
1110  }
1111  GA_ROHandleT(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
1112 
1113  void operator=(const GA_Attribute *attrib)
1114  {
1115  bind(attrib);
1116  }
1117 
1118  void bind(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
1119  void bind(const GA_Attribute *attrib, int minsize=1)
1120  {
1121  myAttrib = const_cast<GA_Attribute *>(attrib);
1122  if (!myAttrib)
1123  return;
1124  myAIF = myAttrib->getAIF<AIFType>();
1125  if (!myAIF)
1126  myAttrib = 0;
1127  }
1128 
1129  const GA_Attribute *getAttribute() const { return myAttrib; }
1130 
1131  void clear()
1132  {
1133  myAttrib = 0;
1134  myAIF = 0;
1135  }
1136 
1137  SYS_FORCE_INLINE bool isValid() const { return myAttrib; }
1138  SYS_FORCE_INLINE bool isInvalid() const { return !myAttrib; }
1139 
1140  SYS_FORCE_INLINE void get(GA_Offset off, T &value) const
1141  {
1143  UT_ASSERT_P(GAisValid(off));
1145  myAIF->get(myAttrib, off, value);
1146  }
1147 
1148  bool operator==(const GA_ROHandleT<T> &handle) const
1149  {
1150  UT_ASSERT_P(myAIF == handle.myAIF);
1151  return myAttrib == handle.myAttrib;
1152  }
1153  bool operator!=(const GA_ROHandleT<T> &handle) const
1154  {
1155  UT_ASSERT_P(myAIF == handle.myAIF);
1156  return myAttrib != handle.myAttrib;
1157  }
1158  const GA_Attribute *operator->() const
1159  {
1160  return myAttrib;
1161  }
1162 
1163 protected:
1165  const AIFType* myAIF;
1166 };
1167 
1168 /// Read-Write handle for array attribute data
1169 template <typename T>
1170 class GA_RWHandleT<T, typename ENABLE_ARRAY(T)>
1171  : public GA_ROHandleT<T, typename ENABLE_ARRAY(T)>
1172 {
1173 public:
1175 
1176 private:
1177  using Base::myAttrib;
1178 public:
1179 
1181  {
1182  this->clear();
1183  }
1185  {
1186  bind(attrib);
1187  }
1188  GA_RWHandleT(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
1189 
1190  void operator=(GA_Attribute *attrib)
1191  {
1192  bind(attrib);
1193  }
1194 
1195  void bind(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
1196  void bind(GA_Attribute *attrib, int minsize=1)
1197  {
1198  Base::bind(attrib, minsize);
1199  }
1200 
1202 
1203  void bumpDataId() const
1204  {
1205  if (myAttrib)
1206  myAttrib->bumpDataId();
1207  }
1208 
1210  {
1211  if (myAttrib)
1212  return myAttrib->getDataId();
1213  return GA_INVALID_DATAID;
1214  }
1215 
1216  SYS_FORCE_INLINE void set(GA_Offset off, const T &value) const
1217  {
1219  UT_ASSERT_P(GAisValid(off));
1221  Base::myAIF->set(myAttrib, off, value);
1222  }
1224  {
1225  return myAttrib;
1226  }
1227 
1228 private:
1229 };
1230 
1231 #undef ENABLE_ARRAY
1232 
1233 template <typename T>
1235 {
1236 public:
1239 };
1240 
1244 
1248 
1249 // Hacky workaround for now
1250 template <>
1251 class GA_HandleT<const char*>
1252 {
1253 public:
1254  typedef GA_ROHandleS ROType;
1255  typedef GA_RWHandleS RWType;
1256 };
1257 
1260 
1263 
1266 
1269 
1272 
1275 
1278 
1281 
1284 
1287 
1290 
1293 
1296 
1299 
1302 
1305 
1308 
1311 
1314 
1317 
1320 
1323 
1326 
1329 
1332 
1335 
1336 #endif
GA_RWHandleT(GA_Attribute *attrib)
Definition: GA_Handle.h:281
void setBlockFromIndices(GA_Index startidx, GA_Size nelements, const T *source, int sourcestride=1, int component=0) const
void setPageConstant(GA_PageNum pagenum, const T *values) const
Definition: GA_Handle.h:752
SYS_FORCE_INLINE void bumpDataId()
Definition: GA_Attribute.h:303
GLenum GLint * range
Definition: glew.h:3500
T::value_type BASETYPE
Definition: GA_Handle.h:112
Definition of a geometry attribute.
Definition: GA_Attribute.h:196
void makeConstant(const T &cval) const
Definition: GA_Handle.h:385
GA_RWHandleT< UT_Int32Array > GA_RWHandleIA
Definition: GA_Handle.h:1319
GA_ATINumeric * operator->() const
Definition: GA_Handle.h:404
void SecondGuess
Definition: UT_Storage.h:90
GA_RWBatchHandleTHolder(GA_Attribute *attrib)
Definition: GA_Handle.h:956
GA_RWHandleT< UT_Vector2D > GA_RWHandleV2D
Definition: GA_Handle.h:1307
SYS_FORCE_INLINE void set(GA_Offset off, INDEXTYPE idx) const
Store the string indexed by the idx at the given offset.
Definition: GA_Handle.h:920
GLsizeiptr size
Definition: glew.h:1681
GLenum src
Definition: glew.h:2410
Generic Attribute Interface class to access an attribute as a array.
GA_PageArray< BASETYPE, 1 > * myExactMatch
Definition: GA_Handle.h:588
GA_ROHandleT< UT_StringArray > GA_ROHandleSA
Definition: GA_Handle.h:1330
UT_Storage
Definition: UT_Storage.h:28
GLuint const GLchar * name
Definition: glew.h:1814
SYS_FORCE_INLINE bool isPageConstant(GA_PageNum pagenum) const
Definition: GA_Handle.h:569
GA_RWHandleTHolder(GA_Attribute *attrib)
Definition: GA_Handle.h:878
GA_ROHandleT< int8 > GA_ROHandleC
Definition: GA_Handle.h:1270
void bind(const GA_Attribute *attrib, int minsize=1)
Definition: GA_Handle.h:1119
GA_RWHandleT< UT_FprealArray > GA_RWHandleRA
Definition: GA_Handle.h:1316
void bind(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1)
GA_RWHandleTHolder< UT_OptionsHolder, GA_DictIndexType, GA_ATIDict > GA_RWHandleDict
Definition: GA_Handle.h:1246
GA_ROHandleT< UT_Vector4D > GA_ROHandleV4D
Definition: GA_Handle.h:1312
SYS_FORCE_INLINE void bind(const GA_Attribute *attrib, int minsize=1)
Definition: GA_Handle.h:443
const DataType & getData() const
int64 GA_DataId
Definition: GA_Types.h:685
#define ENABLE_ARRAY(T)
Definition: GA_Handle.h:1094
SYS_FORCE_INLINE bool isInvalid() const
Definition: GA_Handle.h:1138
virtual bool makeConstant(GA_Attribute *attrib, int32 data, int index=0) const =0
void makeConstantV(const T *cval, int size) const
Definition: GA_Handle.h:744
SYS_FORCE_INLINE void set(GA_Offset off, int comp, const T &val) const
Definition: GA_Handle.h:335
GA_RWHandleT< UT_QuaternionD > GA_RWHandleQD
Definition: GA_Handle.h:1304
void clear()
Clear the handle.
Definition: GA_Handle.h:991
void bind(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1)
void clear()
Clear the handle.
Definition: GA_Handle.h:816
GA_PageArray< BASETYPE, theTupleSize > * myExactMatch
Definition: GA_Handle.h:255
GLuint const GLfloat * val
Definition: glew.h:2794
bool GAisValid(GA_Size v)
Definition: GA_Types.h:647
void bind(GA_Attribute *attrib, int minsize=1)
Definition: GA_Handle.h:1196
GA_RWHandleT< fpreal > GA_RWHandleR
Definition: GA_Handle.h:1259
GA_DataId getDataId() const
Definition: GA_Handle.h:807
int getTupleSize() const
const GA_Attribute * getAttribute() const
Access to attribute.
Definition: GA_Handle.h:803
GA_RWHandleT< UT_Int64Array > GA_RWHandleIDA
Definition: GA_Handle.h:1322
GA_ROHandleT< UT_Vector4F > GA_ROHandleV4
Definition: GA_Handle.h:1291
GA_ROHandleT< UT_Vector2F > GA_ROHandleV2
Definition: GA_Handle.h:1285
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
Definition: SYS_Types.h:136
GLint GLsizei const GLuint64 * values
Definition: glew.h:3612
SYS_FORCE_INLINE bool isValid() const
Definition: GA_Handle.h:999
GA_ROHandleTHolder< UT_OptionsHolder, GA_DictIndexType, GA_ATIDict > GA_ROHandleDict
Definition: GA_Handle.h:1245
GA_ROHandleT< UT_Array< UT_OptionsHolder > > GA_ROHandleDictA
Definition: GA_Handle.h:1333
SYS_FORCE_INLINE void add(IDX_T i, SRC_DATA_T v)
component == 0 in this version
Definition: UT_PageArray.h:620
Read-Write string handle.
Definition: GA_Handle.h:865
int64 exint
Definition: SYS_Types.h:125
SYS_FORCE_INLINE bool isValid() const
Definition: GA_Handle.h:820
SYS_FORCE_INLINE DEST_DATA_T get(IDX_T i, exint component=0) const
Definition: UT_PageArray.h:493
GA_ATINumeric * operator->() const
Definition: GA_Handle.h:762
GA_ROHandleT< UT_Vector3D > GA_ROHandleV3D
Definition: GA_Handle.h:1309
void operator=(GA_Attribute *attrib)
Definition: GA_Handle.h:1190
bool operator==(const GA_ROHandleT< T > &handle) const
Definition: GA_Handle.h:241
GA_ROHandleT(const GA_Attribute *attrib)
Definition: GA_Handle.h:429
SYS_FORCE_INLINE void bind(GA_Attribute *attrib, int minsize=1)
Definition: GA_Handle.h:295
GA_ATINumeric * getAttribute() const
Definition: GA_Handle.h:638
GLsizei GLsizei GLchar * source
Definition: glew.h:1832
GA_ROHandleT< UT_Matrix4D > GA_ROHandleM4D
Definition: GA_Handle.h:1300
GA_RWHandleT< int64 > GA_RWHandleID
Definition: GA_Handle.h:1295
void setPageConstant(GA_PageNum pagenum, const BASETYPE *values) const
Definition: GA_Handle.h:394
SYS_FORCE_INLINE void set(GA_Offset off, T val) const
Definition: GA_Handle.h:653
GA_RWHandleT< UT_Vector4D > GA_RWHandleV4D
Definition: GA_Handle.h:1313
SYS_FORCE_INLINE INDEXTYPE getIndex(GA_Offset off, int comp=0) const
Get the string index at the given offset.
Definition: GA_Handle.h:833
int getTupleSize() const
Tuple size of the attribute.
Definition: GA_Handle.h:982
ATI * operator->() const
Definition: GA_Handle.h:931
SYS_FORCE_INLINE UT_FixedVector< DEST_DATA_T, DEST_TSIZE > getVector(IDX_T i) const
Definition: UT_PageArray.h:503
#define GA_INVALID_DATAID
Definition: GA_Types.h:686
SYS_FORCE_INLINE void bind(const GA_Attribute *attrib, int minsize=1)
Definition: GA_Handle.h:133
SYS_FORCE_INLINE void set(const GA_Range &range, int comp, INDEXTYPE idx)
Definition: GA_Handle.h:1056
void operator=(GA_Attribute *attrib)
Definition: GA_Handle.h:619
GA_ROHandleT< int64 > GA_ROHandleID
Definition: GA_Handle.h:1294
SYS_FORCE_INLINE void set(IDX_T i, SRC_DATA_T v)
component == 0 in this version
Definition: UT_PageArray.h:614
const ATI * myAttrib
Definition: GA_Handle.h:860
SYS_FORCE_INLINE void bind(GA_ATINumeric *attrib, int minsize=1)
Definition: GA_Handle.h:300
SYS_FORCE_INLINE void set(GA_Offset off, int comp, const HOLDER &str)
Definition: GA_Handle.h:1029
uint64 value_type
Definition: GA_PrimCompat.h:29
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:233
GA_ATINumeric * getAttribute() const
Definition: GA_Handle.h:307
GA_ROHandleTHolder< HOLDER, INDEXTYPE, ATI > Base
Definition: GA_Handle.h:868
const GA_Attribute * getAttribute() const
Definition: GA_Handle.h:1129
GA_ROHandleT< UT_Vector3F > GA_ROHandleV3
Definition: GA_Handle.h:1288
SYS_FORCE_INLINE void addVector(IDX_T i, const UT_FixedVector< SRC_DATA_T, SRC_TSIZE, SRC_INSTANTIATED > &v)
Definition: UT_PageArray.h:726
SYS_FORCE_INLINE bool isValid() const
Definition: GA_Handle.h:1137
GA_DataId getDataId() const
Definition: GA_Handle.h:900
void operator=(const GA_Attribute *attrib)
Definition: GA_Handle.h:125
A range of elements in an index-map.
Definition: GA_Range.h:42
GA_ROHandleT< UT_Matrix3D > GA_ROHandleM3D
Definition: GA_Handle.h:1297
SYS_FORCE_INLINE void getV(GA_Offset off, T *data, int size) const
Definition: GA_Handle.h:523
GA_RWHandleT< UT_Vector3F > GA_RWHandleV3
Definition: GA_Handle.h:1289
const GA_ATINumeric * getAttribute() const
Definition: GA_Handle.h:163
GA_Size GA_Offset
Definition: GA_Types.h:639
GA_RWBatchHandleTHolder< UT_OptionsHolder, GA_DictIndexType, GA_ATIDict, GA_ATIDictDelayedWriter > GA_RWBatchHandleDict
Definition: GA_Handle.h:1247
GA_PageArray< BASETYPE > * myAlmostMatch
Definition: GA_Handle.h:589
void makeConstant(T cval, int comp=-1) const
Definition: GA_Handle.h:739
SYS_FORCE_INLINE bool isInvalid() const
Definition: GA_Handle.h:497
void bind(const GA_ATINumeric *attrib, int minsize=1)
Definition: GA_Handle.h:447
SYS_FORCE_INLINE void add(GA_Offset off, const T &val) const
Definition: GA_Handle.h:349
GA_ROHandleT< UT_Matrix3F > GA_ROHandleM3
Definition: GA_Handle.h:1276
GA_ROHandleT< int32 > GA_ROHandleI
Definition: GA_Handle.h:1273
GA_RWHandleT< UT_Fpreal64Array > GA_RWHandleDA
Definition: GA_Handle.h:1328
SYS_FORCE_INLINE void add(GA_Offset off, int comp, T val) const
Definition: GA_Handle.h:715
SYS_FORCE_INLINE void set(GA_Offset off, int comp, const HOLDER &str) const
Definition: GA_Handle.h:912
SYS_FORCE_INLINE void set(GA_Offset off, int comp, T val) const
Definition: GA_Handle.h:679
GA_RWHandleTHolder< UT_StringHolder, GA_StringIndexType, GA_ATIString > GA_RWHandleS
Definition: GA_Handle.h:1242
SYS_FORCE_INLINE void add(GA_Offset off, T val) const
Definition: GA_Handle.h:666
const GA_AIFTuple * getAIFTuple() const override
Return the attribute's tuple interface or NULL.
ATI * rwAttrib() const
Definition: GA_Handle.h:936
T::value_type BASETYPE
Definition: GA_Handle.h:270
SYS_FORCE_INLINE void setV(GA_Offset off, const T *data, int size) const
Definition: GA_Handle.h:692
void bind(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1)
void clear()
Definition: GA_Handle.h:177
void getIndexBlockFromIndices(GA_Index startidx, GA_Size nelements, INDEXTYPE *dest, int deststride=1, int component=0) const
GA_RWHandleT< UT_Fpreal32Array > GA_RWHandleFA
Definition: GA_Handle.h:1325
bool isOffsetTransient(GA_Offset offset) const
SYS_FORCE_INLINE void set(GA_Offset off, int comp, INDEXTYPE idx) const
Definition: GA_Handle.h:924
SYS_FORCE_INLINE void set(const GA_Range &range, INDEXTYPE idx)
Definition: GA_Handle.h:1045
void getBlockFromIndices(GA_Index startidx, GA_Size nelements, T *dest, int deststride=1, int component=0) const
void operator=(GA_Attribute *attrib)
Definition: GA_Handle.h:887
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
GA_RWHandleT< UT_Vector4F > GA_RWHandleV4
Definition: GA_Handle.h:1292
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:134
bool operator!=(const GA_ROHandleT< T > &handle) const
Definition: GA_Handle.h:1153
SYS_FORCE_INLINE void setPageConstant(UT_PageNum pagenum, const NotVoidType &val)
static SYS_FORCE_INLINE GA_ATINumeric * cast(GA_Attribute *attrib)
Definition: GA_ATINumeric.h:65
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
void(* GAprobeAttribSetter)(GA_Attribute *atr, GA_Offset, const T &)
Definition: GA_Handle.h:268
void getIndexBlock(GA_Offset startoff, GA_Size nelements, INDEXTYPE *dest, int deststride=1, int component=0) const
GA_ROHandleT< fpreal32 > GA_ROHandleF
Definition: GA_Handle.h:1264
SYS_FORCE_INLINE void set(GA_Offset off, const T &value) const
Definition: GA_Handle.h:1216
GA_ATINumeric * myAttrib
Definition: GA_Handle.h:254
const GA_ATINumeric * operator->() const
Definition: GA_Handle.h:581
void getBlock(GA_Offset startoff, GA_Size nelements, T *dest, int deststride=1, int component=0) const
A specialization of GA_AIFStringArray to access "shared strings".
void
Definition: png.h:1083
GA_RWHandleT< fpreal64 > GA_RWHandleD
Definition: GA_Handle.h:1268
void(* GAprobeAttribGetter)(T &result, const GA_Attribute *atr, GA_Offset)
Definition: GA_Handle.h:111
void bind(GA_Attribute *attrib, int minsize=1)
Bind the handle to the given attribute.
Definition: GA_Handle.h:969
GA_ROHandleT< UT_Fpreal64Array > GA_ROHandleDA
Definition: GA_Handle.h:1327
GA_RWHandleT< UT_Matrix4F > GA_RWHandleM4
Definition: GA_Handle.h:1280
bool operator!=(const GA_ROHandleT< T > &handle) const
Definition: GA_Handle.h:577
GA_RWHandleT< UT_Matrix3D > GA_RWHandleM3D
Definition: GA_Handle.h:1298
GA_RWHandleTHolder(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1)
Definition: GA_Handle.h:882
GA_ROHandleT< fpreal64 > GA_ROHandleD
Definition: GA_Handle.h:1267
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
GA_RWHandleT< T > RWType
Definition: GA_Handle.h:1238
const GA_Attribute * operator->() const
Definition: GA_Handle.h:1158
SYS_FORCE_INLINE T operator()(GA_Offset off, int comp=0) const
Definition: GA_Handle.h:558
SYS_FORCE_INLINE void setVector(IDX_T i, const UT_FixedVector< SRC_DATA_T, SRC_TSIZE, SRC_INSTANTIATED > &v)
Definition: UT_PageArray.h:721
GA_HandleDetail::ArrayAIF< T >::type AIFType
Definition: GA_Handle.h:1101
SYS_FORCE_INLINE GA_DataId getDataId() const
Definition: GA_Attribute.h:296
SYS_FORCE_INLINE T operator[](GA_Offset off) const
Definition: GA_Handle.h:562
GA_DataId getDataId() const
Definition: GA_Handle.h:315
SYS_FORCE_INLINE bool isInvalid() const
Definition: GA_Handle.h:188
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:633
void bumpDataId() const
Definition: GA_Handle.h:309
GA_RWHandleT< fpreal16 > GA_RWHandleH
Definition: GA_Handle.h:1262
SYS_FORCE_INLINE void set(const GA_Range &range, const HOLDER &str)
Definition: GA_Handle.h:1025
Read-only handle for string attribute data.
Definition: GA_Handle.h:773
GLuint start
Definition: glew.h:1253
SYS_FORCE_INLINE bool isPageConstant(GA_PageNum pagenum) const
SYS_FORCE_INLINE void add(GA_Offset off, int comp, const T &val) const
Definition: GA_Handle.h:362
GA_ROHandleT< UT_Int32Array > GA_ROHandleIA
Definition: GA_Handle.h:1318
GA_ROHandleT< fpreal16 > GA_ROHandleH
Definition: GA_Handle.h:1261
GA_Attribute * getAttribute() const
Access to attribute.
Definition: GA_Handle.h:980
const ATI * operator->() const
Definition: GA_Handle.h:840
SYS_FORCE_INLINE bool isValid() const
Definition: GA_Handle.h:184
void bumpDataId() const
Definition: GA_Handle.h:894
SYS_FORCE_INLINE void set(GA_Offset off, int comp, INDEXTYPE idx)
Definition: GA_Handle.h:1049
bool isRational() const
Definition: GA_Handle.h:174
void setBlock(GA_Offset startoff, GA_Size nelements, const T *source, int sourcestride=1, int component=0) const
GA_AttributeOwner
Definition: GA_Types.h:33
GA_ROHandleTHolder(const GA_Attribute *attrib)
Definition: GA_Handle.h:780
bool operator==(const GA_ROHandleT< T > &handle) const
Definition: GA_Handle.h:573
GA_ROHandleT(const GA_Attribute *attrib)
Definition: GA_Handle.h:1107
GA_RWHandleT< UT_Vector2F > GA_RWHandleV2
Definition: GA_Handle.h:1286
#define SCALAR(T)
Simplify checking for scalar types.
Definition: GA_Handle.h:412
SYS_FORCE_INLINE bool isPageConstant(GA_PageNum pagenum) const
Definition: GA_Handle.h:237
GA_ROHandleT< fpreal > GA_ROHandleR
Definition: GA_Handle.h:1258
void bind(const GA_Attribute *attrib, int minsize=1)
Bind the handle to the given attribute.
Definition: GA_Handle.h:793
GA_RWHandleT< UT_Matrix4D > GA_RWHandleM4D
Definition: GA_Handle.h:1301
GA_ROHandleT< UT_FprealArray > GA_ROHandleRA
Definition: GA_Handle.h:1315
bool isOffsetActive(GA_Offset offset) const
Returns true if the specified offset is referenced by an ordered element.
Definition: GA_IndexMap.h:483
SYS_FORCE_INLINE void set(const GA_Range &range, int comp, const HOLDER &str)
Definition: GA_Handle.h:1036
GA_ROHandleT< T > Base
Definition: GA_Handle.h:269
void operator=(const GA_Attribute *attrib)
Definition: GA_Handle.h:435
GA_ROHandleT< UT_Matrix4F > GA_ROHandleM4
Definition: GA_Handle.h:1279
GA_RWHandleT< UT_Vector3D > GA_RWHandleV3D
Definition: GA_Handle.h:1310
GA_ROHandleT< UT_QuaternionF > GA_ROHandleQ
Definition: GA_Handle.h:1282
GA_RWHandleT< UT_Array< UT_OptionsHolder > > GA_RWHandleDictA
Definition: GA_Handle.h:1334
SYS_FORCE_INLINE GA_TypeInfo getTypeInfo() const
Definition: GA_Attribute.h:249
SYS_FORCE_INLINE void set(GA_Offset off, const T &val) const
Definition: GA_Handle.h:322
void operator=(GA_Attribute *attrib)
Definition: GA_Handle.h:287
SYS_FORCE_INLINE void set(GA_Offset off, const HOLDER &str) const
Store the str at the given offset.
Definition: GA_Handle.h:908
const GA_IndexMap & getIndexMap() const
Definition: GA_Attribute.h:205
void operator=(const GA_Attribute *attrib)
Definition: GA_Handle.h:786
GA_Size GA_PageNum
Definition: GA_Types.h:642
const T * getAIF() const
Generic method for getting an AIF by type.
Definition: GA_Attribute.h:413
GA_ROHandleT< UT_Int64Array > GA_ROHandleIDA
Definition: GA_Handle.h:1321
SYS_FORCE_INLINE bool isInvalid() const
Definition: GA_Handle.h:821
void bind(GA_ATINumeric *attrib, int minsize=1)
Definition: GA_Handle.h:631
SYS_FORCE_INLINE bool isValid() const
Definition: GA_Handle.h:493
A specialization of GA_AIFDictArray to access "shared strings".
void operator=(GA_Attribute *attrib)
Definition: GA_Handle.h:962
GA_RWHandleT< fpreal32 > GA_RWHandleF
Definition: GA_Handle.h:1265
GA_RWHandleT< int8 > GA_RWHandleC
Definition: GA_Handle.h:1271
GA_ROHandleT(const GA_Attribute *attrib)
Definition: GA_Handle.h:119
GA_ROHandleT< T > ROType
Definition: GA_Handle.h:1237
GA_RWHandleT(GA_Attribute *attrib)
Definition: GA_Handle.h:613
GA_ROHandleT< UT_QuaternionD > GA_ROHandleQD
Definition: GA_Handle.h:1303
DELAYEDWRITER myWriter
Definition: GA_Handle.h:1067
GA_DataId getDataId() const
Definition: GA_Handle.h:983
GLuint64EXT * result
Definition: glew.h:14007
Container class for all geometry.
Definition: GA_Detail.h:95
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:135
GA_RWBatchHandleTHolder< UT_StringHolder, GA_StringIndexType, GA_ATIString, GA_ATIStringDelayedWriter > GA_RWBatchHandleS
Definition: GA_Handle.h:1243
SYS_FORCE_INLINE bool hasChanges() const
Definition: GA_Handle.h:1061
SYS_FORCE_INLINE const GA_PageArray< DEST_DATA_T, TSIZE, TABLEHARDENED, PAGESHARDENED > & castType() const
Definition: GA_PageArray.h:732
GA_DataId getDataId() const
Definition: GA_Handle.h:165
void bind(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1)
SYS_FORCE_INLINE void set(GA_Offset off, const HOLDER &str)
Store the str at the given offset.
Definition: GA_Handle.h:1021
bool operator==(const GA_ROHandleT< T > &handle) const
Definition: GA_Handle.h:1148
GA_ROHandleTHolder< UT_StringHolder, GA_StringIndexType, GA_ATIString > GA_ROHandleS
Definition: GA_Handle.h:1241
int getTupleSize() const
Tuple size of the attribute.
Definition: GA_Handle.h:805
#define const
Definition: zconf.h:214
GA_RWHandleT< UT_QuaternionF > GA_RWHandleQ
Definition: GA_Handle.h:1283
GA_RWHandleT< int32 > GA_RWHandleI
Definition: GA_Handle.h:1274
SYS_FORCE_INLINE bool isInvalid() const
Definition: GA_Handle.h:1000
GA_ROHandleT< UT_Fpreal32Array > GA_ROHandleFA
Definition: GA_Handle.h:1324
UT_StringHolder & operator()(exint i)
Definition: UT_Array.h:559
GA_RWHandleT< UT_Matrix3F > GA_RWHandleM3
Definition: GA_Handle.h:1277
const GA_ATINumeric * operator->() const
Definition: GA_Handle.h:249
GA_PageArray< typename UT_StorageNum< BASETYPE >::SecondGuess, theTupleSize > * myAlmostMatch
Definition: GA_Handle.h:256
SYS_FORCE_INLINE T operator()(GA_Offset off) const
Definition: GA_Handle.h:226
GLsizei const GLfloat * value
Definition: glew.h:1849
SYS_FORCE_INLINE T operator[](GA_Offset off) const
Definition: GA_Handle.h:230
SYS_FORCE_INLINE void bind(GA_Attribute *attrib, int minsize=1)
Definition: GA_Handle.h:627
bool operator!=(const GA_ROHandleT< T > &handle) const
Definition: GA_Handle.h:245
GA_Attribute * getAttribute() const
Definition: GA_Handle.h:1201
SYS_FORCE_INLINE INDEXTYPE getIndex(GA_Offset off, int comp=0) const
Get the string index at the given offset.
Definition: GA_Handle.h:1012
const GA_ATINumeric * getAttribute() const
Definition: GA_Handle.h:472
GA_RWHandleT< UT_StringArray > GA_RWHandleSA
Definition: GA_Handle.h:1331
void operator=(const GA_Attribute *attrib)
Definition: GA_Handle.h:1113
GA_Attribute * getAttribute() const
Definition: GA_Handle.h:892
GA_ROHandleT< UT_Vector2D > GA_ROHandleV2D
Definition: GA_Handle.h:1306
static const exint theTupleSize
Definition: GA_Handle.h:113
void bind(const GA_ATINumeric *attrib, int minsize=1)
Definition: GA_Handle.h:138
GLintptr offset
Definition: glew.h:1682
SYS_FORCE_INLINE void set(GA_Offset off, INDEXTYPE idx)
Store the string indexed by the idx at the given offset.
Definition: GA_Handle.h:1041