HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GA_ElementGroup.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_ElementGroup.h (GA Library, C++)
7  *
8  * COMMENTS: GA_ElementGroup is actually defined in GA_ATIGroupBool.h,
9  * now that GA_ElementGroup and GA_ATIGroupBool are the same class.
10  * This contains subclasses for different owners.
11  */
12 
13 #pragma once
14 
15 #ifndef __GA_ElementGroup__
16 #define __GA_ElementGroup__
17 
18 #include "GA_API.h"
19 
20 #include "GA_ATIGroupBool.h"
21 #include "GA_Types.h"
22 
23 class GA_Detail;
24 class GA_Primitive;
27 
28 template <GA_AttributeOwner OWNER>
30 
31 class GA_API GA_PointGroup final : public GA_ElementGroup
32 {
33 protected:
35  GA_Detail &detail, const UT_StringHolder &name, bool internal, bool detached)
36  : GA_ElementGroup(detail, GA_ATTRIB_POINT, name, internal, detached)
37  {}
38 public:
39  /// Makes a detached point group
40  GA_PointGroup(const GA_Detail &detail)
42  {}
44  {
45  return static_cast<GA_PointGroup &>(GA_ElementGroup::operator|=(g));
46  }
48  {
49  return static_cast<GA_PointGroup &>(GA_ElementGroup::operator&=(g));
50  }
52  {
53  return static_cast<GA_PointGroup &>(GA_ElementGroup::operator-=(g));
54  }
56  {
57  return static_cast<GA_PointGroup &>(GA_ElementGroup::operator^=(g));
58  }
60  {
61  return static_cast<GA_PointGroup &>(GA_ElementGroup::operator=(g));
62  }
63 
64  friend class GA_GroupTable;
65  friend class GA_ElementGroupTable;
67 };
68 
70 {
71 protected:
73  GA_Detail &detail, const UT_StringHolder &name, bool internal, bool detached)
74  : GA_ElementGroup(detail, GA_ATTRIB_PRIMITIVE, name, internal, detached)
75  {}
76 public:
77  /// Makes a detached primitive group
80  {}
82  {
83  return static_cast<GA_PrimitiveGroup &>(GA_ElementGroup::operator|=(g));
84  }
86  {
87  return static_cast<GA_PrimitiveGroup &>(GA_ElementGroup::operator&=(g));
88  }
90  {
91  return static_cast<GA_PrimitiveGroup &>(GA_ElementGroup::operator-=(g));
92  }
94  {
95  return static_cast<GA_PrimitiveGroup &>(GA_ElementGroup::operator^=(g));
96  }
98  {
99  return static_cast<GA_PrimitiveGroup &>(GA_ElementGroup::operator=(g));
100  }
101 
102  /// @{
103  /// Access elements by a pointer to their GA_Primitive
104  /// NOTE: When using add, toggle, remove in parallel,
105  /// you *must* call invalidateGroupEntries() afterward, else
106  /// entries() may return an incorrect value.
107  /// NOTE: These cannot be used in parallel on an ordered group.
108  void add(const GA_Primitive *prim);
109  void toggle(const GA_Primitive *prim);
110  void remove(const GA_Primitive *prim);
111  /// @}
112 
113  /// @{
114  /// Access elements by a reference to their GA_Primitive
115  /// NOTE: When using add, toggle, remove in parallel,
116  /// you *must* call invalidateGroupEntries() afterward, else
117  /// entries() may return an incorrect value.
118  /// NOTE: These cannot be used in parallel on an ordered group.
119  void add(const GA_Primitive &prim) { add(&prim); }
120  void toggle(const GA_Primitive &prim) { toggle(&prim); }
121  void remove(const GA_Primitive &prim) { remove(&prim); }
122  /// @}
123 
124  /// @{
125  /// Test membership
127  bool contains(const GA_Primitive *prim) const;
128  bool contains(const GA_Primitive &prim) const
129  { return contains(&prim); }
130  /// @}
131 
132  /// Functions for "mixed" entries in primitive groups, i.e. references
133  /// to trim curves or profile curves on NURBS or Bezier surface primitives.
134  /// @{
135  void addMixOffset(GA_Offset primary_prim, const GA_SecondaryLookupInfo *sec);
136  void removeMixOffset(GA_Offset primary_prim, const GA_SecondaryLookupInfo *sec);
137  bool containsMixOffset(GA_Offset primary_prim, const GA_SecondaryLookupInfo *sec) const;
138 
139  void addMix(const GA_Primitive *primary_prim, const GA_SecondaryLookupInfo *sec);
140  void removeMix(const GA_Primitive *primary_prim, const GA_SecondaryLookupInfo *sec);
141  bool containsMix(const GA_Primitive *element, const GA_SecondaryLookupInfo *sec) const;
142 
143  void addMix(const GA_Primitive &primary_prim, const GA_SecondaryLookupInfo *sec)
144  { addMix(&primary_prim, sec); }
145  void removeMix(const GA_Primitive &primary_prim, const GA_SecondaryLookupInfo *sec)
146  { removeMix(&primary_prim, sec); }
147  bool containsMix(const GA_Primitive &element, const GA_SecondaryLookupInfo *sec) const
148  { return containsMix(&element, sec); }
149 
150  void removeAllMix(GA_Offset element,
151  const GA_SecondaryLookupInfo *sec_prefix,
152  const GA_RangeMemberQuery &sec_range_query);
153  /// @}
154 
155  friend class GA_GroupTable;
156  friend class GA_ElementGroupTable;
158 };
159 
161 {
162 protected:
164  GA_Detail &detail, const UT_StringHolder &name, bool internal, bool detached)
165  : GA_ElementGroup(detail, GA_ATTRIB_VERTEX, name, internal, detached)
166  {}
167 public:
168  /// Makes a detached vertex group
169  GA_VertexGroup(const GA_Detail &detail)
171  {}
173  {
174  return static_cast<GA_VertexGroup &>(GA_ElementGroup::operator|=(g));
175  }
177  {
178  return static_cast<GA_VertexGroup &>(GA_ElementGroup::operator&=(g));
179  }
181  {
182  return static_cast<GA_VertexGroup &>(GA_ElementGroup::operator-=(g));
183  }
185  {
186  return static_cast<GA_VertexGroup &>(GA_ElementGroup::operator^=(g));
187  }
189  {
190  return static_cast<GA_VertexGroup &>(GA_ElementGroup::operator=(g));
191  }
192  friend class GA_GroupTable;
193  friend class GA_ElementGroupTable;
195 };
196 
197 #endif
void toggle(const GA_Primitive &prim)
GA_PrimitiveGroup & operator^=(const GA_PrimitiveGroup &g)
GLboolean GLboolean g
Definition: glcorearb.h:1221
GA_PrimitiveGroup & operator|=(const GA_PrimitiveGroup &g)
#define GA_API
Definition: GA_API.h:12
Abstract base class for a range membership query object.
Information necessary to lookup a secondary primitive.
GA_Size GA_Offset
Definition: GA_Types.h:617
void removeMix(const GA_Primitive &primary_prim, const GA_SecondaryLookupInfo *sec)
bool contains(const GA_Primitive &prim) const
GA_PrimitiveGroup & operator-=(const GA_PrimitiveGroup &g)
GA_VertexGroup(const GA_Detail &detail)
Makes a detached vertex group.
GA_PointGroup & operator^=(const GA_PointGroup &g)
GA_PrimitiveGroup & operator&=(const GA_PrimitiveGroup &g)
GA_PrimitiveGroup(const GA_Detail &detail)
Makes a detached primitive group.
void add(const GA_Primitive &prim)
GLuint const GLchar * name
Definition: glcorearb.h:785
OWNER must be one of GA_ATTRIB_POINT, GA_ATTRIB_PRIMITIVE, GA_ATTRIB_VERTEX.
void addMix(const GA_Primitive &primary_prim, const GA_SecondaryLookupInfo *sec)
GA_PointGroup & operator-=(const GA_PointGroup &g)
bool containsMix(const GA_Primitive &element, const GA_SecondaryLookupInfo *sec) const
GA_VertexGroup & operator-=(const GA_VertexGroup &g)
GA_VertexGroup & operator|=(const GA_VertexGroup &g)
GA_PrimitiveGroup(GA_Detail &detail, const UT_StringHolder &name, bool internal, bool detached)
GA_ElementGroup & operator-=(const GA_ElementGroup &g)
GA_ElementGroup & operator|=(const GA_ElementGroup &g)
GA_VertexGroup & operator^=(const GA_VertexGroup &g)
GA_PointGroup(GA_Detail &detail, const UT_StringHolder &name, bool internal, bool detached)
Container class for all geometry.
Definition: GA_Detail.h:96
GA_ElementGroup & operator^=(const GA_ElementGroup &g)
GA_PointGroup(const GA_Detail &detail)
Makes a detached point group.
GA_ElementGroup & operator&=(const GA_ElementGroup &g)
GA_PointGroup & operator&=(const GA_PointGroup &g)
GA_VertexGroup & operator&=(const GA_VertexGroup &g)
GA_VertexGroup(GA_Detail &detail, const UT_StringHolder &name, bool internal, bool detached)
GA_ElementGroup & operator=(const GA_ElementGroup &g)
GA_PointGroup & operator|=(const GA_PointGroup &g)
SYS_FORCE_INLINE bool contains(GA_Offset offset) const