HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_AttributeSet.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_AttributeSet.h ( GA Library, C++)
7  *
8  * COMMENTS: A set of attributes.
9  */
10 
11 #pragma once
12 
13 #ifndef __GA_AttributeSet__
14 #define __GA_AttributeSet__
15 
16 #include "GA_API.h"
17 #include "GA_ATINumeric.h"
18 #include "GA_AttributeProxy.h"
19 #include "GA_AttributeDict.h"
20 #include "GA_Defaults.h"
21 #include "GA_ReuseStrategy.h"
22 #include "GA_Types.h"
23 
24 #include <SYS/SYS_Inline.h>
25 #include <SYS/SYS_Types.h>
26 
27 #include "UT/UT_UniquePtr.h"
28 
29 #include <iosfwd>
30 #include <stddef.h>
31 
32 
33 class GA_AIFFileH9;
34 class GA_ATINumeric;
35 class GA_ATITopology;
38 class GA_AttribXlateH9;
39 class GA_Attribute;
40 class GA_AttributeFilter;
41 class GA_AttributeType;
42 class GA_Defragment;
43 class GA_Detail;
44 class GA_ElementGroup;
45 class GA_IndexMap;
46 class GA_LoadMap;
47 class GA_MergeMap;
48 class GA_SaveMap;
49 class GA_Stat;
50 template <typename AIF_TYPE> class GA_AIFDefinition;
51 
52 class UT_IStream;
53 class UT_JSONParser;
54 class UT_JSONWriter;
55 class UT_MemoryCounter;
56 class UT_Options;
57 class UT_StringHolder;
58 class UT_StringRef;
59 class UT_WorkBuffer;
60 template <typename T> class UT_Array;
61 
62 
64 {
65 private:
66  /// Only GA_Detail can create attribute sets because the attributes
67  /// rely on the existense of the detail for index maps and otherwise it
68  /// may be too easy to create a attributes without a detail.
69  friend class GA_Detail;
70  /// Group table requires friendship to be able to reach the
71  /// GA_AttributeDict that it is tightly coupled to.
72  friend class GA_GroupTable;
73  GA_AttributeSet(GA_Detail &detail);
74 
75  GA_AttributeSet(const GA_AttributeSet &set) = delete;
76  GA_AttributeSet &operator=(const GA_AttributeSet &set) = delete;
77 
78 public:
79  ~GA_AttributeSet();
80 
82  {
83  // Used to certify that a name has already been
84  // screened for validity
85  public:
87  };
88 
90  {
91  // Used to certify that a name has already been
92  // screened for validity and collision.
93  public:
95  };
96 
97  // --- Attribute Management ----
98  /// Create a new named attribute for the @c owner with the given @scope
99  ///
100  /// The @c creation_options are used to pass intrinsic properties to the
101  /// attribute. The @c creation_options are not generally stored with the
102  /// attribute itself, but are used to determine the intrinsic behaviour of
103  /// the attribute (i.e. specifying storage types for numeric attributes).
104  ///
105  /// The @c attribute_options are stored on the attribute.
106  ///
107  /// The @c attribtype argument is used to look up the attribute type. Common
108  /// values include @c numeric, @c "string" and @c "indexpair"
109  GA_Attribute *createAttribute(GA_AttributeOwner owner,
110  GA_AttributeScope scope,
111  const UT_StringHolder &name,
112  const UT_Options *creation_args,
113  const GA_AttributeOptions *attribute_options,
114  const UT_StringRef &attribtype,
115  const GA_ReuseStrategy &r = GA_ReuseStrategy());
116  /// Create a detached attribute.
117  GA_AttributeUPtr createDetachedAttribute(
118  GA_AttributeOwner owner,
119  const UT_StringRef &attribtype,
120  const UT_Options *creation_args,
121  const GA_AttributeOptions *attribute_options) const;
122  GA_AttributeUPtr createDetachedAttribute(
123  GA_AttributeOwner owner,
124  const GA_AttributeType &attribtype,
125  const UT_Options *creation_args,
126  const GA_AttributeOptions *attribute_options) const;
127 
128  /// Convenience method to add a public attribute
131  const UT_StringHolder &name,
132  const UT_Options *creation_args,
133  const GA_AttributeOptions *attribute_options,
134  const UT_StringRef &attribtype,
136  {
137  return createAttribute(owner, GA_SCOPE_PUBLIC,
138  name, creation_args,
139  attribute_options, attribtype);
140  }
141 
142  /// Create an attribute that has the same definition as the source.
143  /// @note This will fail for group attributes!
144  /// @{
145  GA_Attribute *cloneAttribute(GA_AttributeOwner owner,
146  const UT_StringHolder &name, namevalidcertificate,
147  const GA_Attribute &src,
148  bool clone_options,
149  GA_DataIdStrategy data_id_strategy
150  = GA_DATA_ID_BUMP,
151  const GA_ReuseStrategy &reuse = GA_ReuseStrategy());
152  GA_Attribute *cloneAttribute(GA_AttributeOwner owner,
153  const UT_StringHolder &name,
154  const GA_Attribute &src,
155  bool clone_options,
156  GA_DataIdStrategy data_id_strategy
157  = GA_DATA_ID_BUMP,
158  const GA_ReuseStrategy &reuse = GA_ReuseStrategy());
159  /// @}
160 
161  /// Create a temporary attribute.
162  /// See @c createAttribute() for details on arguments
163  GA_Attribute *createTempAttribute(GA_AttributeOwner owner,
164  const UT_Options *creation_args,
165  const GA_AttributeOptions *attribute_options,
166  const UT_StringRef &attribtype);
167  GA_Attribute *cloneTempAttribute(GA_AttributeOwner owner,
168  const GA_Attribute &src,
169  bool clone_options);
170  const GA_Attribute *findAttribute(GA_AttributeScope scope,
171  const UT_StringRef &name,
172  const GA_AttributeOwner search_order[],
173  int search_order_size) const;
176  const UT_StringRef &name,
177  const GA_AttributeOwner search_order[],
178  int search_order_size)
179  {
180  return const_cast<GA_Attribute *>(
181  static_cast<const GA_AttributeSet *>
182  (this)->findAttribute(scope, name,
183  search_order,
184  search_order_size));
185  }
188  const GA_AttributeOwner search_order[],
189  int search_order_size) const
190  {
191  return findAttribute(GA_SCOPE_PUBLIC, name,
192  search_order,
193  search_order_size);
194  }
197  const GA_AttributeOwner search_order[],
198  int search_order_size)
199  {
200  return findAttribute(GA_SCOPE_PUBLIC, name,
201  search_order,
202  search_order_size);
203  }
206  GA_AttributeScope scope,
207  const UT_StringRef &name)
208  { return findAttribute(scope, name, &owner, 1); }
211  const UT_StringRef &name)
212  {
213  return findAttribute(GA_SCOPE_PUBLIC, name,
214  &owner, 1);
215  }
218  GA_AttributeScope scope,
219  const UT_StringRef &name) const
220  { return findAttribute(scope, name, &owner, 1); }
223  const UT_StringRef &name) const
224  {
225  return findAttribute(GA_SCOPE_PUBLIC, name,
226  &owner, 1);
227  }
228  void matchAttributes(const GA_AttributeFilter &filter,
229  const GA_AttributeOwner search_order[],
230  int search_order_size,
232  void matchAttributes(const GA_AttributeFilter &filter,
233  const GA_AttributeOwner search_order[],
234  int search_order_size,
235  UT_Array<const GA_Attribute *> &list) const;
237  GA_AttributeOwner owner,
239  { return matchAttributes(filter, &owner,1, list); }
241  GA_AttributeOwner owner,
242  UT_Array<const GA_Attribute *> &list) const
243  { return matchAttributes(filter, &owner,1, list); }
244  bool destroyAttribute(GA_Attribute *attribute);
245  bool destroyAttribute(GA_AttributeOwner owner,
246  GA_AttributeScope scope,
247  const UT_StringRef &name);
250  const UT_StringRef &name)
251  {
252  return destroyAttribute(owner, GA_SCOPE_PUBLIC,
253  name);
254  }
255 
256  bool destroyAttributeIncludingP(GA_Attribute *attribute);
257 
258  int destroyAttributes(GA_AttributeOwner owner,
259  const GA_AttributeFilter &filter);
261  GA_AttributeScope scope,
262  const UT_StringRef &fromName,
263  const UT_StringHolder &toName);
264  /// Rename an attribute to an unused name. Typically used to make fromName
265  /// available for another attribute.
266  ///
267  /// Returns new name on success, NULL on failure.
268  const char *renameAttributeUnspecified(GA_AttributeOwner owner,
269  GA_AttributeScope scope,
270  const UT_StringRef &fromName);
271 
272  // Convenience attribute methods
273  GA_Attribute *createTupleAttribute(GA_AttributeOwner owner,
274  GA_AttributeScope scope,
275  const UT_StringHolder &name,
277  int tuple_size,
278  const GA_Defaults &defaults,
279  const UT_Options *creation_args = NULL,
280  const GA_AttributeOptions *attribute_options = NULL,
281  const GA_ReuseStrategy &r = GA_ReuseStrategy());
284  const UT_StringHolder &name,
285  GA_Storage storage,
286  int tuple_size,
287  const GA_Defaults &defaults,
288  const UT_Options *creation_args = NULL,
289  const GA_AttributeOptions *attribute_options = NULL,
291  {
292  return createTupleAttribute(owner, GA_SCOPE_PUBLIC, name, storage,
293  tuple_size, defaults, creation_args,
294  attribute_options, r);
295  }
296  GA_ATINumericUPtr createDetachedTupleAttribute(
297  GA_AttributeOwner owner,
298  GA_Storage storage,
299  int tuple_size,
300  const GA_Defaults &defaults=GA_Defaults(0.0f),
301  const GA_AttributeOptions *attribute_options=NULL) const;
302  GA_Attribute *createArrayAttribute(GA_AttributeOwner owner,
303  GA_AttributeScope scope,
304  const UT_StringHolder &name,
305  GA_Storage storage,
306  int tuple_size,
307  const UT_Options *creation_args = NULL,
308  const GA_AttributeOptions *attribute_options = NULL,
309  const UT_StringRef &attribtype="arraydata",
310  const GA_ReuseStrategy &r = GA_ReuseStrategy());
311  GA_Attribute *createTempTupleAttribute(GA_AttributeOwner owner,
312  GA_Storage storage,
313  int tuple_size,
314  const GA_Defaults &defaults,
315  const UT_Options *creation_args = NULL,
316  const GA_AttributeOptions *attribute_options = NULL);
317  GA_Attribute *createStringAttribute(GA_AttributeOwner owner,
318  GA_AttributeScope scope,
319  const UT_StringHolder &name,
320  int tuple_size=1,
321  const UT_Options *creation_args = NULL,
322  const GA_AttributeOptions *attribute_options = NULL,
323  const UT_StringRef &attribtype="string",
324  const GA_ReuseStrategy &r = GA_ReuseStrategy());
327  const UT_StringHolder &name,
328  int tuple_size=1,
329  const UT_Options *creation_args = NULL,
330  const GA_AttributeOptions *attribute_options = NULL,
331  const UT_StringRef &attribtype="string",
333  {
334  return createStringAttribute(owner, GA_SCOPE_PUBLIC, name, tuple_size,
335  creation_args, attribute_options, attribtype,
336  r);
337  }
338  GA_Attribute *createTempStringAttribute(GA_AttributeOwner owner,
339  int tuple_size=1);
340  GA_Attribute *createDictAttribute(GA_AttributeOwner owner,
341  GA_AttributeScope scope,
342  const UT_StringHolder &name,
343  int tuple_size=1,
344  const UT_Options *creation_args = NULL,
345  const GA_AttributeOptions *attribute_options = NULL,
346  const UT_StringRef &attribtype="dict",
347  const GA_ReuseStrategy &r = GA_ReuseStrategy());
350  const UT_StringHolder &name,
351  int tuple_size=1,
352  const UT_Options *creation_args = NULL,
353  const GA_AttributeOptions *attribute_options = NULL,
354  const UT_StringRef &attribtype="dict",
356  {
357  return createStringAttribute(owner, GA_SCOPE_PUBLIC, name, tuple_size,
358  creation_args, attribute_options, attribtype,
359  r);
360  }
361  GA_Attribute *createTempDictAttribute(GA_AttributeOwner owner,
362  int tuple_size=1);
365  const UT_StringRef &name)
366  {
367  return findAttribute(GA_ATTRIB_POINT, scope,
368  name);
369  }
372  {
373  return findPointAttribute(GA_SCOPE_PUBLIC,
374  name);
375  }
378  const UT_StringRef &name)
379  {
380  return findAttribute(GA_ATTRIB_VERTEX, scope,
381  name);
382  }
385  {
386  return findVertexAttribute(GA_SCOPE_PUBLIC,
387  name);
388  }
391  const UT_StringRef &name)
392  {
393  return findAttribute(GA_ATTRIB_PRIMITIVE,
394  scope, name);
395  }
398  {
399  return findPrimitiveAttribute(GA_SCOPE_PUBLIC,
400  name);
401  }
404  const UT_StringRef &name)
405  {
406  return findAttribute(GA_ATTRIB_GLOBAL, scope,
407  name);
408  }
411  {
412  return findGlobalAttribute(GA_SCOPE_PUBLIC,
413  name);
414  }
415 
416  /// NOTE: These should ONLY be called by the GA_ElementGroup constructor & destructor.
417  /// @{
418  void registerGroup(GA_ElementGroup &group);
419  void unregisterGroup(GA_ElementGroup &group);
420  /// @}
421 
422  GA_ElementGroup *findGroup(GA_AttributeOwner owner,
423  const UT_StringRef &name);
424  // Convenience group methods
426  { return findGroup(GA_ATTRIB_POINT, name); }
428  { return findGroup(GA_ATTRIB_VERTEX, name); }
430  { return findGroup(GA_ATTRIB_PRIMITIVE, name); }
431 
432  /// Try to compress data pages
433  /// Will try to compress *all* pages overlapping the specified offset
434  /// range.
435  void tryCompressAllPages(GA_AttributeOwner owner,
436  GA_Offset start_offset = GA_Offset(0),
437  GA_Offset end_offset = GA_INVALID_OFFSET);
438 
439  /// Harden data pages
440  /// Will harden *all* pages overlapping the specified offset range.
441  /// Once this is done, multiple threads can write to an attribute in
442  /// parallel at a finer granularity than pages.
443  void hardenAllPages(GA_AttributeOwner owner,
444  GA_Offset start_offset = GA_Offset(0),
445  GA_Offset end_offset = GA_INVALID_OFFSET);
446 
447  /// Bumps all data IDs of attributes of the specified owner.
448  void bumpAllDataIds(GA_AttributeOwner owner);
449 
450  /// Save attribute sets to a JSON stream.
451  /// @section JSON-GA_AttributeSet JSON Schema: GA_AttributeSet
452  ///
453  /// Storage for a set of attributes.
454  ///
455  /// @code
456  /// {
457  /// "name" : "GA_AttributeSet",
458  /// "description" : "Attribute storage",
459  /// "type" : "orderedmap",
460  /// "properties": {
461  /// "vertexattributes": {
462  /// "type" : "array",
463  /// "items" : { "$ref" : "GA_Attribute" } ,
464  /// "description" : "Vertex attributes",
465  /// "optional" : true,
466  /// }
467  /// "pointattributes": {
468  /// "type" : "array",
469  /// "items" : { "$ref" : "GA_Attribute" } ,
470  /// "description" : "Point attributes",
471  /// "optional" : true,
472  /// }
473  /// "primitiveattributes": {
474  /// "type" : "array",
475  /// "items" : { "$ref" : "GA_Attribute" },
476  /// "description" : "Primitive attributes",
477  /// "optional" : true,
478  /// }
479  /// "globalattributes": {
480  /// "type" : "array",
481  /// "items" : { "$ref" : "GA_Attribute" } ,
482  /// "description" : "Global attributes",
483  /// "optional" : true,
484  /// }
485  /// }
486  /// }
487  /// @endcode
488  /// @see @ref JSON_FileFormat, GA_AIFJSON, GA_Attribute
489  bool jsonSave(UT_JSONWriter &w, const GA_SaveMap &s) const;
490 
491  /// Load attribute sets from a JSON stream
492  bool jsonLoad(UT_JSONParser &p, GA_LoadMap &m);
493 
494  /// Stat attribute stats from a JSON stream
495  static bool jsonStat(UT_JSONParser &p, GA_Stat &sbuf);
496 
497  // --- Query methods ----
498  int64 getMemoryUsage(bool inclusive) const;
499 
500  /// Count memory usage using a UT_MemoryCounter in order to count
501  /// shared memory correctly.
502  /// If inclusive is true, the size of this object is counted,
503  /// else only memory owned by this object is counted.
504  /// If this is pointed to by the calling object, inclusive should be true.
505  /// If this is contained in the calling object, inclusive should be false.
506  /// (Its memory was already counted in the size of the calling object.)
507  void countMemory(UT_MemoryCounter &counter, bool inclusive) const;
508 
509 
510  bool loadDictH9(UT_IStream &is,
511  GA_AttributeOwner owner,
512  int tbl_size,
514  &definition,
516  &list,
517  const GA_AttribXlateH9 *xlate);
518  static bool saveDictH9(std::ostream &os, const char *label,
520  &list);
521 
522  /// Get information about attributes
523  bool stat(GA_Stat &stat, uint level) const;
524 
525  // Private to GA_AttributeRefMap methods --------------------
526  GA_Detail *getDetail() const { return myDetail; }
527 
528  // Private to GA_Detail methods ----------------------------------
529  void clearAllAttributes(bool for_deletion); // Called on detail deletion
530  void clearAllAttributes(GA_AttributeOwner owner, bool for_deletion); // Called in replaceWithPoints
531  // Reserve some additional space in a symbol table for batch addition.
532  void reserveNewSymbolTableSpace(GA_AttributeOwner owner,
533  GA_AttributeScope scope,
534  int size);
535  GA_ATITopology *createTopologyAttribute(GA_AttributeOwner owner,
536  const UT_StringHolder &name,
537  GA_AttributeOwner linkowner);
538 
539  /// Raw access to the GA_AttributeDict for a particular owner
542  {
543  UT_ASSERT_P(int(owner) >= 0 && int(owner) < int(GA_ATTRIB_OWNER_N));
544  return myAttributes[owner];
545  }
546 
547  /// Query whether a given string is a valid variable name.
548  static bool isValidName(const char *name,
550 
551  /// @private Function used in GA_Detail::replace to replace all attributes
552  /// If 'skip' is given, we will skip processing any attribute that
553  /// matches it. 'skip' will be called with attributes from the
554  /// destination as well as src geometries.
555  void replace(const GA_AttributeSet &src, GA_AttributeOwner owner,
556  bool replaceindexmap, const GA_AttributeFilter *skip);
557 
558  /// @private Method used by merging to destroy attributes before merging
559  void mergeDestroyDestination(GA_MergeMap &map);
560  /// @private Method used by merging to add attributes during merging
561  void mergeAddDestination(GA_MergeMap &map);
562 
563  /// @private Method used by merging detail attributes
564  void mergeDestroyGlobalDestination(GA_MergeMap &map)
565  { mergeDestroyDestination(GA_ATTRIB_DETAIL, map); }
566  /// @private Method used by merging detail attributes
567  void mergeAddGlobalDestination(GA_MergeMap &map)
568  { mergeAddDestination(GA_ATTRIB_DETAIL, map); }
569 
571  {
572  return myAttributes[owner].begin();
573  }
575  GA_AttributeScope scope) const
576  {
577  return myAttributes[owner].begin(scope);
578  }
580  { return myAttributes[owner].end(); }
582  GA_AttributeScope scope) const
583  { return myAttributes[owner].end(scope); }
584 
585  /// Called by GA_Detail::defragment when defragmenting a particular
586  /// index map. Topology attributes won't be modified; they're
587  /// handled separately.
588  /// NOTE: This bumps all data IDs of attributes whose owner is that of the
589  /// index map being defragmented, including topology attributes.
590  void defragment(const GA_Defragment &defrag);
591 
592  /// By default, data IDs are not generated for new attributes to force
593  /// callers to explicitly opt-in. It is very easy for data IDs to
594  /// become stale in code that is not explicitly notifying modified
595  /// attributes.
596  SYS_DEPRECATED_REPLACE(18.0, "Data Id generation is now always enabled.")
597  void enableDataIdGeneration();
598 
599  /// Query whether generation of data IDs has been enabled.
600  bool isGeneratingDataIds() const
601  { return myGenerateDataIds; }
602 
603 private:
604  /// @private
605  /// Used only by GA_Detail
606  void setNumBuckets(GA_AttributeOwner owner, GA_AttributeScope scope, size_t nbuckets)
607  {
608  myAttributes[owner].setNumBuckets(scope, nbuckets);
609  }
610 
611  void adjustArraySize(GA_AttributeOwner owner, GA_Offset size);
612  /// When a previously deleted element is reallocated, we need to reset the
613  /// attribute data to its default values. The constructElement() assumes
614  /// that there are no current values.
615  void constructElementBlock(GA_AttributeOwner owner, GA_Offset offset, GA_Offset nelements);
616  /// When an element is destroyed, the destructElement() method is called
617  /// so that the attribute data can be cleaned up properly (i.e. string
618  /// references or group data).
619  void destructElement(GA_AttributeOwner owner, GA_Offset offset);
620  void batchDeletion(GA_AttributeOwner owner);
621 
622  /// @private Method to grow arrays prior to merging
623  void mergeGrowData(GA_AttributeOwner owner, GA_MergeMap &map);
624 
625  /// @private Method to copy data from the source to the destination for all
626  /// attribute types.
627  void mergeCopyData(const GA_MergeMap &map);
628 
629  /// @private Method to copy data from source to dest for detail attributes
630  void mergeCopyGlobalData(const GA_MergeMap &map)
631  { mergeCopyData(GA_ATTRIB_DETAIL, map); }
632 
633  /// @private Method to copy data from the source to the destination
634  void mergeCopyData(GA_AttributeOwner owner, const GA_MergeMap &map);
635 
636  void mergeDestroyDestination(GA_AttributeOwner owner,
637  GA_MergeMap &map);
638  void mergeAddDestination(GA_AttributeOwner owner,
639  GA_MergeMap &map);
640 
641  const GA_IndexMap &getIndexMap(GA_AttributeOwner type) const;
642  UT_StringRef makeUniqueName(GA_AttributeOwner owner,
643  GA_AttributeScope scope,
644  UT_WorkBuffer &name_buffer) const;
645  UT_StringRef makeUniqueName(GA_AttributeOwner owner,
646  GA_AttributeScope scope,
647  const char *prefix,
648  UT_WorkBuffer &name_buffer) const;
649 
650  /// This method, unlike createAttribute(), merely allocates the requested
651  /// attribute. The allocated attribute is not registered in our tables
652  /// nor with our detail. Consequently name collisions are ignored, and it
653  /// is up to the caller to resolve any such collisions before registering
654  /// this attribute.
655  GA_Attribute *allocAttribute(GA_AttributeOwner owner,
656  const UT_StringHolder &name,
657  const UT_Options *creation_args,
658  const GA_AttributeOptions *attribute_options,
659  const UT_StringRef &attribtype) const;
660 
661  inline GA_AttributeProxy *findProxy(GA_AttributeOwner owner,
662  GA_AttributeScope scope,
663  const UT_StringRef &name) const
664  {
665  UT_ASSERT_P(owner >= GA_AttributeOwner(0) && owner < GA_ATTRIB_OWNER_N);
666  return myAttributes[owner].findProxy(scope, name);
667  }
668  inline GA_Attribute *find(GA_AttributeOwner owner,
669  GA_AttributeScope scope,
670  const UT_StringRef &name) const
671  {
672  GA_AttributeProxy *p = findProxy(owner, scope, name);
673  return p ? p->getAttribute() : NULL;
674  }
675  void add(GA_AttributeOwner owner, GA_Attribute *atr);
676  void invalidateProxyAndDestroyAttribute( GA_AttributeProxy *proxy);
677  bool destroy(GA_AttributeOwner owner, GA_Attribute *atr);
678  bool destroy(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringRef &name)
679  { return destroy(owner, find(owner, scope, name)); }
680  int destroy(GA_AttributeOwner owner, const GA_AttributeFilter &filter);
681  /// Avoids the safety check on P.
682  bool destroyIncludingP(GA_AttributeOwner owner, GA_Attribute *atr);
683  bool destroyImpl(GA_AttributeOwner owner,
684  GA_Attribute *atr);
685  void clear(GA_AttributeOwner owner, bool for_deletion);
686 
687  template<typename OP,typename FILL_OPT_OP>
688  GA_Attribute *createAttributeImpl(
689  OP &creation_op,
690  FILL_OPT_OP &fill_opt_op,
691  GA_AttributeOwner owner,
692  GA_AttributeScope scope,
693  const UT_StringHolder &name,
694  const UT_Options *create_args,
695  const GA_AttributeOptions *attribute_options,
696  const GA_AttributeType &attribtype,
697  const GA_ReuseStrategy &reuse);
698 
699  GA_Detail *myDetail;
700  GA_AttributeDict myAttributes[GA_ATTRIB_OWNER_N];
701  UT_Array<GA_Attribute *> *myDestructorCache[GA_ATTRIB_OWNER_N];
702  bool myGenerateDataIds : 1;
703  bool myPreferredPrec64 : 1;
704 };
705 
706 #endif
GLdouble s
Definition: glew.h:1390
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:196
SYS_FORCE_INLINE GA_Attribute * findPointAttribute(const UT_StringRef &name)
Specify when and how to reuse an existing attribute.
GLsizeiptr size
Definition: glew.h:1681
GLenum src
Definition: glew.h:2410
SYS_FORCE_INLINE GA_Attribute * findAttribute(GA_AttributeOwner owner, const UT_StringRef &name)
GLuint const GLchar * name
Definition: glew.h:1814
Used to pass options and map offset values during saving.
Definition: GA_SaveMap.h:48
SYS_FORCE_INLINE GA_Attribute * createDictAttribute(GA_AttributeOwner owner, const UT_StringHolder &name, int tuple_size=1, const UT_Options *creation_args=NULL, const GA_AttributeOptions *attribute_options=NULL, const UT_StringRef &attribtype="dict", const GA_ReuseStrategy &r=GA_ReuseStrategy())
SYS_FORCE_INLINE bool destroyAttribute(GA_AttributeOwner owner, const UT_StringRef &name)
GA_AttributeDict::iterator begin(GA_AttributeOwner owner, GA_AttributeScope scope) const
Class which stores the default values for a GA_Attribute.
Definition: GA_Defaults.h:35
void matchAttributes(const GA_AttributeFilter &filter, GA_AttributeOwner owner, UT_Array< const GA_Attribute * > &list) const
void skip(T &in, int n)
Definition: ImfXdr.h:885
GA_DataIdStrategy
Definition: GA_Types.h:208
SYS_FORCE_INLINE const GA_Attribute * findAttribute(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringRef &name) const
GA_AttributeDict::iterator end(GA_AttributeOwner owner, GA_AttributeScope scope) const
The merge map keeps track of information when merging details.
Definition: GA_MergeMap.h:53
GA_AttributeDict::iterator begin(GA_AttributeOwner owner) const
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:76
SYS_FORCE_INLINE GA_Attribute * createAttribute(GA_AttributeOwner owner, const UT_StringHolder &name, const UT_Options *creation_args, const GA_AttributeOptions *attribute_options, const UT_StringRef &attribtype, const GA_ReuseStrategy &r=GA_ReuseStrategy())
Convenience method to add a public attribute.
Class used to map H9 geometry files to a form used by GA.
Definition: GA_AIFFileH9.h:317
const GLdouble * m
Definition: glew.h:9124
#define GA_API
Definition: GA_API.h:12
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:34
Standard user attribute level.
Definition: GA_Types.h:147
SYS_FORCE_INLINE GA_Attribute * findPrimitiveAttribute(const UT_StringRef &name)
GA_ElementGroup * findVertexGroup(const UT_StringRef &name)
#define GA_INVALID_OFFSET
Definition: GA_Types.h:676
A string map of attributes to ease backward compatibility In the GB/GEO/GU library code would often p...
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
GA_Size GA_Offset
Definition: GA_Types.h:639
GA_AttributeScope
Definition: GA_Types.h:141
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glew.h:2981
SYS_FORCE_INLINE GA_Attribute * findPrimitiveAttribute(GA_AttributeScope scope, const UT_StringRef &name)
GA_Detail * getDetail() const
SYS_FORCE_INLINE GA_Attribute * findAttribute(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringRef &name)
GLclampf f
Definition: glew.h:3499
GA_AttributeDict::iterator end(GA_AttributeOwner owner) const
std::string OIIO_API replace(string_view str, string_view pattern, string_view replacement, bool global=false)
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:134
This class holds a reference to an attribute. Such an indirection level allows an easy way to invalid...
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1890
SYS_FORCE_INLINE GA_Attribute * findVertexAttribute(const UT_StringRef &name)
SYS_FORCE_INLINE const GA_Attribute * findAttribute(GA_AttributeOwner owner, const UT_StringRef &name) const
void
Definition: png.h:1083
GA_Attribute * getAttribute()
GA_ElementGroup * findPointGroup(const UT_StringRef &name)
long long int64
Definition: SYS_Types.h:116
Options during loading.
Definition: GA_LoadMap.h:42
Defragmentation of IndexMaps.
Definition: GA_Defragment.h:45
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
SYS_FORCE_INLINE const GA_AttributeDict & getDict(GA_AttributeOwner owner) const
Raw access to the GA_AttributeDict for a particular owner.
UT_UniquePtr< GA_Attribute > GA_AttributeUPtr
Definition: GA_Attribute.h:913
GLuint GLsizei GLsizei GLchar * label
Definition: glew.h:8986
GA_ElementGroup * findPrimitiveGroup(const UT_StringRef &name)
Attribute Interface for file I/O.
Definition: GA_AIFFileH9.h:43
GLfloat GLfloat p
Definition: glew.h:16321
GA_AttributeOwner
Definition: GA_Types.h:33
A map of string to various well defined value types.
Definition: UT_Options.h:84
Class to return information about a GA_Detail.
Definition: GA_Stat.h:50
GLuint counter
Definition: glew.h:2740
SYS_FORCE_INLINE GA_Attribute * findVertexAttribute(GA_AttributeScope scope, const UT_StringRef &name)
Class to allow custom AIF interfaces to be built.
SYS_FORCE_INLINE GA_Attribute * findPointAttribute(GA_AttributeScope scope, const UT_StringRef &name)
FMT_CONSTEXPR bool find(Ptr first, Ptr last, T value, Ptr &out)
Definition: format.h:2104
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
Class used to map the GA attribute into a form for H9 geometry files.
Definition: GA_AIFFileH9.h:261
OIIO_API bool attribute(string_view name, TypeDesc type, const void *val)
SYS_FORCE_INLINE GA_Attribute * findGlobalAttribute(GA_AttributeScope scope, const UT_StringRef &name)
getOption("OpenEXR.storage") storage
Definition: HDK_Image.dox:276
Container class for all geometry.
Definition: GA_Detail.h:95
SYS_FORCE_INLINE GA_Attribute * createStringAttribute(GA_AttributeOwner owner, const UT_StringHolder &name, int tuple_size=1, const UT_Options *creation_args=NULL, const GA_AttributeOptions *attribute_options=NULL, const UT_StringRef &attribtype="string", const GA_ReuseStrategy &r=GA_ReuseStrategy())
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
SYS_FORCE_INLINE GA_Attribute * createTupleAttribute(GA_AttributeOwner owner, const UT_StringHolder &name, GA_Storage storage, int tuple_size, const GA_Defaults &defaults, const UT_Options *creation_args=NULL, const GA_AttributeOptions *attribute_options=NULL, const GA_ReuseStrategy &r=GA_ReuseStrategy())
void matchAttributes(const GA_AttributeFilter &filter, GA_AttributeOwner owner, UT_Array< GA_Attribute * > &list)
void renameAttribute(PointDataTreeT &tree, const Name &oldName, const Name &newName)
Rename an attribute in a VDB tree.
unsigned int uint
Definition: SYS_Types.h:45
GLint level
Definition: glew.h:1252
GA_Storage
Definition: GA_Types.h:49
UT_UniquePtr< GA_ATINumeric > GA_ATINumericUPtr
SYS_FORCE_INLINE GA_Attribute * findAttribute(const UT_StringRef &name, const GA_AttributeOwner search_order[], int search_order_size)
SYS_FORCE_INLINE GA_Attribute * findGlobalAttribute(const UT_StringRef &name)
SYS_FORCE_INLINE const GA_Attribute * findAttribute(const UT_StringRef &name, const GA_AttributeOwner search_order[], int search_order_size) const
SYS_FORCE_INLINE GA_Attribute * findAttribute(GA_AttributeScope scope, const UT_StringRef &name, const GA_AttributeOwner search_order[], int search_order_size)
GLboolean GLuint group
Definition: glew.h:2745
GLintptr offset
Definition: glew.h:1682