HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_GBMacros.h File Reference

Create macros which emulate the macros in the obsolete GB library. More...

#include "GA_AttributeDict.h"
#include "GA_BreakpointGroup.h"
#include "GA_Detail.h"
#include "GA_GroupTable.h"
#include "GA_ElementGroupTable.h"
#include "GA_Iterator.h"
#include "GA_GBIterators.h"
#include "GA_EdgeGroup.h"
#include "GA_Types.h"
+ Include dependency graph for GA_GBMacros.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __GA_GBMacros__
 
#define GA_FOR_ALL_PRIMITIVES(gdp, prim)
 
#define GA_FOR_SAFE_PRIMITIVES(gdp, prim, next)
 
#define GA_FOR_MASK_PRIMITIVES(gdp, prim, mask)
 
#define GA_FOR_ALL_GROUP_PRIMITIVES(gdp, grp, prim)
 
#define GA_FOR_SAFE_GROUP_PRIMITIVES(gdp, grp, prim, next)
 
#define GA_FOR_ALL_OPT_GROUP_PRIMITIVES(gdp, grp, prim)   GA_FOR_ALL_GROUP_PRIMITIVES(gdp,grp,prim)
 
#define GA_FOR_ALL_PTOFF(gdp, ptoff)
 
#define GA_FOR_ALL_GROUP_PTOFF(gdp, grp, ptoff)
 
#define GA_FOR_ALL_VTXOFF(gdp, ptoff)
 
#define GA_FOR_ALL_GROUP_VTXOFF(gdp, grp, ptoff)
 
#define GA_FOR_ALL_PRIMOFF(gdp, ptoff)
 
#define GA_FOR_ALL_GROUP_PRIMOFF(gdp, grp, ptoff)
 
#define GA_FOR_PAIRS_OF_PRIMITIVES(gdp1, prim1, gdp2, prim2)
 
#define GA_FOR_PAIRS_OF_GROUP_PRIMITIVES(gdp1, grp1, prim1, gdp2, grp2, prim2)
 
#define GA_FOR_ALL_GROUP_EDGES(group, edge)
 
#define GA_FOR_ALL_GROUP_EDGES_INCL_PRIMS(group, edge, primoff)
 
#define GA_FOR_SAFE_GROUP_EDGES(group, edge)   GA_FOR_ALL_GROUP_EDGES(group, edge)
 
#define GA_FOR_SAFE_GROUP_EDGES_INCL_PRIMS(group, edge, prim)   GA_FOR_ALL_GROUP_EDGES_INCL_PRIMS(group, edge, prim)
 
#define GA_FOR_ALL_GROUP_BREAKPOINTS(group, bkp)
 
#define GA_FOR_ALL_POINTGROUPS(gdp, grp)
 
#define GA_FOR_ALL_POINTGROUPS_SORTED(gdp, grp)
 
#define GA_FOR_ALL_PRIMGROUPS(gdp, grp)
 
#define GA_FOR_ALL_PRIMGROUPS_SORTED(gdp, grp)
 
#define GA_FOR_ALL_VERTEXGROUPS(gdp, grp)
 
#define GA_FOR_ALL_VERTEXGROUPS_SORTED(gdp, grp)
 
#define GA_FOR_ALL_EDGEGROUPS(gdp, grp)
 
#define GA_FOR_ALL_EDGEGROUPS_SORTED(gdp, grp)
 
#define GA_FOR_ALL_ATTRIBUTES(dict, A)
 
#define GA_FOR_ALL_DETAIL_ATTRIBUTES(gdp, A)   GA_FOR_ALL_ATTRIBUTES((gdp)->getAttributeDict(GA_ATTRIB_GLOBAL), A)
 
#define GA_FOR_ALL_PRIMITIVE_ATTRIBUTES(gdp, A)   GA_FOR_ALL_ATTRIBUTES((gdp)->getAttributeDict(GA_ATTRIB_PRIMITIVE), A)
 
#define GA_FOR_ALL_POINT_ATTRIBUTES(gdp, A)   GA_FOR_ALL_ATTRIBUTES((gdp)->getAttributeDict(GA_ATTRIB_POINT), A)
 
