7#ifndef PXR_EXEC_VDF_SUBRANGE_VIEW_H
8#define PXR_EXEC_VDF_SUBRANGE_VIEW_H
14#include "pxr/exec/vdf/boxedContainer.h"
20#include "pxr/exec/vdf/vectorSubrangeAccessor.h"
24PXR_NAMESPACE_OPEN_SCOPE
102 bool operator==(
const const_iterator &rhs)
const;
107 return !operator==(rhs);
113 const_iterator &operator++();
138 void _AdvanceSubrange(
unsigned int rangeIndex);
141 bool _SubrangeFromConnectionIndex(
146 bool _SubrangeFromRangeIndex(
156 void _AdvanceToEnd();
162 int _connectionIndex;
165 unsigned int _rangeIndex;
175 const_iterator begin()
const {
176 return const_iterator(*
this, 0);
182 const_iterator end()
const {
183 return const_iterator(*
this, -1);
202 int connectionIndex) :
204 _connectionIndex(connectionIndex),
206 _subrange(_SubrangeAtEnd())
209 if (connectionIndex >= 0) {
217 const const_iterator &rhs)
const
220 _view->_inputName == rhs._view->_inputName &&
221 _connectionIndex == rhs._connectionIndex &&
222 _rangeIndex == rhs._rangeIndex;
230 _AdvanceSubrange(_rangeIndex + 1);
237 unsigned int rangeIndex)
240 const TfToken &inputName = _view->_inputName;
241 const VdfInput *input = _view->_GetNode(context).GetInput(inputName);
244 _rangeIndex = rangeIndex;
247 if (input && _connectionIndex >= 0) {
253 for (; _connectionIndex < numConnections; ++_connectionIndex) {
261 if (mask.
IsAllZeros() || !_view->_IsRequiredInput(context, c)) {
267 const VdfVector *v = _view->_GetInputValue(context, c, mask);
269 if (_SubrangeFromConnectionIndex(context, inputName)) {
278 if (!accessor.IsBoxed()) {
279 if (_SubrangeFromConnectionIndex(context, inputName)) {
288 if (_SubrangeFromRangeIndex(context, inputName, accessor)) {
308 _SubrangeFromConnectionIndex(
312 using Iterator =
typename Subrange::iterator;
317 if (_rangeIndex > 0) {
323 _subrange = Subrange(
324 Iterator(context, inputName, _connectionIndex, 0),
325 Iterator(context, inputName, _connectionIndex + 1, 0));
333 _SubrangeFromRangeIndex(
338 using Iterator =
typename Subrange::iterator;
357 _subrange = Subrange(
358 Iterator(context, inputName, _connectionIndex, boxedRange.begin),
359 Iterator(context, inputName, _connectionIndex, boxedRange.end));
368 using Iterator =
typename Subrange::iterator;
371 Iterator(*_view->_context, _view->_inputName, -1, 0),
372 Iterator(*_view->_context, _view->_inputName, -1, 0));
379 _connectionIndex = -1;
381 _subrange = _SubrangeAtEnd();
384PXR_NAMESPACE_CLOSE_SCOPE
Token for efficient comparison, assignment, and hashing of known strings.
Each range represents a logical group of elements stored in a Vdf_BoxedContainer.
Range GetRange(unsigned int i) const
Returns the range at index i.
unsigned int GetNumRanges() const
Returns the number of individual ranges stored in this container.
A range of data elements as denoted by [ begin, end ) indices.
Specialized vector accessor for read access to boxed containers.
A class that fully represents a connection between two VdfNodes.
const VdfMask & GetMask() const
Returns the mask for this connection.
A context is the parameter bundle passed to callbacks of computations.
Base class for libVdf iterators.
A VdfMask is placed on connections to specify the data flowing through them.
bool IsAllZeros() const
Returns true if this mask has all entries unset.
This class allows for construction of iterable ranges of input values.
std::forward_iterator_tag iterator_category
The STL category of this iterator type.
bool operator!=(const const_iterator &rhs) const
Returns true if this iterator and rhs do not compare equal.
reference operator*() const
Returns a reference to the current subrange of input values.
pointer operator->() const
Returns a pointer to the current subrange of input values.
This class enables iteration over subranges of input values, where each subrange contains values orig...
This class is used to abstract away knowledge of the cache data used for each node.
Vdf_VectorSubrangeAccessor< TYPE > GetSubrangeAccessor() const
Provide read-only access to the boxed subranges held by this vector.