HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GA_ATIGroupBool.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_ATIGroupBool.h ( GA Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #pragma once
12 
13 #ifndef __GA_ATIGroupBool__
14 #define __GA_ATIGroupBool__
15 
16 #include "GA_API.h"
17 #include "GA_Attribute.h"
18 #include "GA_AttributeType.h" // for GA_AttributeType
19 #include "GA_DataBitArray.h"
20 #include "GA_ElementGroupOrder.h"
21 #include "GA_Group.h"
22 #include "GA_IndexMap.h"
23 #include "GA_Iterator.h"
24 #include "GA_Range.h" // for GA_Range
25 #include "GA_Types.h" // for GA_Offset, GA_Size, etc
26 
27 #include <UT/UT_Assert.h>
28 #include <UT/UT_Lock.h>
29 #include <UT/UT_StringHolder.h>
30 #include <SYS/SYS_Inline.h>
31 #include <SYS/SYS_Types.h> // for int64
32 
33 #include <iosfwd> // for ostream
34 
35 
36 class GA_AIFCopyData;
37 class GA_AIFInterp;
38 class GA_AIFMerge;
39 class GA_AIFTuple;
40 class GA_Defragment;
41 class GA_Detail;
42 class GA_LoadMap;
43 class GA_MergeMap;
44 class GA_SaveMap;
45 
46 class UT_BitArray;
47 class UT_IStream;
48 class UT_JSONParser;
49 class UT_JSONWriter;
50 class UT_MemoryCounter;
51 class UT_WorkBuffer;
52 
53 
55 {
56  // typedef for use inside this class
58 public:
59  /// GA_Group has some of the same function names as GA_Attribute,
60  /// so we need to pick one.
63 
64  virtual const GA_Detail &getDetail() const final
65  {
66  return GA_Attribute::getDetail();
67  }
69  {
70  return GA_Attribute::getDetail();
71  }
72 
73  static void registerType();// Register group attribute type
74 
76  static const UT_StringHolder &getTypeName()
77  { return theAttributeType->getTypeName(); }
79  static const GA_AttributeType &getType() { return *theAttributeType; }
80 
82  static bool isType(const GA_Attribute *attrib)
83  {
84  return attrib && &attrib->getType() == theAttributeType;
85  }
88  {
89  if (attrib && &attrib->getType() == theAttributeType)
90  return static_cast<GA_ATIGroupBool *>(attrib);
91  return nullptr;
92  }
94  static const GA_ATIGroupBool *cast(const GA_Attribute *attrib)
95  {
96  if (attrib && &attrib->getType() == theAttributeType)
97  return static_cast<const GA_ATIGroupBool *>(attrib);
98  return nullptr;
99  }
101  static bool isType(const GA_Group *group)
102  {
103  if (!group)
104  return false;
106  return (type & (GA_GMASK_POINT | GA_GMASK_VERTEX | GA_GMASK_PRIMITIVE)) != 0;
107  }
109  static const GA_ElementGroup *cast(const GA_Group *group)
110  {
111  if (!isType(group))
112  return nullptr;
113  return UTverify_cast<const GA_ElementGroup *>(group);
114  }
116  static GA_ElementGroup *cast(GA_Group *group)
117  {
118  if (!isType(group))
119  return nullptr;
120  return UTverify_cast<GA_ElementGroup *>(group);
121  }
122 
123 protected:
125  const UT_StringHolder &name, bool internal, bool detached);
126 public:
127  GA_ElementGroup(const GA_Detail &detail, GA_AttributeOwner owner);
128  virtual ~GA_ElementGroup();
129 
130  virtual int64 getMemoryUsage(bool inclusive) const;
131 
132  virtual void countMemory(UT_MemoryCounter &counter, bool inclusive) const;
133 
134  /// @{
135  /// Interface for defragmentation
136  virtual void defragment(const GA_Defragment &defrag);
137  /// @}
138 
139  /// Returns \c true if the group is currently ordered.
140  virtual bool isOrdered() const final
141  {
142  return myOrder != nullptr;
143  }
144 
145  /// When \c ordered is set to \c true, convert this group to an ordered
146  /// group, otherwise convert to an unordered group. If the group contains
147  /// mixed entries, a conversion to unordered will fail, and the function
148  /// return \c false. Conversion to ordered group will always succeed.
149  bool setOrdered(bool ordered)
150  {
151  if (ordered)
152  {
153  makeOrdered();
154  return true;
155  }
156  if (!getOrdered())
157  return true;
158  if (getOrdered()->mixedEntries())
159  return false;
160 
161  clearOrdered();
162  return true;
163  }
164 
165  void makeOrdered();
166 
168  {
169  if (getOrdered() && !getOrdered()->mixedEntries())
170  clearOrdered();
171  }
172 
173  /// Clear all order information, including any mixed entries.
174  void clearOrdered();
175 
176  /// Copy membership information from the source group. This will fail if
177  /// the groups have different index maps. This will also copy over the
178  /// ordered information if \c copy_ordering is set to \c true.
179  bool copyMembership(const GA_ATIGroupBool &src,
180  bool copy_ordering = true);
181 
182  /// Return GA offset of the Nth element of the group.
183  /// NOTE: This may be quite expensive to compute.
184  /// Returns GA_INVALID_OFFSET if there aren't enough elements in the group.
185  GA_Offset findOffsetAtGroupIndex(GA_Size i) const;
186 
187  /// NOTE: When using setElement(GA_Offset,bool) in parallel,
188  /// you *must* call invalidateGroupEntries() afterward, else
189  /// getGroupEntries() may return an incorrect value.
190  /// NOTE: This cannot be used in parallel on an ordered group.
192  void setElement(GA_Offset ai, bool v)
193  {
194  if (v != contains(ai))
195  {
196  if (v)
197  setMembership<true>(ai);
198  else
199  setMembership<false>(ai);
200  }
201  }
202  /// NOTE: This cannot be used in parallel on an ordered group.
204  void setElement(const GA_Range &it, bool v)
205  {
206  if (v)
207  setMembership<true>(it);
208  else
209  setMembership<false>(it);
210  }
211 
212  /// NOTE: When using toggleElement(GA_Offset) in parallel,
213  /// you *must* call invalidateGroupEntries() afterward, else
214  /// getGroupEntries() may return an incorrect value.
215  /// NOTE: This cannot be used in parallel on an ordered group.
216  void toggleElement(GA_Offset ai);
217  /// NOTE: This cannot be used in parallel on an ordered group.
218  void toggleElement(const GA_Range &it);
219 
220  /// These methods only work on unordered groups.
221  /// @{
222  void orEqual(const GA_ATIGroupBool *src);
223  void andEqual(const GA_ATIGroupBool *src);
224  void xorEqual(const GA_ATIGroupBool *src);
225  void subEqual(const GA_ATIGroupBool *src);
226  void toggleAll(GA_Size numelements);
227  /// @}
228 
229  /// Add all elements corresponding with src to this group.
230  /// src can be a point, vertex, primitive, or edge group.
231  /// Breakpoint groups won't crash, but may add more
232  /// elements than required.
233  virtual bool combine(const GA_Group *src) final;
234 
235  /// operator|= supports point, vertex, and primitive groups,
236  /// regardless of this group type.
237  GA_ElementGroup &operator|=(const GA_ElementGroup &g);
238 
239  /// These operators only support g having the
240  /// same owner as this.
241  /// @{
242  GA_ElementGroup &operator&=(const GA_ElementGroup &g);
243  GA_ElementGroup &operator-=(const GA_ElementGroup &g);
244  GA_ElementGroup &operator^=(const GA_ElementGroup &g);
245  GA_ElementGroup &operator =(const GA_ElementGroup &g)
246  {
247  copyMembership(g, /* copy_ordering */ true);
248  return *this;
249  }
250  /// @}
251 
254  {
255  return myData.get(offset);
256  }
257  bool containsIndex(GA_Index ai) const
258  {
260  return contains(ao);
261  }
262 
265  {
266  return contains(offset);
267  }
269  bool containsAny(const GA_Range &range) const
270  {
271  return myData.isAnySet(range);
272  }
274  bool isGroupEmpty() const
275  {
276  return (getGroupEntries() == 0);
277  }
278  /// Query whether the group is empty of primary elements.
280  bool isEmpty() const
281  {
282  return (getGroupEntries() == 0);
283  }
284  /// Query whether the group is empty of elements, primary or mixed.
285  bool isEmptyMix() const
286  {
287  return (entriesMix() == 0);
288  }
289  /// Will return the number of primary elements.
290  virtual GA_Size entries() const final
291  { return getGroupEntries(); }
292  /// Will return the total number of elements, primary and mixed.
293  virtual GA_Size entriesMix() const final
294  {
295  if (getOrdered())
296  return getOrdered()->entries();
297  else
298  return getGroupEntries();
299  }
301  {
302  if (myGroupEntries >= 0)
303  return myGroupEntries;
304 
305  return computeGroupEntries();
306  }
307  GA_Size computeGroupEntries() const;
308 
309  /// Query if the group contains any mixed elements.
310  virtual bool isMixed() const final
311  {
312  return myOrder && (myOrder->mixedEntries() > 0);
313  }
314 
316  void setOffset(GA_Offset ai, bool v)
317  {
318  setElement(ai, v);
319  }
320 
321  /// @{
322  /// Access elements of the group by ordered index rather than offset.
323  /// Internally, this method just find the data offset and calls appropriate
324  /// method.
327  {
329  addOffset(ao);
330  }
333  {
335  toggleOffset(ao);
336  }
339  {
341  removeOffset(ao);
342  }
343  /// @}
344 
345  /// @{
346  /// Access elements by their offset in the index map
347  /// NOTE: When using addOffset, toggleOffset, removeOffset in parallel,
348  /// you *must* call invalidateGroupEntries() afterward, else
349  /// entries() may return an incorrect value.
350  /// NOTE: These cannot be used in parallel on an ordered group.
353  {
354  if (GAisValid(ai))
355  setElement(ai, true);
356  }
359  {
360  if (GAisValid(ai))
361  toggleElement(ai);
362  }
365  {
366  if (GAisValid(ai))
367  setElement(ai, false);
368  }
369  /// @}
370 
371  /// @{
372  /// Access elements by a GA_Range
373  /// These have the advantage of being able to operate a page at a time
374  /// when applicable.
375  /// NOTE: These cannot be used in parallel on an ordered group.
377  void addRange(const GA_Range &it)
378  {
379  setMembership<true>(it);
380  }
382  void toggleRange(const GA_Range &it)
383  {
384  toggleElement(it);
385  }
387  void removeRange(const GA_Range &it)
388  {
389  setMembership<false>(it);
390  }
391  /// @}
392 
393 
394  /// Query the length of repeated bit values starting from 'start' until
395  /// 'end' or a change in bit values.
397  GA_Size &size, bool &value) const
398  {
399  return myData.getConstantSpan(start, end,
400  size, value);
401  }
402 
403  void clear();
404  void makeConstant(bool value);
406  { myGroupEntries = -1; }
407 
408  virtual bool needDestruction() const;
409  virtual void destructElement(GA_Offset offset);
410  virtual void reconstructElementBlock(GA_Offset offset, GA_Offset nelements);
411 
412  /// Add all elements to the group
413  virtual void addAll() final
414  {
415  makeConstant(true);
416  }
417  /// Add all elements to the group, only writing to real elements' offsets.
418  void setEntries()
419  {
420  setElement(GA_Range(getIndexMap()), true);
421  }
422  /// Toggle membership of all elements
424  {
425  // We are no longer ordered.
426  makeUnordered();
427  toggleAll(getIndexMap().offsetSize());
428  invalidateGroupEntries();
429  }
430 
431  /// Data is paged, so concurrent writes to separate pages supported,
432  /// unless the group is ordered. Rather, that would be the case if
433  /// the updates to myGroupEntries were thread-safe.
435  { return WRITE_CONCURRENCE_NONE; }
436 
437  virtual const GA_AIFCopyData *getAIFCopyData() const {return myAIFCopyData;}
438  virtual const GA_AIFTuple *getAIFTuple() const { return myAIFTuple; }
439  virtual const GA_AIFInterp *getAIFInterp() const { return myAIFInterp; }
440  virtual const GA_AIFMerge *getAIFMerge() const { return myAIFMerge; }
441 
442  // TODO: Need to override arithmetic operations too! (for ordered groups)
444  const GA_ElementGroupOrder *getOrdered() const { return myOrder; }
445  GA_ElementGroup *getGroup() { return this; }
446  const GA_ElementGroup *getGroup() const { return this; }
447  GA_ElementGroup *getAttribute() { return this; }
448  const GA_ElementGroup *getAttribute() const { return this; }
449 
450  bool loadGroupH9(UT_IStream &is);
451  bool loadGroupByIndexOrderH9(const UT_BitArray &array);
452  bool saveGroupH9(std::ostream &os, bool binary) const;
453 
454  /// @private Method called in merging
455  void mergeGrowArray(const GA_MergeMap &map,
456  const GA_ATIGroupBool &sattrib);
457 
458  // Debug code
459  // Note: Groups don't have to have the same capacity?
460  virtual bool debugValidateArrayCapacity(GA_Offset sz) const;
461 
462  /// Save data to a JSON file. We do not provide an GA_AIFJSON interface
463  /// since the data is saved by the group (not the attribute). This method
464  /// is called directly by GA_ElementGroup instead.
465  /// @section JSON-GA_ATIGroupBool JSON Schema: GA_ATIGroupBool
466  /// @code
467  /// {
468  /// "name" : "GA_ATIGroupBool",
469  /// "description" :
470  /// "Selection information for a GA_ElementGroup. There should
471  /// only be one of 'ordered' or 'unordered' depending on
472  /// whether the group is ordered or unordered.",
473  /// "type" : "orderedmap",
474  /// "properties": {
475  /// "defaults": {
476  /// "type" : { "$ref" : "GA_Defaults" }
477  /// "description" : "Default values",
478  /// },
479  /// "ordered": {
480  /// "type" : {"$ref":"GA_ElementGroupOrder"},
481  /// "optional" : true,
482  /// "description" : "Ordered group selection.",
483  /// },
484  /// "unordered": {
485  /// "type" : {"$ref":"GA_DataBitArray"},
486  /// "optional" : true,
487  /// "description" : "Unordered selection of group selection.",
488  /// },
489  /// },
490  /// }
491  /// @endcode
492  /// @see @ref JSON_FileFormat
493  bool jsonSave(UT_JSONWriter &w, const GA_SaveMap&map) const;
494 
495  /// Load from a JSON stream
496  bool jsonLoad(UT_JSONParser &p, const GA_LoadMap &map);
497 
498  /// Save data to a JSON stream.
499  /// @section JSON-GA_ElementGroup JSON Schema: GA_ElementGroup
500  /// Private data for an element group
501  /// @code
502  /// {
503  /// "name" : "GA_ElementGroup-Data",
504  /// "description" : "Data for an element group.",
505  /// "type" : "orderedmap",
506  /// "properties": {
507  /// "selection": {
508  /// "type" : {"$ref" : "GA_ATIGroupBool" },
509  /// "description" : "Group memebership data",
510  /// "optional" : true
511  /// }
512  /// },
513  /// }
514  /// @endcode
515  ///
516  /// @see @ref JSON_FileFormat, GA_GroupTable
517  virtual bool jsonSaveData(UT_JSONWriter &w,
518  const GA_SaveMap &map) const;
519 
520  /// Load from a JSON stream
521  virtual bool jsonLoadData(UT_JSONParser &p,
522  const GA_LoadMap &map);
523 
524  /// Compute detailed information
525  virtual bool stat(UT_WorkBuffer &info, uint level) const;
526 
527  /// Grow or shrink the array size
528  virtual bool setArraySize(GA_Offset new_size);
529 
530  /// Get the array size of the attribute. This is primarily here
531  /// for checking detached groups, when the detail may have
532  /// more elements added since the group was created.
534  { return myData.getArraySize(); }
535 
536  /// Returns the writable raw bit array.
537  /// WARNING: Only use this if this is an unordered group,
538  /// and invalidateGroupEntries() has been called,
539  /// so that writing doesn't cause problems.
542  {
543  UT_ASSERT_P(!isOrdered() && myGroupEntries < 0);
544  return myData;
545  }
546 
547  /// Returns the read-only raw bit array.
549  const GA_DataBitArray &getData() const
550  {
551  return myData;
552  }
553 
554  /// Try to compress data pages
555  virtual void tryCompressAllPages(
556  GA_Offset start_offset = GA_Offset(0),
557  GA_Offset end_offset = GA_INVALID_OFFSET);
558  /// Harden data pages
559  virtual void hardenAllPages(
560  GA_Offset start_offset = GA_Offset(0),
561  GA_Offset end_offset = GA_INVALID_OFFSET);
562 
563  /// In the case that we're copying from an attribute whose storage
564  /// type matches this exactly, this function copies the metadata
565  /// not associated with the storage, e.g. myOptions,
566  /// *excluding* the name and the data ID.
567  virtual void copyNonStorageMetadata(const GA_Attribute *that) final;
568 
569  /// This replaces the entirety of this attribute's content and non-
570  /// storage metadata (except the name) with that of the src attribute.
571  /// This copies the src group order if present and destroys any if not.
572  /// matchesStorage(src) should already return true.
573  /// This is primarily for use by GA_AttributeSet::replace().
574  /// NOTE: The internal content sizes may not match exactly if the
575  /// attribute type may overallocate, but the sizes should be such
576  /// that any real data will fit in the destination, so be careful
577  /// and deal with the myTailInitialize flag appropriately if
578  /// any extra elements aren't equal to the default.
579  virtual void replace(const GA_Attribute &src) final;
580 
581  /// Copy attribute values for a single element.
582  /// @{
583  virtual bool copy(GA_Offset desti, GA_Offset srci) final
584  {
585  setElement(desti, contains(srci));
586  return true;
587  }
588  virtual bool copy(GA_Offset desti, const GA_Attribute &src, GA_Offset srci) final
589  {
591  return false;
592  setElement(desti, UTverify_cast<const GA_ATIGroupBool *>(&src)->contains(srci));
593  return true;
594  }
595  bool copy(GA_Offset desti, const GA_ATIGroupBool &src, GA_Offset srci)
596  {
597  setElement(desti, src.contains(srci));
598  return true;
599  }
600  /// @}
601 
602  /// Copy attribute values for a range of elements.
603  /// @{
604  virtual bool copy(const GA_Range &destrange, const GA_Range &srcrange) final
605  {
606  return tupleSet(destrange, *this, srcrange);
607  }
608  virtual bool copy(const GA_Range &destrange, const GA_Attribute &src, const GA_Range &srcrange) final
609  {
611  return false;
612  return tupleSet(destrange, *UTverify_cast<const GA_ATIGroupBool*>(&src), srcrange);
613  }
614  bool copy(const GA_Range &destrange, const GA_ATIGroupBool &src, const GA_Range &srcrange)
615  {
616  return tupleSet(destrange, src, srcrange);
617  }
618  /// @}
619 
620  /// Assign all elements of a range from a single attribute value.
621  /// @{
622  virtual bool fill(const GA_Range &destrange, GA_Offset srci) final
623  {
624  setElement(destrange, contains(srci));
625  return true;
626  }
627  virtual bool fill(const GA_Range &destrange, const GA_Attribute &src, GA_Offset srci) final
628  {
630  return false;
631  setElement(destrange, UTverify_cast<const GA_ATIGroupBool *>(&src)->contains(srci));
632  return true;
633  }
634  bool fill(const GA_Range &destrange, const GA_ATIGroupBool &src, GA_Offset srci)
635  {
636  setElement(destrange, src.contains(srci));
637  return true;
638  }
639  /// @}
640 
641 private:
642 
643  template <bool ADD>
644  void setMembership(GA_Offset ai)
645  {
646  UT_ASSERT_MSG_P(isDetached() || (GAisValid(ai) && ai < myData.getArraySize() && getIndexMap().isOffsetActive(ai)), "Writing to attached group at an inactive offset!");
647  UT_ASSERT_MSG_P(!isDetached() || (GAisValid(ai) && ai < myData.getArraySize() && getIndexMap().isOffsetActive(ai)), "Writing to detached group out of range! Note that they don't update when you add or remove elements from the detail!");
648 
649  if (myOrder)
650  {
651  if (ADD)
652  myOrder->append(ai);
653  else
654  myOrder->remove(ai);
655  }
656 
657  // maintain count
658  if (myGroupEntries >= 0)
659  myGroupEntries += ADD ? +1 : -1;
660 
661  myData.set(ai, ADD);
662  }
663 
664  template <bool ADD>
665  void setMembership(const GA_Range &range)
666  {
667  if (myOrder && range.canContainDuplicates())
668  {
669  for (GA_Iterator it(range); !it.atEnd(); ++it)
670  {
671  if (ADD != contains(*it))
672  setMembership<ADD>(*it);
673  }
674  return;
675  }
676  // else unordered group, or ordered group with
677  // range that cannot contain duplicates.
678 
679  if (myOrder)
680  {
681  for (GA_Iterator it(range); !it.atEnd(); ++it)
682  {
683  if (ADD != contains(*it))
684  {
685  if (ADD)
686  myOrder->append(*it);
687  else
688  myOrder->remove(*it);
689  }
690  }
691  }
693  if (isDetached())
694  {
695  for (GA_Iterator it(range); !it.atEnd(); ++it)
696  {
697  GA_Offset ai = *it;
698  if (!GAisValid(ai) || ai >= myData.getArraySize() || !getIndexMap().isOffsetActive(ai))
699  UT_ASSERT_MSG_P(0, "Writing to detached group out of range! Note that they don't update when you add or remove elements from the detail!");
700  }
701  })
702  myData.set(range, ADD);
703  invalidateGroupEntries();
704  }
705 
706  /// Only called by GA_GroupTable::rename(const char *, const char *).
707  virtual bool setName(const UT_StringHolder &n);
708 
709  virtual GA_Attribute *doClone(const GA_IndexMap &index_map,
710  const UT_StringHolder &name) const;
711 
712  /// @{ GA_AIFTuple
713  bool tupleSet(GA_Offset di, const GA_ATIGroupBool &s, GA_Offset si);
714  bool tupleSet(const GA_Range &di, const GA_ATIGroupBool &s,
715  const GA_Range &si);
716  /// @}
717 
718  /// @{ GA_AIFMerge
719  bool mergeAppendData(const GA_MergeMap &map,
720  const GA_Attribute *sattrib);
721  /// @}
722 
723  GA_DataBitArray myData;
724 
726  mutable GA_Size myGroupEntries;
727  mutable UT_Lock myGroupEntriesConstLock;
728 
729  static GA_AIFCopyData *myAIFCopyData;
730  static GA_AIFTuple *myAIFTuple;
731  static GA_AIFInterp *myAIFInterp; // GA_AIFCondInterp
732  static GA_AIFMerge *myAIFMerge;
733 
734  static const GA_AttributeType *theAttributeType;
735 
736  friend class GU_Group; // For operators
737  friend class GU_ElementGroup; // For operators
738  friend class GOP_GroupParse; // For |= operator
739 
740  /// @cond INTERNAL_DOX
741  class ga_GroupBoolCopyData;
742  class ga_GroupBoolTuple;
743  class ga_GroupBoolMerge;
744  class ga_GroupType;
745  /// @endcond
746 };
747 
749 
750 #endif
void setEntries()
Add all elements to the group, only writing to real elements' offsets.
static SYS_FORCE_INLINE bool isType(const GA_Attribute *attrib)
A class to manage an ordered array which has fixed offset handles.
Definition: GA_IndexMap.h:63
Definition of a geometry attribute.
Definition: GA_Attribute.h:189
static SYS_FORCE_INLINE const GA_ATIGroupBool * cast(const GA_Attribute *attrib)
bool setOrdered(bool ordered)
GLenum GLint * range
Definition: glcorearb.h:1924
GA_ElementGroup * getGroup()
Used to pass options and map offset values during saving.
Definition: GA_SaveMap.h:48
Iteration over a range of elements.
Definition: GA_Iterator.h:28
virtual bool copy(GA_Offset desti, GA_Offset srci) final
SYS_FORCE_INLINE bool containsAny(const GA_Range &range) const
const GA_Detail & getDetail() const
int myOrder
Definition: GT_CurveEval.h:263
virtual bool isMixed() const final
Query if the group contains any mixed elements.
virtual const GA_AIFMerge * getAIFMerge() const
Return the attribute's merge interface or NULL.
virtual bool setName(const UT_StringHolder &n)
Definition: GA_Group.h:191
const GLdouble * v
Definition: glcorearb.h:836
GLuint start
Definition: glcorearb.h:474
bool GAisValid(GA_Size v)
Definition: GA_Types.h:625
GA_GroupMaskType classMaskType() const
Definition: GA_Group.h:55
const GLuint GLenum const void * binary
Definition: glcorearb.h:1923
virtual bool fill(const GA_Range &destrange, GA_Offset srci) final
virtual GA_Size entries() const final
Will return the number of primary elements.
GLboolean GLboolean g
Definition: glcorearb.h:1221
Matrix44< T > addOffset(const Matrix44< T > &inMat, const Vec3< T > &tOffset, const Vec3< T > &rOffset, const Vec3< T > &sOffset, const Vec3< T > &ref)
The merge map keeps track of information when merging details.
Definition: GA_MergeMap.h:53
friend class GA_ElementGroup
Definition: GA_Attribute.h:668
SYS_FORCE_INLINE void setOffset(GA_Offset ai, bool v)
GLint level
Definition: glcorearb.h:107
void getConstantSpan(GA_Offset start, GA_Offset end, GA_Size &size, bool &value) const
static SYS_FORCE_INLINE const GA_ElementGroup * cast(const GA_Group *group)
SYS_FORCE_INLINE void toggleOffset(GA_Offset ai)
virtual bool isOrdered() const final
Returns true if the group is currently ordered.
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:72
virtual bool setArraySize(GA_Offset size)=0
GA_Offset getArraySize() const
#define GA_API
Definition: GA_API.h:12
void toggleEntries()
Toggle membership of all elements.
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
virtual void countMemory(UT_MemoryCounter &counter, bool inclusive) const =0
static SYS_FORCE_INLINE GA_ATIGroupBool * cast(GA_Attribute *attrib)
virtual bool combine(const GA_Group *inputGroup)
virtual int64 getMemoryUsage(bool inclusive) const =0
const UT_StringHolder & getName() const
Definition: GA_Attribute.h:250
bool containsIndex(GA_Index ai) const
GA_Size getGroupEntries() const
SYS_FORCE_INLINE void removeOffset(GA_Offset ai)
virtual void tryCompressAllPages(GA_Offset start_offset=GA_Offset(0), GA_Offset end_offset=GA_INVALID_OFFSET)=0
png_uint_32 i
Definition: png.h:2877
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:211
bool copy(const GA_Range &destrange, const GA_ATIGroupBool &src, const GA_Range &srcrange)
GLsizeiptr size
Definition: glcorearb.h:663
No concurrent writes supported.
Definition: GA_Attribute.h:336
virtual void clear()=0
#define GA_INVALID_OFFSET
Definition: GA_Types.h:654
SYS_FORCE_INLINE void addRange(const GA_Range &it)
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:101
A range of elements in an index-map.
Definition: GA_Range.h:42
#define UT_IF_ASSERT_P(ZZ)
Definition: UT_Assert.h:128
GA_Size GA_Offset
Definition: GA_Types.h:617
bool atEnd() const
Definition: GA_Iterator.h:100
bool fill(const GA_Range &destrange, const GA_ATIGroupBool &src, GA_Offset srci)
long long int64
Definition: SYS_Types.h:106
SYS_FORCE_INLINE void toggleIndex(GA_Index ai)
static SYS_FORCE_INLINE const GA_AttributeType & getType()
virtual bool isOrdered() const =0
GLdouble n
Definition: glcorearb.h:2007
virtual bool needDestruction() const
Methods which can be overridden from GA_Attribute.
bool canContainDuplicates() const
Definition: GA_Range.h:256
virtual bool jsonSaveData(UT_JSONWriter &w, const GA_SaveMap &map) const =0
Save the private group data.
SYS_FORCE_INLINE void addIndex(GA_Index ai)
SYS_FORCE_INLINE void setElement(GA_Offset ai, bool v)
virtual void replace(const GA_Attribute &src)=0
Attribute Interface for merging attribute data between details.
Definition: GA_AIFMerge.h:56
SYS_FORCE_INLINE void setElement(const GA_Range &it, bool v)
NOTE: This cannot be used in parallel on an ordered group.
GLuint GLuint end
Definition: glcorearb.h:474
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
virtual const GA_AIFInterp * getAIFInterp() const
Return the attribute's interpolation interface or NULL.
SYS_FORCE_INLINE void toggleRange(const GA_Range &it)
GLintptr offset
Definition: glcorearb.h:664
virtual bool copy(const GA_Range &destrange, const GA_Attribute &src, const GA_Range &srcrange) final
virtual bool stat(UT_WorkBuffer &info, uint level) const
static SYS_FORCE_INLINE bool isType(const GA_Group *group)
Options during loading.
Definition: GA_LoadMap.h:42
GA_ElementGroup * getAttribute()
Defragmentation of IndexMaps.
Definition: GA_Defragment.h:45
GLuint const GLchar * name
Definition: glcorearb.h:785
bool isEmptyMix() const
Query whether the group is empty of elements, primary or mixed.
SYS_FORCE_INLINE void removeIndex(GA_Index ai)
SYS_FORCE_INLINE TO_T UTverify_cast(FROM_T from)
Definition: UT_Assert.h:175
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:611
virtual void copyNonStorageMetadata(const GA_Attribute *that)
Definition: GA_Attribute.h:694
virtual const GA_AIFCopyData * getAIFCopyData() const
Return the attribute's copy interface or NULL.
const GA_ElementGroup * getGroup() const
unsigned int uint
Definition: SYS_Types.h:39
SYS_FORCE_INLINE GA_DataBitArray & getData()
const GA_AttributeType & getType() const
Definition: GA_Attribute.h:197
virtual const GA_Detail & getDetail() const final
virtual bool copy(const GA_Range &destrange, const GA_Range &srcrange) final
SYS_FORCE_INLINE bool containsOffset(GA_Offset offset) const
SYS_FORCE_INLINE bool isGroupEmpty() const
GLsizei const GLfloat * value
Definition: glcorearb.h:823
GA_AttributeOwner
Definition: GA_Types.h:33
#define UT_ASSERT_MSG_P(ZZ, MM)
Definition: UT_Assert.h:104
bool isOffsetActive(GA_Offset offset) const
Returns true if the specified offset is referenced by an ordered element.
Definition: GA_IndexMap.h:481
const GA_ElementGroupOrder * getOrdered() const
virtual bool jsonLoadData(UT_JSONParser &p, const GA_LoadMap &map)=0
Load the private group data.
GA_ElementGroupOrder * getOrdered()
GA_Detail & getDetail()
const GA_IndexMap & getIndexMap() const
Definition: GA_Attribute.h:198
static SYS_FORCE_INLINE const UT_StringHolder & getTypeName()
GA_ElementGroup GA_ATIGroupBool
virtual bool copy(GA_Offset desti, const GA_Attribute &src, GA_Offset srci) final
SYS_FORCE_INLINE GA_Offset offsetFromIndex(GA_Index ordered_index) const
Definition: GA_IndexMap.h:117
virtual bool fill(const GA_Range &destrange, const GA_Attribute &src, GA_Offset srci) final
bool copy(GA_Offset desti, const GA_ATIGroupBool &src, GA_Offset srci)
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
bool isDetached() const
Definition: GA_Attribute.h:412
virtual void addAll() final
Add all elements to the group.
Container class for all geometry.
Definition: GA_Detail.h:96
virtual void destructElement(GA_Offset offset)
Callback invoked if needsDestruction() returns true.
Attribute Interface class to copy attribute data.
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
GA_GroupMaskType
Definition: GA_Types.h:151
const GA_ElementGroup * getAttribute() const
SYS_FORCE_INLINE void removeRange(const GA_Range &it)
#define const
Definition: zconf.h:214
SYS_FORCE_INLINE bool isEmpty() const
Query whether the group is empty of primary elements.
An array of bits.
virtual bool debugValidateArrayCapacity(GA_Offset sz) const
Debug validation of allocated array size.
virtual GA_Size entriesMix() const final
Will return the total number of elements, primary and mixed.
virtual void hardenAllPages(GA_Offset start_offset=GA_Offset(0), GA_Offset end_offset=GA_INVALID_OFFSET)=0
virtual WriteConcurrence getSupportedWriteConcurrence() const
virtual void defragment(const GA_Defragment &defrag)=0
Generic Attribute Interface class to access an attribute as a tuple.
Definition: GA_AIFTuple.h:32
SYS_FORCE_INLINE void addOffset(GA_Offset ai)
SYS_FORCE_INLINE const GA_DataBitArray & getData() const
Returns the read-only raw bit array.
void invalidateGroupEntries()
static SYS_FORCE_INLINE GA_ElementGroup * cast(GA_Group *group)
virtual const GA_AIFTuple * getAIFTuple() const
Return the attribute's tuple interface or NULL.
SYS_FORCE_INLINE bool contains(GA_Offset offset) const
GLenum src
Definition: glcorearb.h:1792
virtual void reconstructElementBlock(GA_Offset offset, GA_Offset nelements)