HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 #include "UT/UT_UniquePtr.h"
24 
25 class GA_Detail;
26 class GA_Primitive;
29 
30 template <GA_AttributeOwner OWNER>
32 
33 class GA_API GA_PointGroup final : public GA_ElementGroup
34 {
35 protected:
37  GA_Detail &detail, const UT_StringHolder &name, bool internal, bool detached)
38  : GA_ElementGroup(detail, GA_ATTRIB_POINT, name, internal, detached)
39  {}
40 public:
41  /// Makes a detached point group
42  GA_PointGroup(const GA_Detail &detail)
44  {}
45 
47  GA_PointGroup &operator|=(const GA_PointGroup &g)
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  }
64  {
65  return static_cast<GA_PointGroup &>(GA_ElementGroup::operator=(g));
66  }
68 
72 };
73 
75 {
76 protected:
78  GA_Detail &detail, const UT_StringHolder &name, bool internal, bool detached)
79  : GA_ElementGroup(detail, GA_ATTRIB_PRIMITIVE, name, internal, detached)
80  {}
81 public:
82  /// Makes a detached primitive group
84  : GA_ElementGroup(detail, GA_ATTRIB_PRIMITIVE)
85  {}
86 
89  {
90  return static_cast<GA_PrimitiveGroup &>(GA_ElementGroup::operator|=(g));
91  }
93  {
94  return static_cast<GA_PrimitiveGroup &>(GA_ElementGroup::operator&=(g));
95  }
97  {
98  return static_cast<GA_PrimitiveGroup &>(GA_ElementGroup::operator-=(g));
99  }
101  {
102  return static_cast<GA_PrimitiveGroup &>(GA_ElementGroup::operator^=(g));
103  }
105  {
106  return static_cast<GA_PrimitiveGroup &>(GA_ElementGroup::operator=(g));
107  }
109 
110  /// @{
111  /// Access elements by a pointer to their GA_Primitive
112  /// NOTE: When using add, toggle, remove in parallel,
113  /// you *must* call invalidateGroupEntries() afterward, else
114  /// entries() may return an incorrect value.
115  /// NOTE: These cannot be used in parallel on an ordered group.
116  void add(const GA_Primitive *prim);
117  void toggle(const GA_Primitive *prim);
118  void remove(const GA_Primitive *prim);
119  /// @}
120 
121  /// @{
122  /// Access elements by a reference to their GA_Primitive
123  /// NOTE: When using add, toggle, remove in parallel,
124  /// you *must* call invalidateGroupEntries() afterward, else
125  /// entries() may return an incorrect value.
126  /// NOTE: These cannot be used in parallel on an ordered group.
127  void add(const GA_Primitive &prim) { add(&prim); }
128  void toggle(const GA_Primitive &prim) { toggle(&prim); }
129  void remove(const GA_Primitive &prim) { remove(&prim); }
130  /// @}
131 
132  /// @{
133  /// Test membership
135  bool contains(const GA_Primitive *prim) const;
136  bool contains(const GA_Primitive &prim) const
137  { return contains(&prim); }
138  /// @}
139 
140  /// Functions for "mixed" entries in primitive groups, i.e. references
141  /// to trim curves or profile curves on NURBS or Bezier surface primitives.
142  /// @{
143  void addMixOffset(GA_Offset primary_prim, const GA_SecondaryLookupInfo *sec);
144  void removeMixOffset(GA_Offset primary_prim, const GA_SecondaryLookupInfo *sec);
145  bool containsMixOffset(GA_Offset primary_prim, const GA_SecondaryLookupInfo *sec) const;
146 
147  void addMix(const GA_Primitive *primary_prim, const GA_SecondaryLookupInfo *sec);
148  void removeMix(const GA_Primitive *primary_prim, const GA_SecondaryLookupInfo *sec);
149  bool containsMix(const GA_Primitive *element, const GA_SecondaryLookupInfo *sec) const;
150 
151  void addMix(const GA_Primitive &primary_prim, const GA_SecondaryLookupInfo *sec)
152  { addMix(&primary_prim, sec); }
153  void removeMix(const GA_Primitive &primary_prim, const GA_SecondaryLookupInfo *sec)
154  { removeMix(&primary_prim, sec); }
155  bool containsMix(const GA_Primitive &element, const GA_SecondaryLookupInfo *sec) const
156  { return containsMix(&element, sec); }
157 
158  void removeAllMix(GA_Offset element,
159  const GA_SecondaryLookupInfo *sec_prefix,
160  const GA_RangeMemberQuery &sec_range_query);
161  /// @}
162 
163  friend class GA_GroupTable;
164  friend class GA_ElementGroupTable;
166 };
167 
169 {
170 protected:
172  GA_Detail &detail, const UT_StringHolder &name, bool internal, bool detached)
173  : GA_ElementGroup(detail, GA_ATTRIB_VERTEX, name, internal, detached)
174  {}
175 public:
176  /// Makes a detached vertex group
177  GA_VertexGroup(const GA_Detail &detail)
179  {}
180 
182  GA_VertexGroup &operator|=(const GA_VertexGroup &g)
183  {
184  return static_cast<GA_VertexGroup &>(GA_ElementGroup::operator|=(g));
185  }
187  {
188  return static_cast<GA_VertexGroup &>(GA_ElementGroup::operator&=(g));
189  }
191  {
192  return static_cast<GA_VertexGroup &>(GA_ElementGroup::operator-=(g));
193  }
195  {
196  return static_cast<GA_VertexGroup &>(GA_ElementGroup::operator^=(g));
197  }
199  {
200  return static_cast<GA_VertexGroup &>(GA_ElementGroup::operator=(g));
201  }
203 
207 };
208 
213 
214 using GA_ConstVertexGroupUPtr = UT_UniquePtr<const GA_VertexGroup>;
215 using GA_ConstPointGroupUPtr = UT_UniquePtr<const GA_PointGroup>;
216 using GA_ConstPrimitiveGroupUPtr = UT_UniquePtr<const GA_PrimitiveGroup>;
217 using GA_ConstElementGroupUPtr = UT_UniquePtr<const GA_ElementGroup>;
218 
219 #endif
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
Definition: thread.h:623
void toggle(const GA_Primitive &prim)
void
Definition: png.h:1083
UT_UniquePtr< GA_VertexGroup > GA_VertexGroupUPtr
#define SYS_DEPRECATED_PUSH_DISABLE()
OIIO_UTIL_API bool remove(string_view path, std::string &err)
#define SYS_DEPRECATED_POP_DISABLE()
GA_PrimitiveGroup & operator^=(const GA_PrimitiveGroup &g)
GLboolean GLboolean g
Definition: glcorearb.h:1222
#define GA_API
Definition: GA_API.h:14
Abstract base class for a range membership query object.
Information necessary to lookup a secondary primitive.
UT_UniquePtr< GA_ElementGroup > GA_ElementGroupUPtr
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
GA_Size GA_Offset
Definition: GA_Types.h:646
UT_UniquePtr< const GA_PointGroup > GA_ConstPointGroupUPtr
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)
UT_UniquePtr< const GA_PrimitiveGroup > GA_ConstPrimitiveGroupUPtr
GA_PrimitiveGroup & operator&=(const GA_PrimitiveGroup &g)
UT_UniquePtr< GA_PrimitiveGroup > GA_PrimitiveGroupUPtr
GA_PrimitiveGroup(const GA_Detail &detail)
Makes a detached primitive group.
GLuint const GLchar * name
Definition: glcorearb.h:786
void add(const GA_Primitive &prim)
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_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
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GA_ElementGroup & operator^=(const GA_ElementGroup &g)
UT_UniquePtr< GA_PointGroup > GA_PointGroupUPtr
GA_PointGroup(const GA_Detail &detail)
Makes a detached point group.
GA_ElementGroup & operator&=(const GA_ElementGroup &g)
UT_UniquePtr< const GA_VertexGroup > GA_ConstVertexGroupUPtr
UT_UniquePtr< const GA_ElementGroup > GA_ConstElementGroupUPtr
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)
SYS_FORCE_INLINE bool contains(GA_Offset offset) const