#define GA_FOR_ALL_VERTEX_ATTRIBUTES(gdp, A)   GA_FOR_ALL_ATTRIBUTES((gdp)->getAttributeDict(GA_ATTRIB_VERTEX), A)
 
#define GA_FOR_ALL_GROUPS(grptable, grp)   for (GA_GroupTable::iterator<GA_ElementGroup> lcl_it = (grptable).beginTraverse(); !lcl_it.atEnd() && ((grp) = lcl_it.group()); ++lcl_it)
 
#define GA_FOR_ALL_GROUPS_SORTED(grptable, grp)   for (GA_ElementGroupTable::ordered_iterator lcl_it = (grptable).obegin(); !lcl_it.atEnd() && ((grp) = *lcl_it); ++lcl_it)
 

Detailed Description

Create macros which emulate the macros in the obsolete GB library.

Definition in file GA_GBMacros.h.

Macro Definition Documentation

#define __GA_GBMacros__

Definition at line 14 of file GA_GBMacros.h.

#define GA_FOR_ALL_ATTRIBUTES (   dict,
 
)
Value:
for (GA_AttributeDict::iterator it=dict.begin(); \
!it.atEnd() && (A = it.attrib()); ++it)
SYS_FORCE_INLINE bool atEnd() const

Iterate over all attributes in a GA_AttributeDict

Definition at line 266 of file GA_GBMacros.h.

#define GA_FOR_ALL_DETAIL_ATTRIBUTES (   gdp,
 
)    GA_FOR_ALL_ATTRIBUTES((gdp)->getAttributeDict(GA_ATTRIB_GLOBAL), A)

Iterate over all global/detail attributes in the geometry

Definition at line 272 of file GA_GBMacros.h.

#define GA_FOR_ALL_EDGEGROUPS (   gdp,
  grp 
)
Value:
__iter = (gdp)->edgeGroups().beginTraverse(); \
!__iter.atEnd() && \
((grp) = __iter.group()); \
++__iter)
SYS_FORCE_INLINE bool atEnd() const

Iterate over all GA_EdgeGroups in an arbitrary order

Warning
It is NOT safe to add or remove edge groups during this loop.

Definition at line 247 of file GA_GBMacros.h.

#define GA_FOR_ALL_EDGEGROUPS_SORTED (   gdp,
  grp 
)
Value:
__iter = (gdp)->edgeGroups().obegin(); \
!__iter.atEnd() && \
((grp) = *__iter); \
++__iter)
bool atEnd() const
Test if at end of the list.

Iterate over all GA_EdgeGroups in alphabetical order

Warning
It is NOT safe to add or remove edge groups during this loop.

Definition at line 257 of file GA_GBMacros.h.

#define GA_FOR_ALL_GROUP_BREAKPOINTS (   group,
  bkp 
)
Value:
for (GA_BreakpointGroup::iterator it=(group)->begin(); \
!it.atEnd() && (bkp = &it.getBreakpoint()); \
it.advance())
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.
Definition: node.h:558

Iterate over breakpoints in the specified group.

Definition at line 179 of file GA_GBMacros.h.

#define GA_FOR_ALL_GROUP_EDGES (   group,
  edge 
)
Value:
for (auto it=(group)->begin(); \
!it.atEnd() && (edge = &it.getEdge()); \
++it)
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.
Definition: node.h:558

Iterate over edges in the specified group.

Definition at line 152 of file GA_GBMacros.h.

#define GA_FOR_ALL_GROUP_EDGES_INCL_PRIMS (   group,
  edge,
  primoff 
)
Value:
for (auto it=(group)->begin(); \
!it.atEnd() && (edge = &it.getEdge()) && \
(GAisValid(primoff = it.getPrimitive()) || true); \
++it)
SYS_FORCE_INLINE bool GAisValid(GA_Size v)
Definition: GA_Types.h:655
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.
Definition: node.h:558

Iterate over edges in the specified group.

Definition at line 159 of file GA_GBMacros.h.

