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:
109  typedef void (*GAprobeAttribGetter)(T &result, const GA_Attribute *atr, GA_Offset);
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  /// Copies attribute values from the source array into a contiguous
361  /// block of offsets.
362  /// NOTE: The block of offsets is assumed to have no holes, else
363  /// data could be written to offsets that don't have
364  /// corresponding elements.
365  void setBlock(GA_Offset startoff, GA_Size nelements, const T *source, int sourcestride = 1, int component = 0) const;
366 
367  void setBlockFromIndices(GA_Index startidx, GA_Size nelements, const T *source, int sourcestride = 1, int component = 0) const;
368 
369  void makeConstant(const T &cval) const
370  {
372  myAttrib->getAIFTuple()->makeConstant(myAttrib, &cval.data()[0], sizeof(T)/sizeof(BASETYPE), 0);
373  }
374 
375  /// Sets all components of all elements of the specified page to
376  /// the given values.
377  /// NOTE: The length of values must be equal to the tuple size.
378  void setPageConstant(GA_PageNum pagenum, const BASETYPE *values) const
379  {
380  if (myExactMatch)
381  myExactMatch->setPageConstant(pagenum, values);
382  else if (myAlmostMatch)
383  myAlmostMatch->setPageConstant(pagenum, values);
384  else
385  myAttrib->getData().setPageConstant(pagenum, values);
386  }
387 
389  {
390  return myAttrib;
391  }
392 
393 };
394 
395 /// Simplify checking for scalar types
396 #define SCALAR(T) SYS_EnableIf< SYS_IsArithmetic<T>::value >::type
397 
398 /// Read-only handle for scalar attribute data.
399 ///
400 /// @tparam T Return type for get methods
401 ///
402 template <typename T>
403 class GA_ROHandleT<T, typename SCALAR(T) >
404 {
405 public:
406  typedef T (*GAprobeAttribGetter)(const GA_Attribute *atr, GA_Offset, int);
407  typedef T BASETYPE;
408 
410  {
411  clear();
412  }
413  GA_ROHandleT(const GA_Attribute *attrib)
414  {
415  bind(attrib);
416  }
417  GA_ROHandleT(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
418 
419  void operator=(const GA_Attribute *attrib)
420  {
421  bind(attrib);
422  }
423 
424  void bind(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
425 
427  void bind(const GA_Attribute *attrib, int minsize=1)
428  {
429  bind(GA_ATINumeric::cast(attrib), minsize);
430  }
431  void bind(const GA_ATINumeric *attrib, int minsize=1)
432  {
433  myExactMatch = nullptr;
434  myAlmostMatch = nullptr;
435  myAttrib = SYSconst_cast(attrib);
436  if (!myAttrib)
437  return;
438 
439  int actual_tuple_size = myAttrib->getTupleSize();
440  if (actual_tuple_size < minsize)
441  {
442  myAttrib = nullptr;
443  return;
444  }
445 
446  UT_Storage actual_storage = attrib->getData().Base::getStorage();
447  if (actual_storage == UT_StorageNum<BASETYPE>::theStorage)
448  {
449  if (actual_tuple_size == 1)
450  myExactMatch = &myAttrib->getData().castType<BASETYPE>().template castTupleSize<1>();
451  else
453  }
454  }
455 
456  const GA_ATINumeric *getAttribute() const { return myAttrib; }
457  int getTupleSize() const { return myAttrib->getTupleSize(); }
458 
460  {
461  if (myAttrib)
462  return myAttrib->getDataId();
463  return GA_INVALID_DATAID;
464  }
465 
466  // Check whether the attribute is GA_TYPE_HPOINT
467  bool isRational() const
468  { return myAttrib->getTypeInfo() == GA_TYPE_HPOINT; }
469 
470  void clear()
471  {
472  myAttrib = nullptr;
473  myExactMatch = nullptr;
474  myAlmostMatch = nullptr;
475  }
476 
478  {
479  return myAttrib;
480  }
482  {
483  return !myAttrib;
484  }
485 
486  SYS_FORCE_INLINE T get(GA_Offset off, int comp = 0) const
487  {
489  UT_ASSERT_P(GAisValid(off));
491  UT_ASSERT_P(comp >= 0 && comp < myAttrib->getTupleSize());
492  if (myExactMatch)
493  {
494  UT_ASSERT_P(comp == 0);
495  return myExactMatch->template get<T>(off);
496  }
497  return getNotInline(off, comp);
498  }
499 private:
500  T getNotInline(GA_Offset off, int comp) const
501  {
502  if (myAlmostMatch)
503  return myAlmostMatch->template get<T>(off, comp);
504  return myAttrib->getData().get<T>(off, comp);
505  }
506 public:
507  SYS_FORCE_INLINE void getV(GA_Offset off, T *data, int size) const
508  {
510  UT_ASSERT_P(size >= 0 && size <= myAttrib->getTupleSize());
511  if (myExactMatch)
512  {
513  UT_ASSERT_P(size<=1);
514  if (size==1)
515  data[0] = myExactMatch->template get<T>(off);
516  }
517  else if (myAlmostMatch)
518  {
519  for (int comp = 0; comp < size; ++comp)
520  data[comp] = myAlmostMatch->template get<T>(off, comp);
521  }
522  else
523  {
524  auto &src = myAttrib->getData();
525  for (int comp = 0; comp < size; ++comp)
526  data[comp] = src.get<T>(off, comp);
527  }
528  }
529 
530  /// Copies attribute values from a contiguous block of offsets
531  /// into the dest array.
532  /// NOTE: The block of offsets is assumed to have no holes, else
533  /// data could be read from offsets that don't have
534  /// corresponding elements.
535  void getBlock(GA_Offset startoff, GA_Size nelements, T *dest, int deststride = 1, int component = 0) const;
536 
537  /// Copies attribute values from a contiguous block of indices
538  /// into the dest array.
539  /// This allows there to be holes in the geometry.
540  void getBlockFromIndices(GA_Index startidx, GA_Size nelements, T *dest, int deststride = 1, int component = 0) const;
541 
542  SYS_FORCE_INLINE T operator()(GA_Offset off, int comp = 0) const
543  {
544  return get(off, comp);
545  }
547  {
548  return get(off);
549  }
550  /// Returns true iff the specified page is constant-compressed,
551  /// where a single value is stored to represent GA_PAGE_SIZE
552  /// values in the page, (or possibly fewer if only one page).
554  {
555  return myAttrib->isPageConstant(pagenum);
556  }
557  bool operator==(const GA_ROHandleT<T> &handle) const
558  {
559  return myAttrib == handle.myAttrib;
560  }
561  bool operator!=(const GA_ROHandleT<T> &handle) const
562  {
563  return myAttrib != handle.myAttrib;
564  }
565  const GA_ATINumeric *operator->() const
566  {
567  return myAttrib;
568  }
569 
570 protected:
574 };
575 
576 /// Read-write handle for scalar attribute data.
577 ///
578 /// @tparam T Return type for get methods
579 ///
580 template <typename T>
581 class GA_RWHandleT<T, typename SCALAR(T) > : public GA_ROHandleT<T, typename SCALAR(T) >
582 {
583 public:
586  typedef T BASETYPE;
587 private:
588  using Base::myAttrib;
589  using Base::myExactMatch;
590  using Base::myAlmostMatch;
591 public:
592 
594  {
595  clear();
596  }
598  {
599  bind(attrib);
600  }
601  GA_RWHandleT(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
602 
603  void operator=(GA_Attribute *attrib)
604  {
605  bind(attrib);
606  }
607 
608  void bind(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
609 
611  void bind(GA_Attribute *attrib, int minsize=1)
612  {
613  bind(GA_ATINumeric::cast(attrib), minsize);
614  }
615  void bind(GA_ATINumeric *attrib, int minsize=1)
616  {
617  Base::bind(attrib, minsize);
618  }
619 
620  using Base::clear;
621 
622  GA_ATINumeric *getAttribute() const { return myAttrib; }
623 
624  void bumpDataId() const
625  {
626  if (myAttrib)
627  myAttrib->bumpDataId();
628  }
629 
631  {
632  if (myAttrib)
633  return myAttrib->getDataId();
634  return GA_INVALID_DATAID;
635  }
636 
637  SYS_FORCE_INLINE void set(GA_Offset off, T val) const
638  {
640  UT_ASSERT_P(GAisValid(off));
642  if (myExactMatch)
643  myExactMatch->set(off, val);
644  else if (myAlmostMatch)
645  myAlmostMatch->set(off, val);
646  else
647  myAttrib->getData().set(off, val);
648  }
649 
650  SYS_FORCE_INLINE void add(GA_Offset off, T val) const
651  {
653  UT_ASSERT_P(GAisValid(off));
655  if (myExactMatch)
656  myExactMatch->add(off, val);
657  else if (myAlmostMatch)
658  myAlmostMatch->add(off, val);
659  else
660  myAttrib->getData().add(off, val);
661  }
662 
663  SYS_FORCE_INLINE void set(GA_Offset off, int comp, T val) const
664  {
665  UT_ASSERT_P(myAttrib != nullptr);
666  UT_ASSERT_P(comp >= 0 && comp < myAttrib->getTupleSize());
667  UT_ASSERT_P(GAisValid(off));
669  if (myExactMatch)
670  myExactMatch->set(off, comp, val);
671  else if (myAlmostMatch)
672  myAlmostMatch->set(off, comp, val);
673  else
674  myAttrib->getData().set(off, comp, val);
675  }
676  SYS_FORCE_INLINE void setV(GA_Offset off, const T *data, int size) const
677  {
679  UT_ASSERT_P(size >= 0 && size <= myAttrib->getTupleSize());
680  if (myExactMatch)
681  {
682  UT_ASSERT_P(size<=1);
683  if (size==1)
684  myExactMatch->set(off, data[0]);
685  }
686  else if (myAlmostMatch)
687  {
688  for (int comp = 0; comp < size; ++comp)
689  myAlmostMatch->set(off, comp, data[comp]);
690  }
691  else
692  {
693  auto &src = myAttrib->getData();
694  for (int comp = 0; comp < size; ++comp)
695  src.set(off, comp, data[comp]);
696  }
697  }
698 
699  SYS_FORCE_INLINE void add(GA_Offset off, int comp, T val) const
700  {
701  UT_ASSERT_P(myAttrib != nullptr);
702  UT_ASSERT_P(comp >= 0 && comp < myAttrib->getTupleSize());
703  UT_ASSERT_P(GAisValid(off));
705  if (myExactMatch)
706  myExactMatch->add(off, comp, val);
707  else if (myAlmostMatch)
708  myAlmostMatch->add(off, comp, val);
709  else
710  myAttrib->getData().add(off, comp, val);
711  }
712 
713  /// Copies attribute values from the source array into a contiguous
714  /// block of offsets.
715  /// NOTE: The block of offsets is assumed to have no holes, else
716  /// data could be written to offsets that don't have
717  /// corresponding elements.
718  void setBlock(GA_Offset startoff, GA_Size nelements, const T *source, int sourcestride=1, int component=0) const;
719 
720  void setBlockFromIndices(GA_Index startidx, GA_Size nelements, const T *source, int sourcestride = 1, int component = 0) const;
721 
722  // -1 comp means to set all components to cval.
723  void makeConstant(T cval, int comp = -1) const
724  {
726  myAttrib->getAIFTuple()->makeConstant(myAttrib, cval, comp);
727  }
728  void makeConstantV(const T *cval, int size) const
729  {
731  myAttrib->getAIFTuple()->makeConstant(myAttrib, cval, size, 0);
732  }
733  /// Sets all components of all elements of the specified page to
734  /// the given values.
735  /// NOTE: The length of values must be equal to the tuple size.
736  void setPageConstant(GA_PageNum pagenum, const T *values) const
737  {
738  if (myExactMatch)
739  myExactMatch->setPageConstant(pagenum, values);
740  else if (myAlmostMatch)
741  myAlmostMatch->setPageConstant(pagenum, values);
742  else
743  myAttrib->getData().setPageConstant(pagenum, values);
744  }
745 
747  {
748  return myAttrib;
749  }
750 
751 };
752 
753 #undef SCALAR
754 
755 /// Read-only handle for string attribute data.
757 {
758 public:
760  {
761  clear();
762  }
763  GA_ROHandleS(const GA_Attribute *attrib)
764  {
765  bind(attrib);
766  }
767  GA_ROHandleS(const GA_Detail *gdp, GA_AttributeOwner owner,
768  const UT_StringRef &name, int minsize=1);
769  void operator=(const GA_Attribute *attrib)
770  {
771  bind(attrib);
772  }
773  void bind(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
774 
775  /// Bind the handle to the given attribute
776  void bind(const GA_Attribute *attrib, int minsize=1)
777  {
778  myAttrib = GA_ATIString::cast(attrib);
779  if (myAttrib && myAttrib->getTupleSize() < minsize)
780  {
781  myAttrib = 0;
782  }
783  }
784 
785  /// Access to attribute
786  const GA_Attribute *getAttribute() const { return myAttrib; }
787  /// Tuple size of the attribute
788  int getTupleSize() const { return myAttrib->getTupleSize(); }
789 
791  {
792  if (myAttrib)
793  return myAttrib->getDataId();
794  return GA_INVALID_DATAID;
795  }
796 
797 
798  /// Clear the handle
799  void clear() { myAttrib = 0; }
800 
801  /// @{
802  /// Validity checks
803  SYS_FORCE_INLINE bool isValid() const { return myAttrib; }
804  SYS_FORCE_INLINE bool isInvalid() const { return !myAttrib; }
805  /// @}
806 
807  /// Get the string at the given offset
808  SYS_FORCE_INLINE const UT_StringHolder &get(GA_Offset off, int comp = 0) const
809  {
810  UT_ASSERT_P(myAttrib);
811  UT_ASSERT_P(GAisValid(off));
812  UT_ASSERT_P(myAttrib->getIndexMap().isOffsetActive(off) || myAttrib->getIndexMap().isOffsetTransient(off));
813  return myAttrib->getString(off, comp);
814  }
815  /// Get the string index at the given offset
817  {
818  UT_ASSERT_P(myAttrib);
819  UT_ASSERT_P(GAisValid(off));
820  UT_ASSERT_P(myAttrib->getIndexMap().isOffsetActive(off) || myAttrib->getIndexMap().isOffsetTransient(off));
821  return myAttrib->getStringIndex(off, comp);
822  }
823  const GA_ATIString *operator->() const
824  {
825  return myAttrib;
826  }
827 
828 protected:
830 };
831 
832 /// Read-Write string handle
834 {
835 public:
837  : GA_ROHandleS()
838  {
839  }
841  : GA_ROHandleS(attrib)
842  {
843  }
845  const UT_StringRef &name, int minsize=1)
846  : GA_ROHandleS(gdp, owner, name, minsize)
847  {
848  }
849  void operator=(GA_Attribute *attrib)
850  {
851  bind(attrib);
852  }
853 
854  GA_Attribute *getAttribute() const { return rwAttrib(); }
855 
856  void bumpDataId() const
857  {
858  if (rwAttrib())
859  rwAttrib()->bumpDataId();
860  }
861 
863  {
864  if (rwAttrib())
865  return rwAttrib()->getDataId();
866  return GA_INVALID_DATAID;
867  }
868 
869  /// Store the @c str at the given offset
870  SYS_FORCE_INLINE void set(GA_Offset off, const UT_StringHolder &str) const
871  {
872  set(off, 0, str);
873  }
874  SYS_FORCE_INLINE void set(GA_Offset off, int comp, const UT_StringHolder &str) const
875  {
876  UT_ASSERT_P(rwAttrib() != nullptr);
877  UT_ASSERT_P(GAisValid(off));
878  UT_ASSERT_P(rwAttrib()->getIndexMap().isOffsetActive(off) || rwAttrib()->getIndexMap().isOffsetTransient(off));
879  rwAttrib()->setString(off, str, comp);
880  }
881  /// Store the string indexed by the @c idx at the given offset
883  {
884  set(off, 0, idx);
885  }
886  SYS_FORCE_INLINE void set(GA_Offset off, int comp, GA_StringIndexType idx) const
887  {
888  UT_ASSERT_P(rwAttrib() != nullptr);
889  UT_ASSERT_P(GAisValid(off));
890  UT_ASSERT_P(rwAttrib()->getIndexMap().isOffsetActive(off) || rwAttrib()->getIndexMap().isOffsetTransient(off));
891  rwAttrib()->setStringIndex(off, idx, comp);
892  }
894  {
895  return rwAttrib();
896  }
897 protected:
899  { return SYSconst_cast(myAttrib); }
900 };
901 
902 /// Read-Write string handle
903 /// Batches all reference counts until a flush() or its destructor.
904 /// Because it tracks this locally, you MUST create a separate one
905 /// per thread! (Even if this were made thread safe, that would
906 /// defeat the purpose of this, which is to use thread-local reference
907 /// counts to avoid write contention)
908 /// NOTE: This bumps the data ID of any attribute it's bound to
909 /// upon destruction.
911 {
912 public:
914  {
915  clear();
916  }
918  {
919  bind(attrib);
920  }
922  const UT_StringRef &name, int minsize=1);
923  void operator=(GA_Attribute *attrib)
924  {
925  bind(attrib);
926  }
927  void bind(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
928 
929  /// Bind the handle to the given attribute
930  void bind(GA_Attribute *attrib, int minsize=1)
931  {
932  myAttrib = GA_ATIString::cast(attrib);
933  if (myAttrib && myAttrib->getTupleSize() < minsize)
934  {
935  myAttrib = 0;
936  }
937  myWriter.bind(myAttrib);
938  }
939 
940  /// Access to attribute
941  GA_Attribute *getAttribute() const { return myAttrib; }
942  /// Tuple size of the attribute
943  int getTupleSize() const { return myAttrib->getTupleSize(); }
945  {
946  if (myAttrib)
947  return myAttrib->getDataId();
948  return GA_INVALID_DATAID;
949  }
950 
951 
952  /// Clear the handle
953  void clear()
954  {
955  myAttrib = 0;
956  myWriter.bind(myAttrib); // Also flushes.
957  }
958 
959  /// @{
960  /// Validity checks
961  SYS_FORCE_INLINE bool isValid() const { return myAttrib; }
962  SYS_FORCE_INLINE bool isInvalid() const { return !myAttrib; }
963  /// @}
964 
965  /// Get the string at the given offset
966  SYS_FORCE_INLINE const char *get(GA_Offset off, int comp = 0) const
967  {
968  UT_ASSERT_P(myAttrib);
969  UT_ASSERT_P(GAisValid(off));
970  UT_ASSERT_P(myAttrib->getIndexMap().isOffsetActive(off) || myAttrib->getIndexMap().isOffsetTransient(off));
971  return myAttrib->getString(off, comp);
972  }
973  /// Get the string index at the given offset
975  {
976  UT_ASSERT_P(myAttrib);
977  UT_ASSERT_P(GAisValid(off));
978  UT_ASSERT_P(myAttrib->getIndexMap().isOffsetActive(off) || myAttrib->getIndexMap().isOffsetTransient(off));
979  return myAttrib->getStringIndex(off, comp);
980  }
981 
982  /// Store the @c str at the given offset
984  {
985  set(off, 0, str);
986  }
988  {
989  set(range, 0, str);
990  }
991  SYS_FORCE_INLINE void set(GA_Offset off, int comp, const UT_StringHolder &str)
992  {
993  UT_ASSERT_P(myAttrib);
994  UT_ASSERT_P(GAisValid(off));
995  UT_ASSERT_P(myAttrib->getIndexMap().isOffsetActive(off) || myAttrib->getIndexMap().isOffsetTransient(off));
996  myWriter.setString(off, str, comp);
997  }
998  SYS_FORCE_INLINE void set(const GA_Range &range, int comp, const UT_StringHolder &str)
999  {
1000  myWriter.setString(range, str, comp);
1001  }
1002  /// Store the string indexed by the @c idx at the given offset
1004  {
1005  set(off, 0, idx);
1006  }
1008  {
1009  set(range, 0, idx);
1010  }
1012  {
1013  UT_ASSERT_P(myAttrib);
1014  UT_ASSERT_P(GAisValid(off));
1015  UT_ASSERT_P(myAttrib->getIndexMap().isOffsetActive(off) || myAttrib->getIndexMap().isOffsetTransient(off));
1016  myWriter.setStringIndex(off, idx, comp);
1017  }
1019  {
1020  myWriter.setStringIndex(range, idx, comp);
1021  }
1022 
1024  {
1025  return myWriter.hasChanges();
1026  }
1027 protected:
1030 };
1031 
1032 namespace GA_HandleDetail
1033 {
1034 // Helper for determining AIF type given the array type T
1035 template <typename T> struct ArrayAIF;
1036 template <> struct ArrayAIF<UT_Int32Array> { typedef GA_AIFNumericArray type; };
1037 template <> struct ArrayAIF<UT_Int64Array> { typedef GA_AIFNumericArray type; };
1038 template <> struct ArrayAIF<UT_Fpreal32Array> { typedef GA_AIFNumericArray type; };
1039 template <> struct ArrayAIF<UT_Fpreal64Array> { typedef GA_AIFNumericArray type; };
1040 template <> struct ArrayAIF<UT_StringArray> { typedef GA_AIFSharedStringArray type; };
1041 // Helper for determining if we have an acceptable array type
1042 template <typename T> struct IsArray { static const bool value = false; };
1043 template <> struct IsArray<UT_Int32Array> { static const bool value = true; };
1044 template <> struct IsArray<UT_Int64Array> { static const bool value = true; };
1045 template <> struct IsArray<UT_Fpreal32Array> { static const bool value = true; };
1046 template <> struct IsArray<UT_Fpreal64Array> { static const bool value = true; };
1047 template <> struct IsArray<UT_StringArray> { static const bool value = true; };
1048 }
1049 
1050 #define ENABLE_ARRAY(T) SYS_EnableIf< GA_HandleDetail::IsArray<T>::value >::type
1051 
1052 /// Read-only handle for array attribute data
1053 template <typename T>
1054 class GA_ROHandleT<T, typename ENABLE_ARRAY(T)>
1055 {
1056 public:
1058 
1060  {
1061  clear();
1062  }
1064  {
1065  bind(attrib);
1066  }
1067  GA_ROHandleT(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
1068 
1069  void operator=(const GA_Attribute *attrib)
1070  {
1071  bind(attrib);
1072  }
1073 
1074  void bind(const GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
1075  void bind(const GA_Attribute *attrib, int minsize=1)
1076  {
1077  myAttrib = const_cast<GA_Attribute *>(attrib);
1078  if (!myAttrib)
1079  return;
1080  myAIF = myAttrib->getAIF<AIFType>();
1081  if (!myAIF)
1082  myAttrib = 0;
1083  }
1084 
1085  const GA_Attribute *getAttribute() const { return myAttrib; }
1086 
1087  void clear()
1088  {
1089  myAttrib = 0;
1090  myAIF = 0;
1091  }
1092 
1093  SYS_FORCE_INLINE bool isValid() const { return myAttrib; }
1094  SYS_FORCE_INLINE bool isInvalid() const { return !myAttrib; }
1095 
1096  SYS_FORCE_INLINE void get(GA_Offset off, T &value) const
1097  {
1099  UT_ASSERT_P(GAisValid(off));
1101  myAIF->get(myAttrib, off, value);
1102  }
1103 
1104  bool operator==(const GA_ROHandleT<T> &handle) const
1105  {
1106  UT_ASSERT_P(myAIF == handle.myAIF);
1107  return myAttrib == handle.myAttrib;
1108  }
1109  bool operator!=(const GA_ROHandleT<T> &handle) const
1110  {
1111  UT_ASSERT_P(myAIF == handle.myAIF);
1112  return myAttrib != handle.myAttrib;
1113  }
1114  const GA_Attribute *operator->() const
1115  {
1116  return myAttrib;
1117  }
1118 
1119 protected:
1121  const AIFType* myAIF;
1122 };
1123 
1124 /// Read-Write handle for array attribute data
1125 template <typename T>
1126 class GA_RWHandleT<T, typename ENABLE_ARRAY(T)>
1127  : public GA_ROHandleT<T, typename ENABLE_ARRAY(T)>
1128 {
1129 public:
1131 
1132 private:
1133  using Base::myAttrib;
1134 public:
1135 
1137  {
1138  this->clear();
1139  }
1141  {
1142  bind(attrib);
1143  }
1144  GA_RWHandleT(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
1145 
1146  void operator=(GA_Attribute *attrib)
1147  {
1148  bind(attrib);
1149  }
1150 
1151  void bind(GA_Detail *gdp, GA_AttributeOwner owner, const UT_StringRef &name, int minsize=1);
1152  void bind(GA_Attribute *attrib, int minsize=1)
1153  {
1154  Base::bind(attrib, minsize);
1155  }
1156 
1158 
1159  void bumpDataId() const
1160  {
1161  if (myAttrib)
1162  myAttrib->bumpDataId();
1163  }
1164 
1166  {
1167  if (myAttrib)
1168  return myAttrib->getDataId();
1169  return GA_INVALID_DATAID;
1170  }
1171 
1172  SYS_FORCE_INLINE void set(GA_Offset off, const T &value) const
1173  {
1175  UT_ASSERT_P(GAisValid(off));
1177  Base::myAIF->set(myAttrib, off, value);
1178  }
1180  {
1181  return myAttrib;
1182  }
1183 
1184 private:
1185 };
1186 
1187 #undef ENABLE_ARRAY
1188 
1189 template <typename T>
1191 {
1192 public:
1195 };
1196 
1197 // Hacky workaround for now
1198 template <>
1199 class GA_HandleT<const char*>
1200 {
1201 public:
1204 };
1205 
1208 
1211 
1214 
1217 
1220 
1223 
1226 
1229 
1232 
1235 
1238 
1241 
1244 
1247 
1250 
1253 
1256 
1259 
1262 
1265 
1268 
1271 
1274 
1277 
1280 
1281 #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:1018
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:736
SYS_FORCE_INLINE void bumpDataId()
Definition: GA_Attribute.h:274
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:854
void makeConstant(const T &cval) const
Definition: GA_Handle.h:369
void clear()
Clear the handle.
Definition: GA_Handle.h:953
GA_RWHandleT< UT_Int32Array > GA_RWHandleIA
Definition: GA_Handle.h:1267
GA_ATINumeric * operator->() const
Definition: GA_Handle.h:388
void SecondGuess
Definition: UT_Storage.h:74
GA_RWHandleT< UT_Vector2D > GA_RWHandleV2D
Definition: GA_Handle.h:1255
GLenum GLint * range
Definition: glcorearb.h:1924
Generic Attribute Interface class to access an attribute as a array.
GA_PageArray< BASETYPE, 1 > * myExactMatch
Definition: GA_Handle.h:572
GA_ROHandleT< UT_StringArray > GA_ROHandleSA
Definition: GA_Handle.h:1278
UT_Storage
Definition: UT_Storage.h:26
SYS_FORCE_INLINE bool isPageConstant(GA_PageNum pagenum) const
Definition: GA_Handle.h:553
GA_ROHandleT< int8 > GA_ROHandleC
Definition: GA_Handle.h:1218
void operator=(GA_Attribute *attrib)
Definition: GA_Handle.h:849
void bind(const GA_Attribute *attrib, int minsize=1)
Definition: GA_Handle.h:1075
GA_RWHandleT< UT_FprealArray > GA_RWHandleRA
Definition: GA_Handle.h:1264
GA_ROHandleT< UT_Vector4D > GA_ROHandleV4D
Definition: GA_Handle.h:1260
SYS_FORCE_INLINE void bind(const GA_Attribute *attrib, int minsize=1)
Definition: GA_Handle.h:427
const DataType & getData() const
int64 GA_DataId
Definition: GA_Types.h:663
#define ENABLE_ARRAY(T)
Definition: GA_Handle.h:1050
SYS_FORCE_INLINE bool isInvalid() const
Definition: GA_Handle.h:1094
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:728
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:1252
GA_PageArray< BASETYPE, theTupleSize > * myExactMatch
Definition: GA_Handle.h:253
GLuint start
Definition: glcorearb.h:474
bool GAisValid(GA_Size v)
Definition: GA_Types.h:625
void bind(GA_Attribute *attrib, int minsize=1)
Definition: GA_Handle.h:1152
GA_RWHandleT< fpreal > GA_RWHandleR
Definition: GA_Handle.h:1207
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
int getTupleSize() const
GA_RWHandleT< UT_Int64Array > GA_RWHandleIDA
Definition: GA_Handle.h:1270
GA_ROHandleT< UT_Vector4F > GA_ROHandleV4
Definition: GA_Handle.h:1239
GA_ROHandleT< UT_Vector2F > GA_ROHandleV2
Definition: GA_Handle.h:1233
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
Definition: SYS_Types.h:127
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:746
GA_ROHandleT< UT_Vector3D > GA_ROHandleV3D
Definition: GA_Handle.h:1257
void operator=(GA_Attribute *attrib)
Definition: GA_Handle.h:1146
bool operator==(const GA_ROHandleT< T > &handle) const
Definition: GA_Handle.h:239
void bumpDataId() const
Definition: GA_Handle.h:856
GA_ROHandleT(const GA_Attribute *attrib)
Definition: GA_Handle.h:413
SYS_FORCE_INLINE void bind(GA_Attribute *attrib, int minsize=1)
Definition: GA_Handle.h:293
GA_ATINumeric * getAttribute() const
Definition: GA_Handle.h:622
GA_ROHandleT< UT_Matrix4D > GA_ROHandleM4D
Definition: GA_Handle.h:1248
GA_RWHandleT< int64 > GA_RWHandleID
Definition: GA_Handle.h:1243
SYS_FORCE_INLINE bool hasChanges() const
Definition: GA_Handle.h:1023
void setPageConstant(GA_PageNum pagenum, const BASETYPE *values) const
Definition: GA_Handle.h:378
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:882
SYS_FORCE_INLINE void set(GA_Offset off, T val) const
Definition: GA_Handle.h:637
GA_Attribute * getAttribute() const
Access to attribute.
Definition: GA_Handle.h:941
#define GA_API
Definition: GA_API.h:12
GA_RWHandleT< UT_Vector4D > GA_RWHandleV4D
Definition: GA_Handle.h:1261
Read-Write string handle.
Definition: GA_Handle.h:833
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:664
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:603
GA_ATIString * myAttrib
Definition: GA_Handle.h:1028
GA_RWBatchHandleS(GA_Attribute *attrib)
Definition: GA_Handle.h:917
GA_ROHandleT< int64 > GA_ROHandleID
Definition: GA_Handle.h:1242
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:844
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:211
GA_ATINumeric * getAttribute() const
Definition: GA_Handle.h:305
const GA_Attribute * getAttribute() const
Definition: GA_Handle.h:1085
GA_DataId getDataId() const
Definition: GA_Handle.h:944
GLsizeiptr size
Definition: glcorearb.h:663
GA_ROHandleT< UT_Vector3F > GA_ROHandleV3
Definition: GA_Handle.h:1236
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:1007
SYS_FORCE_INLINE bool isValid() const
Definition: GA_Handle.h:1093
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:1245
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:1003
SYS_FORCE_INLINE void getV(GA_Offset off, T *data, int size) const
Definition: GA_Handle.h:507
GA_RWHandleT< UT_Vector3F > GA_RWHandleV3
Definition: GA_Handle.h:1237
const GA_ATINumeric * getAttribute() const
Definition: GA_Handle.h:161
GA_Size GA_Offset
Definition: GA_Types.h:617
GA_PageArray< BASETYPE > * myAlmostMatch
Definition: GA_Handle.h:573
void makeConstant(T cval, int comp=-1) const
Definition: GA_Handle.h:723
void operator=(GA_Attribute *attrib)
Definition: GA_Handle.h:923
SYS_FORCE_INLINE bool isInvalid() const
Definition: GA_Handle.h:481
void bind(const GA_ATINumeric *attrib, int minsize=1)
Definition: GA_Handle.h:431
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:1224
GA_ROHandleT< int32 > GA_ROHandleI
Definition: GA_Handle.h:1221
GA_RWHandleT< UT_Fpreal64Array > GA_RWHandleDA
Definition: GA_Handle.h:1276
SYS_FORCE_INLINE void add(GA_Offset off, int comp, T val) const
Definition: GA_Handle.h:699
SYS_FORCE_INLINE void set(GA_Offset off, const UT_StringHolder &str)
Store the str at the given offset.
Definition: GA_Handle.h:983
void operator=(const GA_Attribute *attrib)
Definition: GA_Handle.h:769
SYS_FORCE_INLINE void set(GA_Offset off, int comp, T val) const
Definition: GA_Handle.h:663
SYS_FORCE_INLINE void add(GA_Offset off, T val) const
Definition: GA_Handle.h:650
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:676
int getTupleSize() const
Tuple size of the attribute.
Definition: GA_Handle.h:788
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:943
GA_RWHandleT< UT_Fpreal32Array > GA_RWHandleFA
Definition: GA_Handle.h:1273
bool isOffsetTransient(GA_Offset offset) const
GA_ATIStringDelayedWriter myWriter
Definition: GA_Handle.h:1029
void getBlockFromIndices(GA_Index startidx, GA_Size nelements, T *dest, int deststride=1, int component=0) const
int64 exint
Definition: SYS_Types.h:116
SYS_FORCE_INLINE void set(GA_Offset off, const UT_StringHolder &str) const
Store the str at the given offset.
Definition: GA_Handle.h:870
GA_RWHandleT< UT_Vector4F > GA_RWHandleV4
Definition: GA_Handle.h:1240
GA_DataId getDataId() const
Definition: GA_Handle.h:790
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:125
bool operator!=(const GA_ROHandleT< T > &handle) const
Definition: GA_Handle.h:1109
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:893
#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:1212
SYS_FORCE_INLINE void set(GA_Offset off, const T &value) const
Definition: GA_Handle.h:1172
GA_ATINumeric * myAttrib
Definition: GA_Handle.h:252
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:802
GA_DataId getDataId() const
Definition: GA_Handle.h:862
SYS_FORCE_INLINE void set(GA_Offset off, int comp, const UT_StringHolder &str) const
Definition: GA_Handle.h:874
GLintptr offset
Definition: glcorearb.h:664
const GA_ATINumeric * operator->() const
Definition: GA_Handle.h:565
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".
const GA_Attribute * getAttribute() const
Access to attribute.
Definition: GA_Handle.h:786
GA_RWHandleT< fpreal64 > GA_RWHandleD
Definition: GA_Handle.h:1216
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:1275
GA_RWHandleT< UT_Matrix4F > GA_RWHandleM4
Definition: GA_Handle.h:1228
bool operator!=(const GA_ROHandleT< T > &handle) const
Definition: GA_Handle.h:561
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:974
GA_RWHandleT< UT_Matrix3D > GA_RWHandleM3D
Definition: GA_Handle.h:1246
GA_ROHandleT< fpreal64 > GA_ROHandleD
Definition: GA_Handle.h:1215
GA_RWHandleT< T > RWType
Definition: GA_Handle.h:1194
const GA_Attribute * operator->() const
Definition: GA_Handle.h:1114
SYS_FORCE_INLINE T operator()(GA_Offset off, int comp=0) const
Definition: GA_Handle.h:542
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
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1601
SYS_FORCE_INLINE bool isValid() const
Definition: GA_Handle.h:803
GA_HandleDetail::ArrayAIF< T >::type AIFType
Definition: GA_Handle.h:1057
GLboolean * data
Definition: glcorearb.h:130
SYS_FORCE_INLINE GA_DataId getDataId() const
Definition: GA_Attribute.h:267
GLuint const GLchar * name
Definition: glcorearb.h:785
void bind(const GA_Attribute *attrib, int minsize=1)
Bind the handle to the given attribute.
Definition: GA_Handle.h:776
SYS_FORCE_INLINE T operator[](GA_Offset off) const
Definition: GA_Handle.h:546
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:611
void bumpDataId() const
Definition: GA_Handle.h:307
GA_RWHandleT< fpreal16 > GA_RWHandleH
Definition: GA_Handle.h:1210
SYS_FORCE_INLINE bool isPageConstant(GA_PageNum pagenum) const
void clear()
Clear the handle.
Definition: GA_Handle.h:799
const GA_ATIString * operator->() const
Definition: GA_Handle.h:823
GA_ROHandleT< UT_Int32Array > GA_ROHandleIA
Definition: GA_Handle.h:1266
GA_ROHandleT< fpreal16 > GA_ROHandleH
Definition: GA_Handle.h:1209
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:816
GA_ATIString * rwAttrib() const
Definition: GA_Handle.h:898
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:886
void setBlock(GA_Offset startoff, GA_Size nelements, const T *source, int sourcestride=1, int component=0) const
GLsizei const GLfloat * value
Definition: glcorearb.h:823
GA_AttributeOwner
Definition: GA_Types.h:33
bool operator==(const GA_ROHandleT< T > &handle) const
Definition: GA_Handle.h:557
GA_ROHandleT(const GA_Attribute *attrib)
Definition: GA_Handle.h:1063
GA_RWHandleT< UT_Vector2F > GA_RWHandleV2
Definition: GA_Handle.h:1234
#define SCALAR(T)
Simplify checking for scalar types.
Definition: GA_Handle.h:396
SYS_FORCE_INLINE bool isPageConstant(GA_PageNum pagenum) const
Definition: GA_Handle.h:235
GA_ROHandleT< fpreal > GA_ROHandleR
Definition: GA_Handle.h:1206
SYS_FORCE_INLINE bool isInvalid() const
Definition: GA_Handle.h:962
GA_RWHandleT< UT_Matrix4D > GA_RWHandleM4D
Definition: GA_Handle.h:1249
GA_ROHandleT< UT_FprealArray > GA_ROHandleRA
Definition: GA_Handle.h:1263
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:419
typedef int
Definition: png.h:1175
GA_ROHandleT< UT_Matrix4F > GA_ROHandleM4
Definition: GA_Handle.h:1227
void bind(GA_Attribute *attrib, int minsize=1)
Bind the handle to the given attribute.
Definition: GA_Handle.h:930
GA_RWHandleT< UT_Vector3D > GA_RWHandleV3D
Definition: GA_Handle.h:1258
GA_ROHandleT< UT_QuaternionF > GA_ROHandleQ
Definition: GA_Handle.h:1230
SYS_FORCE_INLINE GA_TypeInfo getTypeInfo() const
Definition: GA_Attribute.h:220
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:1011
SYS_FORCE_INLINE void set(GA_Offset off, int comp, const UT_StringHolder &str)
Definition: GA_Handle.h:991
const GA_IndexMap & getIndexMap() const
Definition: GA_Attribute.h:199
GA_Size GA_PageNum
Definition: GA_Types.h:620
const T * getAIF() const
Generic method for getting an AIF by type.
Definition: GA_Attribute.h:380
GA_ROHandleT< UT_Int64Array > GA_ROHandleIDA
Definition: GA_Handle.h:1269
void bind(GA_ATINumeric *attrib, int minsize=1)
Definition: GA_Handle.h:615
SYS_FORCE_INLINE bool isValid() const
Definition: GA_Handle.h:477
SYS_FORCE_INLINE void set(const GA_Range &range, const UT_StringHolder &str)
Definition: GA_Handle.h:987
GA_RWHandleT< fpreal32 > GA_RWHandleF
Definition: GA_Handle.h:1213
GA_RWHandleT< int8 > GA_RWHandleC
Definition: GA_Handle.h:1219
GA_ROHandleT(const GA_Attribute *attrib)
Definition: GA_Handle.h:117
GLuint GLfloat * val
Definition: glcorearb.h:1607
GA_ROHandleT< T > ROType
Definition: GA_Handle.h:1193
GA_RWHandleT(GA_Attribute *attrib)
Definition: GA_Handle.h:597
GA_ROHandleT< UT_QuaternionD > GA_ROHandleQD
Definition: GA_Handle.h:1251
GA_BlobIndex GA_StringIndexType
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:998
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:126
SYS_FORCE_INLINE const GA_PageArray< DEST_DATA_T, TSIZE, TABLEHARDENED, PAGESHARDENED > & castType() const
Definition: GA_PageArray.h:662
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:1104
#define const
Definition: zconf.h:214
GA_RWHandleT< UT_QuaternionF > GA_RWHandleQ
Definition: GA_Handle.h:1231
Read-only handle for string attribute data.
Definition: GA_Handle.h:756
GA_RWHandleT< int32 > GA_RWHandleI
Definition: GA_Handle.h:1222
GA_ROHandleT< UT_Fpreal32Array > GA_ROHandleFA
Definition: GA_Handle.h:1272
UT_StringHolder & operator()(exint i)
Definition: UT_Array.h:542
GA_RWHandleT< UT_Matrix3F > GA_RWHandleM3
Definition: GA_Handle.h:1225
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)
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:611
GA_RWHandleS(GA_Attribute *attrib)
Definition: GA_Handle.h:840
bool operator!=(const GA_ROHandleT< T > &handle) const
Definition: GA_Handle.h:243
GA_Attribute * getAttribute() const
Definition: GA_Handle.h:1157
GA_ROHandleS(const GA_Attribute *attrib)
Definition: GA_Handle.h:763
const GA_ATINumeric * getAttribute() const
Definition: GA_Handle.h:456
GA_RWHandleT< UT_StringArray > GA_RWHandleSA
Definition: GA_Handle.h:1279
void operator=(const GA_Attribute *attrib)
Definition: GA_Handle.h:1069
const GA_ATIString * myAttrib
Definition: GA_Handle.h:829
SYS_FORCE_INLINE bool isInvalid() const
Definition: GA_Handle.h:804
GA_ROHandleT< UT_Vector2D > GA_ROHandleV2D
Definition: GA_Handle.h:1254
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:961
GLenum src
Definition: glcorearb.h:1792