7#ifndef PXR_EXEC_VDF_MASKED_ITERATOR_H
8#define PXR_EXEC_VDF_MASKED_ITERATOR_H
17PXR_NAMESPACE_OPEN_SCOPE
42template<
class IteratorType, VdfMaskedIteratorMode mode>
57 template<
typename... Args>
68 return _iterator.operator*();
74 return _iterator.IsAtEnd();
80 _iterator.AdvanceToEnd();
87 return Vdf_GetIteratorIndex(it._iterator);
91 void _AdvanceToIndexWithVisitMask();
94 IteratorType _iterator;
102template<
class IteratorType, VdfMaskedIteratorMode mode>
103template<
typename... Args>
106 _iterator(context,
std::forward<Args>(args)...),
107 _visitMaskIterator(visitMask.begin())
110 if (visitMask.
GetSize() == 0) {
111 _iterator.AdvanceToEnd();
114 _AdvanceToIndexWithVisitMask();
117template<
class IteratorType, VdfMaskedIteratorMode mode>
121 _iterator.operator++();
122 _AdvanceToIndexWithVisitMask();
126template<
class IteratorType, VdfMaskedIteratorMode mode>
141 while (!_iterator.IsAtEnd()) {
143 const VdfMask::iterator::value_type idx(
144 Vdf_GetIteratorIndex(_iterator));
145 if (*_visitMaskIterator < idx) {
146 _visitMaskIterator.AdvanceTo(idx);
149 const VdfMask::iterator::value_type visitIdx = *_visitMaskIterator;
154 if (visitIdx > idx || visitIdx < idx) {
161 if (visitIdx == idx || visitIdx < idx) {
166 _iterator.operator++();
170PXR_NAMESPACE_CLOSE_SCOPE
A context is the parameter bundle passed to callbacks of computations.
Base class for libVdf iterators.
Iterator class used to iterate through the elements of the mask.
A VdfMask is placed on connections to specify the data flowing through them.
size_t GetSize() const
Returns the size of the mask.
An iterator that can be used to refine the given iterator IteratorType to iterate over a given mask b...
bool IsAtEnd() const
Returns true if the iterator is done iterating and false otherwise.
void AdvanceToEnd()
Advance the iterator to the end.
IteratorType::reference reference
The dereference type of this iterator.
VdfMaskedIterator(const VdfContext &context, const VdfMask &visitMask, Args &&... args)
Constructor.
reference operator*() const
Returns reference to current element.
IteratorType::value_type value_type
The value type of this iterator.
VdfMaskedIterator & operator++()
Increment operator to point to the next element.
VdfMaskedIteratorMode
Enum to specify the behavior of VdfMaskedIterator as template parameter.
@ VisitUnset
The elements in the visitMask are skipped (default).
@ VisitSet
Visit the elements in the visitMask instead of skipping them.