#define GA_FOR_ALL_GROUP_PRIMITIVES (   gdp,
  grp,
  prim 
)
Value:
for (GA_Iterator it((gdp)->getPrimitiveRange(grp)); (!it.atEnd() || (prim = nullptr)) && \
((prim)=GA_Detail::GB_MACRO_CAST((gdp), (gdp)->getPrimitive(*it))); \
++it)
Iteration over a range of elements.
Definition: GA_Iterator.h:29
static const T::GB_MACRO_PRIM_TYPE * GB_MACRO_CAST(const T *, const GA_Primitive *prim)
Definition: GA_Detail.h:2219

Iterate over all primitives in group.

See Also
GA_RTIElementGroup

Definition at line 63 of file GA_GBMacros.h.

#define GA_FOR_ALL_GROUP_PRIMOFF (   gdp,
  grp,
  ptoff 
)
Value:
GA_Offset lcl_start, lcl_end; \
for (GA_Iterator lcl_it((gdp)->getPrimitiveRange(grp)); lcl_it.blockAdvance(lcl_start, lcl_end); ) \
for (ptoff = lcl_start; ptoff < lcl_end; ++ptoff)
Iteration over a range of elements.
Definition: GA_Iterator.h:29
bool blockAdvance(GA_Offset &start, GA_Offset &end)
GA_Size GA_Offset
Definition: GA_Types.h:646
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))
Definition: UT_RTreeImpl.h:685

Iterate over all points in a group via point offsets. WARNING: Because this uses nested loops, "break;" won't work!

Definition at line 128 of file GA_GBMacros.h.

#define GA_FOR_ALL_GROUP_PTOFF (   gdp,
  grp,
  ptoff 
)
Value:
GA_Offset lcl_start, lcl_end; \
for (GA_Iterator lcl_it((gdp)->getPointRange(grp)); lcl_it.blockAdvance(lcl_start, lcl_end); ) \
for (ptoff = lcl_start; ptoff < lcl_end; ++ptoff)
Iteration over a range of elements.
Definition: GA_Iterator.h:29
bool blockAdvance(GA_Offset &start, GA_Offset &end)
GA_Size GA_Offset
Definition: GA_Types.h:646
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))
Definition: UT_RTreeImpl.h:685

Iterate over all points in a group via point offsets. WARNING: Because this uses nested loops, "break;" won't work!

Examples:
SOP/SOP_CustomBrush.C, SOP/SOP_PointWave.C, and SOP/SOP_TimeCompare.C.

Definition at line 96 of file GA_GBMacros.h.

#define GA_FOR_ALL_GROUP_VTXOFF (   gdp,
  grp,
  ptoff 
)
Value:
GA_Offset lcl_start, lcl_end; \
for (GA_Iterator lcl_it((gdp)->getVertexRange(grp)); lcl_it.blockAdvance(lcl_start, lcl_end); ) \
for (ptoff = lcl_start; ptoff < lcl_end; ++ptoff)
Iteration over a range of elements.
Definition: GA_Iterator.h:29
bool blockAdvance(GA_Offset &start, GA_Offset &end)
GA_Size GA_Offset
Definition: GA_Types.h:646
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))
Definition: UT_RTreeImpl.h:685

Iterate over all points in a group via point offsets. WARNING: Because this uses nested loops, "break;" won't work!

Definition at line 112 of file GA_GBMacros.h.

#define GA_FOR_ALL_GROUPS (   grptable,
  grp 
)    for (GA_GroupTable::iterator<GA_ElementGroup> lcl_it = (grptable).beginTraverse(); !lcl_it.atEnd() && ((grp) = lcl_it.group()); ++lcl_it)

Definition at line 290 of file GA_GBMacros.h.

#define GA_FOR_ALL_GROUPS_SORTED (   grptable,
  grp 
)    for (GA_ElementGroupTable::ordered_iterator lcl_it = (grptable).obegin(); !lcl_it.atEnd() && ((grp) = *lcl_it); ++lcl_it)

Definition at line 293 of file GA_GBMacros.h.

#define GA_FOR_ALL_OPT_GROUP_PRIMITIVES (   gdp,
  grp,
  prim 
)    GA_FOR_ALL_GROUP_PRIMITIVES(gdp,grp,prim)

