HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_Iterator Class Reference

Iteration over a range of elements. More...

#include <GA_Iterator.h>

Public Member Functions

 GA_Iterator ()
 
 GA_Iterator (const GA_Range &range)
 
 GA_Iterator (const GA_Range &range, GA_Range::safedeletions)
 
 GA_Iterator (const GA_Iterator &iterator)
 
 ~GA_Iterator ()
 
bool isValid () const
 Test to see whether the iterator is valid. More...
 
GA_AttributeOwner getOwner () const
 Query the element type that is being iterated over. More...
 
bool blockAdvance (GA_Offset &start, GA_Offset &end)
 
bool fullBlockAdvance (GA_Offset &start, GA_Offset &end)
 
const GA_Iteratoroperator= (const GA_Iterator &src)
 
bool operator== (const GA_Iterator &src) const
 
bool operator!= (const GA_Iterator &src) const
 
GA_Offset getOffset () const
 
GA_Offset operator* () const
 
GA_Index getIndex () const
 
void rewind ()
 
bool atEnd () const
 
void advance ()
 
GA_Iteratoroperator++ ()
 

Detailed Description

Iteration over a range of elements.

An iterator is used to iterate over the elements of a given range. All state information for the iteration is stored by the iterator, external to the range in question. All iterators are constructed rewound, so in most cases there is no need for an explicit rewind() call.

Examples:
packedprim/packedprim.C, SIM/SIM_SolverHair.C, SOP/SOP_BrushHairLen.C, SOP/SOP_Flatten.C, and tetprim/GEO_PrimTetra.C.

Definition at line 29 of file GA_Iterator.h.

Constructor & Destructor Documentation

GA_Iterator::GA_Iterator ( )
GA_Iterator::GA_Iterator ( const GA_Range range)
explicit
GA_Iterator::GA_Iterator ( const GA_Range range,
GA_Range::safedeletions   
)

Ensure safe iteration if elements from the range are deleted during traversal.

GA_Iterator::GA_Iterator ( const GA_Iterator iterator)
GA_Iterator::~GA_Iterator ( )

Member Function Documentation

void GA_Iterator::advance ( )
inline

Standard iterator methods.

Warning
We do not have a post-increment as it would have to be written in a side-effect free way that would cause problmse.
Note
All non-default constructors call rewind() already, so an explicit call is usually not needed.

Definition at line 94 of file GA_Iterator.h.

bool GA_Iterator::atEnd ( ) const
inline

Standard iterator methods.

Warning
We do not have a post-increment as it would have to be written in a side-effect free way that would cause problmse.
Note
All non-default constructors call rewind() already, so an explicit call is usually not needed.
Examples:
packedprim/packedprim.C, and SOP/SOP_BrushHairLen.C.

Definition at line 93 of file GA_Iterator.h.

bool GA_Iterator::blockAdvance ( GA_Offset start,
GA_Offset end 
)

Perform a block iteration. The block iteration will provide a contiguous block of offsets which can be operated upon in batch. Blocks are constrained to occupy a single page, so no block can cross a page boundary. Consequently contiguous sequences that cross page boundaries are automatically split into multiple blocks. The (start, end] range is like Python in that start is included in the range, but end is not. For example:

for (it.rewind(); iterator.blockAdvance(start, end); )
for (; start < end; ++start)
operation(start);
Examples:
SOP/SOP_Flatten.C, and tetprim/GEO_PrimTetra.C.
bool GA_Iterator::fullBlockAdvance ( GA_Offset start,
GA_Offset end 
)

Like blockAdvance, except that the block isn't guaranteed to be all within one page. The block is the maximum contiguous block returned by the GA_Range.

GA_Index GA_Iterator::getIndex ( ) const
inline

Query the ordered index for the current state. Note that this will perform a lookup into the index map, which may not be extremely efficient.

Definition at line 75 of file GA_Iterator.h.

GA_Offset GA_Iterator::getOffset ( ) const
inline

Query state of the iterator

Definition at line 59 of file GA_Iterator.h.

GA_AttributeOwner GA_Iterator::getOwner ( ) const
inline

Query the element type that is being iterated over.

Definition at line 52 of file GA_Iterator.h.

bool GA_Iterator::isValid ( ) const
inline

Test to see whether the iterator is valid.

Definition at line 41 of file GA_Iterator.h.

bool GA_Iterator::operator!= ( const GA_Iterator src) const
inline

Standard operators

Definition at line 47 of file GA_Iterator.h.

GA_Offset GA_Iterator::operator* ( ) const
inline

Query state of the iterator

Definition at line 64 of file GA_Iterator.h.

GA_Iterator& GA_Iterator::operator++ ( )
inline

Standard iterator methods.

Warning
We do not have a post-increment as it would have to be written in a side-effect free way that would cause problmse.
Note
All non-default constructors call rewind() already, so an explicit call is usually not needed.

Definition at line 104 of file GA_Iterator.h.

const GA_Iterator& GA_Iterator::operator= ( const GA_Iterator src)

Standard operators

bool GA_Iterator::operator== ( const GA_Iterator src) const

Standard operators

void GA_Iterator::rewind ( )

Standard iterator methods.

Warning
We do not have a post-increment as it would have to be written in a side-effect free way that would cause problmse.
Note
All non-default constructors call rewind() already, so an explicit call is usually not needed.

The documentation for this class was generated from the following file: