HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
GA_GBMacros.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_GBMacros.h ( GA Library, C++)
7
*
8
* COMMENTS: Macros which emulate the old GB macros
9
*/
10
11
#pragma once
12
13
#ifndef __GA_GBMacros__
14
#define __GA_GBMacros__
15
16
/// @file GA_GBMacros.h
17
/// @brief Create macros which emulate the macros in the obsolete GB library
18
19
/// TODO: The GA_ prefix is necessary while GA needs to coexist with GB. Once
20
/// GB has been entirely replaced, we'll remove the GA_ prefix for source
21
/// compatibility.
22
23
24
#include "
GA_AttributeDict.h
"
25
#include "
GA_BreakpointGroup.h
"
26
#include "
GA_Detail.h
"
27
#include "
GA_GroupTable.h
"
28
#include "
GA_ElementGroupTable.h
"
29
#include "
GA_Iterator.h
"
30
#include "
GA_GBIterators.h
"
31
#include "
GA_EdgeGroup.h
"
32
#include "
GA_Types.h
"
33
34
/// @def GA_FOR_ALL_PRIMITIVES(gdp, prim)
35
/// Iterates over primitives, assigning prim to the current primitive
36
#define GA_FOR_ALL_PRIMITIVES(gdp, prim) \
37
for (GA_Iterator it((gdp)->getPrimitiveRange()); (!it.atEnd() || (prim = nullptr)) && \
38
((prim) = GA_Detail::GB_MACRO_CAST((gdp), (gdp)->getPrimitive(*it))); ++it)
39
40
/// @def GA_FOR_SAFE_PRIMITIVES(gdp, prim, next)
41
/// Iterates over primitives, but primitives may be deleted during the
42
/// iteration.
43
#define GA_FOR_SAFE_PRIMITIVES(gdp, prim, next) \
44
for (GA_GBPrimitiveIterator it(*(gdp), GA_Range::safedeletions()); \
45
(prim=GA_Detail::GB_MACRO_CAST(gdp, it.getPrimitive())) && \
46
((next=GA_Detail::GB_MACRO_CAST(gdp, it.getNextPrimitive())) \
47
|| true); \
48
++it)
49
50
/// @def GA_FOR_MASK_PRIMITIVES(gdp, prim, mask)
51
/// Iterates over primitives, filtering only primitives which match the type
52
/// mask specified. mask can be either GA_PrimCompat::TypeMask or a family
53
/// mask.
54
/// @see GA_Primitive::getTypeId(), GA_Primitive::getFamilyMask(),
55
/// GA_Primitive::getPrimitiveId()
56
#define GA_FOR_MASK_PRIMITIVES(gdp, prim, mask) \
57
for (GA_GBPrimitiveIterator it(*(gdp), mask); \
58
(prim=GA_Detail::GB_MACRO_CAST(gdp, it.getPrimitive())); \
59
++it)
60
61
/// @def GA_FOR_ALL_GROUP_PRIMITIVES(gdp, grp, prim)
62
/// Iterate over all primitives in group. @see GA_RTIElementGroup
63
#define GA_FOR_ALL_GROUP_PRIMITIVES(gdp, grp, prim) \
64
for (GA_Iterator it((gdp)->getPrimitiveRange(grp)); (!it.atEnd() || (prim = nullptr)) && \
65
((prim)=GA_Detail::GB_MACRO_CAST((gdp), (gdp)->getPrimitive(*it))); \
66
++it)
67
68
/// @def GA_FOR_SAFE_GROUP_PRIMITIVES(gdp, grp, prim, next)
69
/// Iterates over primitives in group, but primitives may be deleted during the
70
/// iteration. @see GA_RTIElementGroup
71
#define GA_FOR_SAFE_GROUP_PRIMITIVES(gdp, grp, prim, next) \
72
for (GA_GBPrimitiveIterator it(*(gdp),grp,GA_Range::safedeletions()); \
73
(prim=GA_Detail::GB_MACRO_CAST(gdp, it.getPrimitive())) && \
74
((next=GA_Detail::GB_MACRO_CAST(gdp, it.getNextPrimitive())) \
75
|| true); \
76
++it)
77
78
/// @def GA_FOR_ALL_OPT_GROUP_PRIMITIVES(gdp, grp, prim)
79
/// Iterate over all primitives in group, but the group can be NULL.
80
/// @see GA_RTIElementGroup
81
#define GA_FOR_ALL_OPT_GROUP_PRIMITIVES(gdp,grp,prim) \
82
GA_FOR_ALL_GROUP_PRIMITIVES(gdp,grp,prim)
83
84
85
/// @def GA_FOR_ALL_PTOFF(gdp, ptoff)
86
/// Iterate over all points via offsets.
87
/// WARNING: Because this uses nested loops, "break;" won't work!
88
#define GA_FOR_ALL_PTOFF(gdp, ptoff) \
89
GA_Offset lcl_start, lcl_end; \
90
for (GA_Iterator lcl_it((gdp)->getPointRange()); lcl_it.blockAdvance(lcl_start, lcl_end); ) \
91
for (ptoff = lcl_start; ptoff < lcl_end; ++ptoff)
92
93
/// @def GA_FOR_ALL_GROUP_PTOFF(gdp, grp, ptoff)
94
/// Iterate over all points in a group via point offsets.
95
/// WARNING: Because this uses nested loops, "break;" won't work!
96
#define GA_FOR_ALL_GROUP_PTOFF(gdp, grp, ptoff) \
97
GA_Offset lcl_start, lcl_end; \
98
for (GA_Iterator lcl_it((gdp)->getPointRange(grp)); lcl_it.blockAdvance(lcl_start, lcl_end); ) \
99
for (ptoff = lcl_start; ptoff < lcl_end; ++ptoff)
100
101
/// @def GA_FOR_ALL_VTXOFF(gdp, ptoff)
102
/// Iterate over all vertices via offsets.
103
/// WARNING: Because this uses nested loops, "break;" won't work!
104
#define GA_FOR_ALL_VTXOFF(gdp, ptoff) \
105
GA_Offset lcl_start, lcl_end; \
106
for (GA_Iterator lcl_it((gdp)->getVertexRange()); lcl_it.blockAdvance(lcl_start, lcl_end); ) \
107
for (ptoff = lcl_start; ptoff < lcl_end; ++ptoff)
108
109
/// @def GA_FOR_ALL_GROUP_VTXOFF(gdp, grp, ptoff)
110
/// Iterate over all points in a group via point offsets.
111
/// WARNING: Because this uses nested loops, "break;" won't work!
112
#define GA_FOR_ALL_GROUP_VTXOFF(gdp, grp, ptoff) \
113
GA_Offset lcl_start, lcl_end; \
114
for (GA_Iterator lcl_it((gdp)->getVertexRange(grp)); lcl_it.blockAdvance(lcl_start, lcl_end); ) \
115
for (ptoff = lcl_start; ptoff < lcl_end; ++ptoff)
116
117
/// @def GA_FOR_ALL_PRIMOFF(gdp, ptoff)
118
/// Iterate over all points via offsets.
119
/// WARNING: Because this uses nested loops, "break;" won't work!
120
#define GA_FOR_ALL_PRIMOFF(gdp, ptoff) \
121
GA_Offset lcl_start, lcl_end; \
122
for (GA_Iterator lcl_it((gdp)->getPrimitiveRange()); lcl_it.blockAdvance(lcl_start, lcl_end); ) \
123
for (ptoff = lcl_start; ptoff < lcl_end; ++ptoff)
124
125
/// @def GA_FOR_ALL_GROUP_PRIMOFF(gdp, grp, ptoff)
126
/// Iterate over all points in a group via point offsets.
127
/// WARNING: Because this uses nested loops, "break;" won't work!
128
#define GA_FOR_ALL_GROUP_PRIMOFF(gdp, grp, ptoff) \
129
GA_Offset lcl_start, lcl_end; \
130
for (GA_Iterator lcl_it((gdp)->getPrimitiveRange(grp)); lcl_it.blockAdvance(lcl_start, lcl_end); ) \
131
for (ptoff = lcl_start; ptoff < lcl_end; ++ptoff)
132
133
/// @def GA_FOR_PAIRS_OF_PRIMITIVES(gdp1, prim1, gdp2, prim2)
134
/// Iterate over primitives in both GA_Details in a pairwise fashion.
135
#define GA_FOR_PAIRS_OF_PRIMITIVES(gdp1, prim1, gdp2, prim2) \
136
for (GA_GBPrimitiveIterator it(*(gdp1), NULL, *(gdp2), NULL); \
137
(prim1=GA_Detail::GB_MACRO_CAST(gdp1, it.getPrimitive())) && \
138
(prim2=GA_Detail::GB_MACRO_CAST(gdp2, it.getPrimitive2())); \
139
++it)
140
141
/// @def GA_FOR_PAIRS_OF_GROUP_PRIMITIVES(gdp1, group1, prim1, gdp2, group2, prim2)
142
/// Iterate over points in the specified groups across both GA_Details in a
143
/// pairwise fashion.
144
#define GA_FOR_PAIRS_OF_GROUP_PRIMITIVES(gdp1, grp1, prim1, gdp2, grp2, prim2) \
145
for (GA_GBPrimitiveIterator it(*(gdp1), grp1, *(gdp2), grp2); \
146
(prim1=GA_Detail::GB_MACRO_CAST(gdp1, it.getPrimitive())) && \
147
(prim2=GA_Detail::GB_MACRO_CAST(gdp2, it.getPrimitive2())); \
148
++it)
149
150
/// @def GA_FOR_ALL_GROUP_EDGES(group, edge)
151
/// Iterate over edges in the specified group.
152
#define GA_FOR_ALL_GROUP_EDGES(group, edge) \
153
for (auto it=(group)->begin(); \
154
!it.atEnd() && (edge = &it.getEdge()); \
155
++it)
156
157
/// @def GA_FOR_ALL_GROUP_EDGES_INCL_PRIMS(group, edge, primoff)
158
/// Iterate over edges in the specified group.
159
#define GA_FOR_ALL_GROUP_EDGES_INCL_PRIMS(group, edge, primoff) \
160
for (auto it=(group)->begin(); \
161
!it.atEnd() && (edge = &it.getEdge()) && \
162
(GAisValid(primoff = it.getPrimitive()) || true); \
163
++it)
164
165
/// @def GA_FOR_SAFE_GROUP_EDGES(group, edge)
166
/// Iterate over edges in the specified group. Edges may be deleted during
167
/// traversal.
168
#define GA_FOR_SAFE_GROUP_EDGES(group, edge) \
169
GA_FOR_ALL_GROUP_EDGES(group, edge)
170
171
/// @def GA_FOR_SAFE_GROUP_EDGES_INCL_PRIMS(group, edge)
172
/// Iterate over edges in the specified group. Edges may be deleted during
173
/// traversal.
174
#define GA_FOR_SAFE_GROUP_EDGES_INCL_PRIMS(group, edge, prim) \
175
GA_FOR_ALL_GROUP_EDGES_INCL_PRIMS(group, edge, prim)
176
177
/// @def GA_FOR_ALL_GROUP_BREAKPOINTS(group, bkp)
178
/// Iterate over breakpoints in the specified group.
179
#define GA_FOR_ALL_GROUP_BREAKPOINTS(group, bkp) \
180
for (GA_BreakpointGroup::iterator it=(group)->begin(); \
181
!it.atEnd() && (bkp = &it.getBreakpoint()); \
182
it.advance())
183
184
/// @def GA_FOR_ALL_POINTGROUPS(gdp, group)
185
/// Iterate over all point GA_ElementGroups in an arbitrary order
186
/// @warning It is NOT safe to add or remove point groups during this loop.
187
#define GA_FOR_ALL_POINTGROUPS(gdp, grp) \
188
for (GA_GroupTable::iterator<GA_PointGroup> \
189
__iter = (gdp)->pointGroups().beginTraverse(); \
190
!__iter.atEnd() && \
191
((grp) = __iter.group()); \
192
++__iter)
193
194
/// @def GA_FOR_ALL_POINTGROUPS_SORTED(gdp, group)
195
/// Iterate over all point GA_ElementGroups in alphabetical order
196
/// @warning It is NOT safe to add or remove point groups during this loop.
197
#define GA_FOR_ALL_POINTGROUPS_SORTED(gdp, grp) \
198
for (GA_PointGroupTable::ordered_iterator \
199
__iter = (gdp)->pointGroups().obegin(); \
200
!__iter.atEnd() && \
201
((grp) = *__iter); \
202
++__iter)
203
204
/// @def GA_FOR_ALL_PRIMGROUPS(gdp, group)
205
/// Iterate over all primitive GA_ElementGroups in an arbitrary order
206
/// @warning It is NOT safe to add or remove point groups during this loop.
207
#define GA_FOR_ALL_PRIMGROUPS(gdp, grp) \
208
for (GA_GroupTable::iterator<GA_PrimitiveGroup> \
209
__iter = (gdp)->primitiveGroups().beginTraverse(); \
210
!__iter.atEnd() && \
211
((grp) = __iter.group()); \
212
++__iter)
213
214
/// @def GA_FOR_ALL_PRIMGROUPS_SORTED(gdp, group)
215
/// Iterate over all primitive GA_ElementGroups in alphabetical order
216
/// @warning It is NOT safe to add or remove point groups during this loop.
217
#define GA_FOR_ALL_PRIMGROUPS_SORTED(gdp, grp) \
218
for (GA_PrimitiveGroupTable::ordered_iterator \
219
__iter = (gdp)->primitiveGroups().obegin(); \
220
!__iter.atEnd() && \
221
((grp) = *__iter); \
222
++__iter)
223
224
/// @def GA_FOR_ALL_VERTEXGROUPS(gdp, group)
225
/// Iterate over all vertex GA_ElementGroups in an arbitrary order
226
/// @warning It is NOT safe to add or remove point groups during this loop.
227
#define GA_FOR_ALL_VERTEXGROUPS(gdp, grp) \
228
for (GA_GroupTable::iterator<GA_VertexGroup> \
229
__iter = (gdp)->vertexGroups().beginTraverse(); \
230
!__iter.atEnd() && \
231
((grp) = __iter.group()); \
232
++__iter)
233
234
/// @def GA_FOR_ALL_VERTEXGROUPS_SORTED(gdp, group)
235
/// Iterate over all vertex GA_ElementGroups in alphabetical order
236
/// @warning It is NOT safe to add or remove point groups during this loop.
237
#define GA_FOR_ALL_VERTEXGROUPS_SORTED(gdp, grp) \
238
for (GA_VertexGroupTable::ordered_iterator \
239
__iter = (gdp)->vertexGroups().obegin(); \
240
!__iter.atEnd() && \
241
((grp) = *__iter); \
242
++__iter)
243
244
/// @def GA_FOR_ALL_EDGEGROUPS(gdp, group)
245
/// Iterate over all GA_EdgeGroups in an arbitrary order
246
/// @warning It is NOT safe to add or remove edge groups during this loop.
247
#define GA_FOR_ALL_EDGEGROUPS(gdp, grp) \
248
for (GA_GroupTable::iterator<GA_EdgeGroup> \
249
__iter = (gdp)->edgeGroups().beginTraverse(); \
250
!__iter.atEnd() && \
251
((grp) = __iter.group()); \
252
++__iter)
253
254
/// @def GA_FOR_ALL_EDGEGROUPS_SORTED(gdp, group)
255
/// Iterate over all GA_EdgeGroups in alphabetical order
256
/// @warning It is NOT safe to add or remove edge groups during this loop.
257
#define GA_FOR_ALL_EDGEGROUPS_SORTED(gdp, grp) \
258
for (GA_EdgeGroupTable::ordered_iterator \
259
__iter = (gdp)->edgeGroups().obegin(); \
260
!__iter.atEnd() && \
261
((grp) = *__iter); \
262
++__iter)
263
264
/// @def GA_FOR_ALL_ATTRIBUTES(dict, attribute)
265
/// Iterate over all attributes in a GA_AttributeDict
266
#define GA_FOR_ALL_ATTRIBUTES(dict, A) \
267
for (GA_AttributeDict::iterator it=dict.begin(); \
268
!it.atEnd() && (A = it.attrib()); ++it)
269
270
/// @def GA_FOR_ALL_DETAIL_ATTRIBUTES(gdp, attribute)
271
/// Iterate over all global/detail attributes in the geometry
272
#define GA_FOR_ALL_DETAIL_ATTRIBUTES(gdp, A) \
273
GA_FOR_ALL_ATTRIBUTES((gdp)->getAttributeDict(GA_ATTRIB_GLOBAL), A)
274
275
/// @def GA_FOR_ALL_PRIMITIVE_ATTRIBUTES(gdp, attribute)
276
/// Iterate over all primitive attributes in the geometry
277
#define GA_FOR_ALL_PRIMITIVE_ATTRIBUTES(gdp, A) \
278
GA_FOR_ALL_ATTRIBUTES((gdp)->getAttributeDict(GA_ATTRIB_PRIMITIVE), A)
279
280
/// @def GA_FOR_ALL_POINT_ATTRIBUTES(gdp, attribute)
281
/// Iterate over all point attributes in the geometry
282
#define GA_FOR_ALL_POINT_ATTRIBUTES(gdp, A) \
283
GA_FOR_ALL_ATTRIBUTES((gdp)->getAttributeDict(GA_ATTRIB_POINT), A)
284
285
/// @def GA_FOR_ALL_VERTEX_ATTRIBUTES(gdp, attribute)
286
/// Iterate over all vertex attributes in the geometry
287
#define GA_FOR_ALL_VERTEX_ATTRIBUTES(gdp, A) \
288
GA_FOR_ALL_ATTRIBUTES((gdp)->getAttributeDict(GA_ATTRIB_VERTEX), A)
289
290
#define GA_FOR_ALL_GROUPS(grptable, grp) \
291
for (GA_GroupTable::iterator<GA_ElementGroup> lcl_it = (grptable).beginTraverse(); !lcl_it.atEnd() && ((grp) = lcl_it.group()); ++lcl_it)
292
293
#define GA_FOR_ALL_GROUPS_SORTED(grptable, grp) \
294
for (GA_ElementGroupTable::ordered_iterator lcl_it = (grptable).obegin(); !lcl_it.atEnd() && ((grp) = *lcl_it); ++lcl_it)
295
296
#endif
GA_BreakpointGroup.h
GA_AttributeDict.h
GA_Detail.h
GA_ElementGroupTable.h
GA_EdgeGroup.h
GA_GBIterators.h
Contains iterators to help backward compatibility with GB library. The constructors will initialize t...
GA_GroupTable.h
GA_Types.h
GA_Iterator.h
GA
GA_GBMacros.h
Generated on Thu Nov 7 2024 03:00:38 for HDK by
1.8.6