Iterate over all primitives in group, but the group can be NULL.

See Also
GA_RTIElementGroup

Definition at line 81 of file GA_GBMacros.h.

#define GA_FOR_ALL_POINT_ATTRIBUTES (   gdp,
 
)    GA_FOR_ALL_ATTRIBUTES((gdp)->getAttributeDict(GA_ATTRIB_POINT), A)

Iterate over all point attributes in the geometry

Examples:
SOP/SOP_Flatten.C.

Definition at line 282 of file GA_GBMacros.h.

#define GA_FOR_ALL_POINTGROUPS (   gdp,
  grp 
)
Value:
__iter = (gdp)->pointGroups().beginTraverse(); \
!__iter.atEnd() && \
((grp) = __iter.group()); \
++__iter)
SYS_FORCE_INLINE bool atEnd() const

Iterate over all point GA_ElementGroups in an arbitrary order

Warning
It is NOT safe to add or remove point groups during this loop.

Definition at line 187 of file GA_GBMacros.h.

#define GA_FOR_ALL_POINTGROUPS_SORTED (   gdp,
  grp 
)
Value:
__iter = (gdp)->pointGroups().obegin(); \
!__iter.atEnd() && \
((grp) = *__iter); \
++__iter)
bool atEnd() const
Test if at end of the list.

Iterate over all point GA_ElementGroups in alphabetical order

Warning
It is NOT safe to add or remove point groups during this loop.

Definition at line 197 of file GA_GBMacros.h.

#define GA_FOR_ALL_PRIMGROUPS (   gdp,
  grp 
)
Value:
__iter = (gdp)->primitiveGroups().beginTraverse(); \
!__iter.atEnd() && \
((grp) = __iter.group()); \
++__iter)
SYS_FORCE_INLINE bool atEnd() const

Iterate over all primitive GA_ElementGroups in an arbitrary order

Warning
It is NOT safe to add or remove point groups during this loop.

Definition at line 207 of file GA_GBMacros.h.

#define GA_FOR_ALL_PRIMGROUPS_SORTED (   gdp,
  grp 
)
Value:
__iter = (gdp)->primitiveGroups().obegin(); \
!__iter.atEnd() && \
((grp) = *__iter); \
++__iter)
bool atEnd() const
Test if at end of the list.

Iterate over all primitive GA_ElementGroups in alphabetical order

Warning
It is NOT safe to add or remove point groups during this loop.

Definition at line 217 of file GA_GBMacros.h.

#define GA_FOR_ALL_PRIMITIVE_ATTRIBUTES (   gdp,
 
)    GA_FOR_ALL_ATTRIBUTES((gdp)->getAttributeDict(GA_ATTRIB_PRIMITIVE), A)

Iterate over all primitive attributes in the geometry

Definition at line 277 of file GA_GBMacros.h.

#define GA_FOR_ALL_PRIMITIVES (   gdp,
  prim 
)
Value:
for (GA_Iterator it((gdp)->getPrimitiveRange()); (!it.atEnd() || (prim = nullptr)) && \
((prim) = GA_Detail::GB_MACRO_CAST((gdp), (gdp)->getPrimitive(*it))); ++it)
Iteration over a range of elements.
Definition: GA_Iterator.h:29
static const T::GB_MACRO_PRIM_TYPE * GB_MACRO_CAST(const T *, const GA_Primitive *prim)
Definition: GA_Detail.h:2219

TODO: The GA_ prefix is necessary while GA needs to coexist with GB. Once GB has been entirely replaced, we'll remove the GA_ prefix for source compatibility. Iterates over primitives, assigning prim to the current primitive

Examples:
field3d/f3d_io.C, GEO/GEO_VoxelTranslator.C, SOP/SOP_PrimVOP.C, and standalone/geo2voxel.C.

Definition at line 36 of file GA_GBMacros.h.

