10 #ifndef OPENVDB_POINTS_INDEX_ITERATOR_HAS_BEEN_INCLUDED
11 #define OPENVDB_POINTS_INDEX_ITERATOR_HAS_BEEN_INCLUDED
28 template <
typename IterT>
56 template <
typename LeafT>
59 template <
typename LeafT>
void reset(
const LeafT&) { }
60 template <
typename IterT>
static bool valid(
const IterT&) {
return true; }
81 : mOffset(offset), mParent(prevOffset) {}
83 : mOffset(other.mOffset), mParent(other.mParent), mValid(other.mValid) {}
92 operator bool()
const {
return mValid; }
93 bool test()
const {
return mValid; }
105 OPENVDB_THROW(RuntimeError,
"ValueVoxelCIter does not provide a valid Coord.");
108 OPENVDB_THROW(RuntimeError,
"ValueVoxelCIter does not provide a valid Coord.");
111 OPENVDB_THROW(RuntimeError,
"ValueVoxelCIter does not test if voxel is active.");
123 mutable bool mValid =
true;
139 template <
typename IteratorT,
typename FilterT>
148 : mIter(iter), mParent(&mIter.parent())
154 this->
reset(start, *mIter);
159 : mEnd(other.mEnd), mItem(other.mItem), mIter(other.mIter), mParent(other.mParent)
177 inline operator bool()
const {
return mIter; }
178 inline bool test()
const {
return mIter; }
183 while (mItem >= mEnd && mIter.next()) {
185 this->
reset(mParent->getValue(mIter.offset() - 1), *mIter);
203 inline const IteratorT&
valueIter()
const {
return mIter; }
213 const typename IteratorT::NodeType* mParent;
217 : mIterator(iterator)
220 if (!mFilter.initialized()) {
222 "Filter needs to be initialized before constructing the iterator.");
225 this->
reset(*mIterator, mIterator.
end());
229 : mIterator(other.mIterator)
230 , mFilter(other.mFilter)
232 if (!mFilter.initialized()) {
234 "Filter needs to be initialized before constructing the iterator.");
239 if (&other !=
this) {
240 mIterator = other.mIterator;
241 mFilter = other.mFilter;
242 if (!mFilter.initialized()) {
244 "Filter needs to be initialized before constructing the iterator.");
254 mIterator.
reset(begin, end);
255 while (mIterator.
test() && !mFilter.template valid<ValueIndexIter>(mIterator)) {
272 if (!mIterator.
test() || mFilter.template valid<ValueIndexIter>(mIterator)) {
291 inline const FilterT&
filter()
const {
return mFilter; }
306 ValueIndexIter mIterator;
314 template <
typename IterT>
318 for (IterT newIter(iter); newIter; ++newIter, ++
size) { }
330 #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.
#define OPENVDB_ASSERT(X)
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.