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