#define GA_FOR_ALL_PRIMOFF (   gdp,
  ptoff 
)
Value:
GA_Offset lcl_start, lcl_end; \
for (GA_Iterator lcl_it((gdp)->getPrimitiveRange()); lcl_it.blockAdvance(lcl_start, lcl_end); ) \
for (ptoff = lcl_start; ptoff < lcl_end; ++ptoff)
Iteration over a range of elements.
Definition: GA_Iterator.h:29
bool blockAdvance(GA_Offset &start, GA_Offset &end)
GA_Size GA_Offset
Definition: GA_Types.h:646
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))
Definition: UT_RTreeImpl.h:685

Iterate over all points via offsets. WARNING: Because this uses nested loops, "break;" won't work!

Definition at line 120 of file GA_GBMacros.h.

#define GA_FOR_ALL_PTOFF (   gdp,
  ptoff 
)
Value:
GA_Offset lcl_start, lcl_end; \
for (GA_Iterator lcl_it((gdp)->getPointRange()); lcl_it.blockAdvance(lcl_start, lcl_end); ) \
for (ptoff = lcl_start; ptoff < lcl_end; ++ptoff)
Iteration over a range of elements.
Definition: GA_Iterator.h:29
bool blockAdvance(GA_Offset &start, GA_Offset &end)
GA_Size GA_Offset
Definition: GA_Types.h:646
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))
Definition: UT_RTreeImpl.h:685

Iterate over all points via offsets. WARNING: Because this uses nested loops, "break;" won't work!

Examples:
mocapstream/MocapStreamRokokoHDK.C, RAY/RAY_DemoSprite.C, SIM/SIM_SolverHair.C, SOP/SOP_ArrayAttrib.C, SOP/SOP_CPPWave.C, and SOP/SOP_IKSample.C.

Definition at line 88 of file GA_GBMacros.h.

#define GA_FOR_ALL_VERTEX_ATTRIBUTES (   gdp,
 
)    GA_FOR_ALL_ATTRIBUTES((gdp)->getAttributeDict(GA_ATTRIB_VERTEX), A)

Iterate over all vertex attributes in the geometry

Definition at line 287 of file GA_GBMacros.h.

#define GA_FOR_ALL_VERTEXGROUPS (   gdp,
  grp 
)
Value:
__iter = (gdp)->vertexGroups().beginTraverse(); \
!__iter.atEnd() && \
((grp) = __iter.group()); \
++__iter)
SYS_FORCE_INLINE bool atEnd() const

Iterate over all vertex GA_ElementGroups in an arbitrary order

Warning
It is NOT safe to add or remove point groups during this loop.

Definition at line 227 of file GA_GBMacros.h.

#define GA_FOR_ALL_VERTEXGROUPS_SORTED (   gdp,
  grp 
)
Value:
__iter = (gdp)->vertexGroups().obegin(); \
!__iter.atEnd() && \
((grp) = *__iter); \
++__iter)
bool atEnd() const
Test if at end of the list.

Iterate over all vertex GA_ElementGroups in alphabetical order

Warning
It is NOT safe to add or remove point groups during this loop.

Definition at line 237 of file GA_GBMacros.h.

#define GA_FOR_ALL_VTXOFF (   gdp,
  ptoff 
)
Value:
GA_Offset lcl_start, lcl_end; \
for (GA_Iterator lcl_it((gdp)->getVertexRange()); lcl_it.blockAdvance(lcl_start, lcl_end); ) \
for (ptoff = lcl_start; ptoff < lcl_end; ++ptoff)
Iteration over a range of elements.
Definition: GA_Iterator.h:29
bool blockAdvance(GA_Offset &start, GA_Offset &end)
GA_Size GA_Offset
Definition: GA_Types.h:646
* for(int i=0;i< n_subtasks;++i)*tasks.push(pool-> push(myfunc))
Definition: UT_RTreeImpl.h:685

Iterate over all vertices via offsets. WARNING: Because this uses nested loops, "break;" won't work!

Definition at line 104 of file GA_GBMacros.h.

#define GA_FOR_MASK_PRIMITIVES (   gdp,
  prim,
  mask 
)
Value:
for (GA_GBPrimitiveIterator it(*(gdp), mask); \
(prim=GA_Detail::GB_MACRO_CAST(gdp, it.getPrimitive())); \
++it)
static const T::GB_MACRO_PRIM_TYPE * GB_MACRO_CAST(const T *, const GA_Primitive *prim)
Definition: GA_Detail.h:2219
GLint GLuint mask
Definition: glcorearb.h:124

