HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GA_EdgeGroupTable.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_EdgeGroupTable.h (GA Library, C++)
7  *
8  * COMMENTS: A table for managing GA_EdgeGroup objects.
9  *
10  */
11 
12 #ifndef __GA_EdgeGroupTable_h__
13 #define __GA_EdgeGroupTable_h__
14 
15 #include "GA_API.h"
16 #include "GA_EdgeGroup.h"
17 #include "GA_GroupTable.h"
18 #include "GA_Types.h"
19 
20 #include <UT/UT_OrderedIterator.h>
21 
22 
23 class GA_Detail;
24 class GA_Defragment;
25 class GA_Group;
26 class GA_MergeMap;
27 class GA_Range;
28 
29 class UT_JSONParser;
30 template <typename T> class UT_Array;
31 
32 
34 {
35 public:
37 
39  virtual ~GA_EdgeGroupTable();
40 
41  void getList(UT_Array<const GA_EdgeGroup *> &list) const;
42  void getList(UT_Array<GA_EdgeGroup *> &list) const;
43 
44  /// @{
45  /// Traverse the group table in creation order.
46  ///
47  /// @warning It is NOT safe to add or remove groups during traversal.
49  { return begin<GA_EdgeGroup>(); }
51  { return end<GA_EdgeGroup>(); }
52  /// @}
53 
54  /// @{
55  /// Traverse the group table in alpabetic order.
56  static int compareAlpha(GA_EdgeGroup *const*a, GA_EdgeGroup *const*b)
57  { return compareGroupName(**a, **b); }
58 
62  {
64  return ordered_iterator(it, compareAlpha);
65  }
67  { return ordered_iterator(); }
68  /// @}
69 
70  void mergeTable(const GA_EdgeGroupTable &src,GA_MergeMap &map);
71 
72  void mergeEdgeGroups(const GA_MergeMap &map);
73 
74  void removePointsFromGroups(const GA_Range &range);
75  void removePointFromGroups(const GA_Offset ptoff);
76  void removePrimsFromGroups(const GA_Range &range);
77  void removePrimFromGroups(const GA_Offset primoff);
78 
79  /// Called by GA_Detail::defragment to update point offsets
80  /// in edge groups when the point index map is being defragmented.
81  /// It's also called there for the primitive index map, in case
82  /// edge groups ever switch to using primitive offsets, instead of
83  /// primitive pointers.
84  /// NOTE: This will bump data IDs of any modified edge groups.
85  void defragment(const GA_Detail *gdp,const GA_Defragment &defrag);
86 
87  GA_Size destroyEmptyGroups();
88 
89  void bumpAllDataIds();
90 
91  void makeAllEdgesValid();
92 
93 protected:
94  /// Method to create an edge group
95  /// @see GA_GroupTable::jsonLoad()
96  virtual GA_Group *jsonCreateGroup(UT_JSONParser &p, const char *type,
97  const char *name, bool internal,
98  GA_AttributeOwner owner);
99 
101  GA_Detail &detail,
102  const UT_StringHolder &name,
103  bool internal) const
104  {
105  return new GA_EdgeGroup(detail, name, internal, false);
106  }
107 
109  const GA_Detail &detail) const
110  {
111  return new GA_EdgeGroup(detail);
112  }
113 };
114 
115 #endif
GA_GroupTable::iterator< GA_Group > beginTraverse() const
GLenum GLint * range
Definition: glcorearb.h:1924
The merge map keeps track of information when merging details.
Definition: GA_MergeMap.h:53
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:72
ordered_iterator oend() const
#define GA_API
Definition: GA_API.h:12
virtual GA_Group * jsonCreateGroup(UT_JSONParser &p, const char *type, const char *name, bool internal, GA_AttributeOwner owner)=0
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:211
GA_GroupTable::iterator< GA_EdgeGroup > beginTraverse() const
A range of elements in an index-map.
Definition: GA_Range.h:42
GA_GroupTable::iterator< GA_EdgeGroup > iterator
ordered_iterator obegin() const
GA_Size GA_Offset
Definition: GA_Types.h:617
static int compareAlpha(GA_EdgeGroup *const *a, GA_EdgeGroup *const *b)
GLuint GLuint end
Definition: glcorearb.h:474
Defragmentation of IndexMaps.
Definition: GA_Defragment.h:45
UT_OrderedIterator< GA_EdgeGroup *, GA_GroupTable::iterator< GA_EdgeGroup > > ordered_iterator
GLuint const GLchar * name
Definition: glcorearb.h:785
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
virtual GA_Group * virtualCreateGroup(GA_Detail &detail, const UT_StringHolder &name, bool internal) const
virtual GA_Group * virtualCreateDetachedGroup(const GA_Detail &detail) const
GA_AttributeOwner
Definition: GA_Types.h:33
static int compareGroupName(const GA_Group &a, const GA_Group &b)
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
Container class for all geometry.
Definition: GA_Detail.h:96
UT_OrderedIterator< GA_Group *, GA_GroupTable::iterator< GA_Group > > ordered_iterator
GLenum src
Definition: glcorearb.h:1792
GA_GroupTable::iterator< GA_EdgeGroup > endTraverse() const