10 #ifndef OPENVDB_POINTS_INDEX_ITERATOR_HAS_BEEN_INCLUDED
11 #define OPENVDB_POINTS_INDEX_ITERATOR_HAS_BEEN_INCLUDED
27 template <
typename IterT>
55 template <
typename LeafT>
58 template <
typename LeafT>
void reset(
const LeafT&) { }
59 template <
typename IterT>
static bool valid(
const IterT&) {
return true; }
80 : mOffset(offset), mParent(prevOffset) {}
82 : mOffset(other.mOffset), mParent(other.mParent), mValid(other.mValid) {}
91 operator bool()
const {
return mValid; }
92 bool test()
const {
return mValid; }
104 OPENVDB_THROW(RuntimeError,
"ValueVoxelCIter does not provide a valid Coord.");
107 OPENVDB_THROW(RuntimeError,
"ValueVoxelCIter does not provide a valid Coord.");
110 OPENVDB_THROW(RuntimeError,
"ValueVoxelCIter does not test if voxel is active.");
122 mutable bool mValid =
true;
138 template <
typename IteratorT,
typename FilterT>
147 : mIter(iter), mParent(&mIter.parent())
153 this->
reset(start, *mIter);
158 : mEnd(other.mEnd), mItem(other.mItem), mIter(other.mIter), mParent(other.mParent)
176 inline operator bool()
const {
return mIter; }
177 inline bool test()
const {
return mIter; }
182 while (mItem >= mEnd && mIter.next()) {
184 this->
reset(mParent->getValue(mIter.offset() - 1), *mIter);
194 inline Coord
getCoord()
const { assert(mIter);
return mIter.getCoord(); }
196 inline void getCoord(Coord& xyz)
const { assert(mIter); xyz = mIter.getCoord(); }
199 inline bool isValueOn()
const { assert(mIter);
return mIter.isValueOn(); }
202 inline const IteratorT&
valueIter()
const {
return mIter; }
212 const typename IteratorT::NodeType* mParent;
216 : mIterator(iterator)
219 if (!mFilter.initialized()) {
221 "Filter needs to be initialized before constructing the iterator.");
224 this->
reset(*mIterator, mIterator.
end());
228 : mIterator(other.mIterator)
229 , mFilter(other.mFilter)
231 if (!mFilter.initialized()) {
233 "Filter needs to be initialized before constructing the iterator.");
238 if (&other !=
this) {
239 mIterator = other.mIterator;
240 mFilter = other.mFilter;
241 if (!mFilter.initialized()) {
243 "Filter needs to be initialized before constructing the iterator.");
253 mIterator.
reset(begin, end);
254 while (mIterator.
test() && !mFilter.template valid<ValueIndexIter>(mIterator)) {
264 operator bool()
const {
return mIterator.
test(); }
271 if (!mIterator.
test() || mFilter.template valid<ValueIndexIter>(mIterator)) {
290 inline const FilterT&
filter()
const {
return mFilter; }
305 ValueIndexIter mIterator;
313 template <
typename IterT>
317 for (IterT newIter(iter); newIter; ++newIter, ++
size) { }
329 #endif // OPENVDB_POINTS_INDEX_ITERATOR_HAS_BEEN_INCLUDED
void reset(Index32 item, Index32 end)
Index32 getValue(unsigned) const
static index::State state(const LeafT &)
GLdouble GLdouble GLint GLint const GLdouble * points
Index32 operator*() const
static bool initialized()
bool operator!=(const ValueIndexIter &other) const
const IteratorT & valueIter() const
Return the const value iterator.
bool next()
Advance to the next (valid) item.
#define OPENVDB_USE_VERSION_NAMESPACE
bool operator!=(const IndexIter &other) const
bool isValueOn() const
Return true if the value iterator is pointing to an active value.
A no-op filter that can be used when iterating over all indices.
void getCoord(Coord &xyz) const
Return in xyz the coordinates of the item to which the value iterator is pointing.
ValueVoxelCIter(Index32 prevOffset, Index32 offset)
Index32 operator*()
Returns the item to which this iterator is currently pointing.
Coord getCoord() const
Return the coordinates of the item to which the value iterator is pointing.
Index32 operator*()
Return the item to which this iterator is currently pointing.
A forward iterator over array indices in a single voxel.
Coord getCoord() const
Return the coordinates of the item to which the value iterator is pointing.
ValueVoxelCIter(const ValueVoxelCIter &other)
ValueIndexIter(const ValueIndexIter &other)
void reset(const LeafT &)
Index32 operator*() const
IndexIter & operator++()
Advance to the next (valid) item (prefix).
static bool valid(const IterT &)
bool operator==(const ValueIndexIter &other) const
Equality operators.
ValueVoxelCIter()=default
A forward iterator over array indices with filtering IteratorT can be either IndexIter or ValueIndexI...
void reset(Index32, Index32)
ValueIndexIter & operator=(const ValueIndexIter &)=default
ValueVoxelCIter & operator++()
Advance to the next (valid) item (prefix).
Index32 operator*() const
void getCoord(Coord &xyz) const
Return in xyz the coordinates of the item to which the value iterator is pointing.
ValueIndexIter(const IteratorT &iter)
Coord getCoord() const
For efficiency, Coord and active state assumed to be readily available when iterating over indices of...
Library and file format version numbers.
IndexIter(const IteratorT &iterator, const FilterT &filter)
const FilterT & filter() const
Return the const filter.
bool operator!=(const ValueVoxelCIter &other) const
Equality operators.
A forward iterator over array indices from a value iterator (such as ValueOnCIter) ...
Index32 operator*()
Returns the item to which this iterator is currently pointing.
IndexIter operator++(int)
Advance to the next (valid) item (postfix).
Index64 iterCount(const IterT &iter)
Count up the number of times the iterator can iterate.
bool next()
Advance to the next (valid) item.
static index::State state()
IndexIter & operator=(const IndexIter &other)
IndexIter(const IndexIter &other)
void reset(Index32 begin, Index32 end)
Reset the begining and end of the iterator.
ValueIndexIter & operator++()
Advance to the next (valid) item (prefix).
bool isValueOn() const
Return true if this iterator is pointing to an active value.
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
bool operator==(const IndexIter &other) const
Equality operators.
#define OPENVDB_THROW(exception, message)
bool operator==(const ValueVoxelCIter &other) const
Equality operators.
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.