Iterates over primitives, filtering only primitives which match the type mask specified. mask can be either GA_PrimCompat::TypeMask or a family mask.

See Also
GA_Primitive::getTypeId(), GA_Primitive::getFamilyMask(), GA_Primitive::getPrimitiveId()

Definition at line 56 of file GA_GBMacros.h.

#define GA_FOR_PAIRS_OF_GROUP_PRIMITIVES (   gdp1,
  grp1,
  prim1,
  gdp2,
  grp2,
  prim2 
)
Value:
for (GA_GBPrimitiveIterator it(*(gdp1), grp1, *(gdp2), grp2); \
(prim1=GA_Detail::GB_MACRO_CAST(gdp1, it.getPrimitive())) && \
(prim2=GA_Detail::GB_MACRO_CAST(gdp2, it.getPrimitive2())); \
++it)
static const T::GB_MACRO_PRIM_TYPE * GB_MACRO_CAST(const T *, const GA_Primitive *prim)
Definition: GA_Detail.h:2219

Iterate over points in the specified groups across both GA_Details in a pairwise fashion.

Definition at line 144 of file GA_GBMacros.h.

#define GA_FOR_PAIRS_OF_PRIMITIVES (   gdp1,
  prim1,
  gdp2,
  prim2 
)
Value:
for (GA_GBPrimitiveIterator it(*(gdp1), NULL, *(gdp2), NULL); \
(prim1=GA_Detail::GB_MACRO_CAST(gdp1, it.getPrimitive())) && \
(prim2=GA_Detail::GB_MACRO_CAST(gdp2, it.getPrimitive2())); \
++it)
static const T::GB_MACRO_PRIM_TYPE * GB_MACRO_CAST(const T *, const GA_Primitive *prim)
Definition: GA_Detail.h:2219

Iterate over primitives in both GA_Details in a pairwise fashion.

Definition at line 135 of file GA_GBMacros.h.

#define GA_FOR_SAFE_GROUP_EDGES (   group,
  edge 
)    GA_FOR_ALL_GROUP_EDGES(group, edge)

Iterate over edges in the specified group. Edges may be deleted during traversal.

Definition at line 168 of file GA_GBMacros.h.

#define GA_FOR_SAFE_GROUP_EDGES_INCL_PRIMS (   group,
  edge,
  prim 
)    GA_FOR_ALL_GROUP_EDGES_INCL_PRIMS(group, edge, prim)

Iterate over edges in the specified group. Edges may be deleted during traversal.

Definition at line 174 of file GA_GBMacros.h.

#define GA_FOR_SAFE_GROUP_PRIMITIVES (   gdp,
  grp,
  prim,
  next 
)
Value:
(prim=GA_Detail::GB_MACRO_CAST(gdp, it.getPrimitive())) && \
((next=GA_Detail::GB_MACRO_CAST(gdp, it.getNextPrimitive())) \
|| true); \
++it)
static const T::GB_MACRO_PRIM_TYPE * GB_MACRO_CAST(const T *, const GA_Primitive *prim)
Definition: GA_Detail.h:2219

Iterates over primitives in group, but primitives may be deleted during the iteration.

See Also
GA_RTIElementGroup

Definition at line 71 of file GA_GBMacros.h.

#define GA_FOR_SAFE_PRIMITIVES (   gdp,
  prim,
  next 
)
Value:
(prim=GA_Detail::GB_MACRO_CAST(gdp, it.getPrimitive())) && \
((next=GA_Detail::GB_MACRO_CAST(gdp, it.getNextPrimitive())) \
|| true); \
++it)
static const T::GB_MACRO_PRIM_TYPE * GB_MACRO_CAST(const T *, const GA_Primitive *prim)
Definition: GA_Detail.h:2219

Iterates over primitives, but primitives may be deleted during the iteration.

Definition at line 43 of file GA_GBMacros.h.