7#ifndef PXR_EXEC_VDF_READ_ITERATOR_H
8#define PXR_EXEC_VDF_READ_ITERATOR_H
24PXR_NAMESPACE_OPEN_SCOPE
96 return _connectionIndex == -1;
119 unsigned int boxedIndex);
123 return *it._iterator + it._boxedIndex;
129 (*it._input)[it._connectionIndex].GetSourceOutput());
136 bool _SetCurrentConnection(
int connectionIndex);
142 bool _SetCurrentBoxedIndex(
unsigned int boxedIndex);
151 bool _AdvanceConnection(
int connectionIndex);
161 int _connectionIndex;
164 unsigned int _boxedIndex;
181 _input(_GetNode(context).GetInput(inputName)),
182 _connectionIndex(-1),
193 if (!_AdvanceConnection(-1)) {
203 unsigned int boxedIndex) :
205 _input(_GetNode(context).GetInput(inputName)),
206 _connectionIndex(-1),
212 connectionIndex < 0 ||
220 if (!_AdvanceConnection(connectionIndex - 1) ||
221 !_SetCurrentBoxedIndex(boxedIndex)) {
231 _input == rhs._input &&
232 _connectionIndex == rhs._connectionIndex &&
233 _boxedIndex == rhs._boxedIndex &&
234 _iterator == rhs._iterator;
259 const size_t idx = *_iterator + _boxedIndex;
262 return &_accessor[idx];
270 if (!_input || _input->GetNumConnections() == 0) {
275 if (_input->GetNumConnections() == 1 && _accessor.IsBoxed()) {
276 return _accessor.GetNumValues();
281 for (
const VdfConnection *connection : _input->GetConnections()) {
286 const VdfMask &mask = connection->GetMask();
291 if (_IsRequiredInput(*_context, *connection)) {
294 _GetInputValue(*_context, *connection, mask)) {
296 v->template GetReadAccessor<T>();
317 _connectionIndex = -1;
326 const VdfConnection &connection = (*_input)[connectionIndex];
330 _connectionIndex = connectionIndex;
332 _iterator = mask.
begin();
339 if (!_IsRequiredInput(*_context, connection)) {
344 const VdfVector *data = _GetInputValue(*_context, connection, mask);
351 if (!_accessor.GetNumValues()) {
356 return !_iterator.IsAtEnd();
365 if (boxedIndex >= _accessor.GetNumValues()) {
366 return _AdvanceConnection(_connectionIndex);
370 _boxedIndex = boxedIndex;
382 if (_accessor.IsBoxed()) {
387 if (_boxedIndex >= _accessor.GetNumValues()) {
388 return _AdvanceConnection(_connectionIndex);
398 if (_iterator.IsAtEnd()) {
399 return _AdvanceConnection(_connectionIndex);
413 const int numConnections = _input->GetNumConnections();
414 for (
int i = connectionIndex + 1; i < numConnections; ++i) {
418 if (_SetCurrentConnection(i)) {
426PXR_NAMESPACE_CLOSE_SCOPE
Low-level utilities for informing users of various internal and external diagnostic conditions.
Token for efficient comparison, assignment, and hashing of known strings.
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.
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.
iterator begin() const
Returns an iterator that can be used to iterate through the elements of the mask.
bool IsAllOnes() const
Returns true if this mask has all entries set.
size_t GetNumSet() const
Returns the number of set bits in the mask.
An iterator that provides read access to input values using a context.
int difference_type
The type used to identify distance between instances of this iterator.
VdfReadIterator & operator++()
Increment operator to point to the next element.
const T value_type
Type of the elements this iterator gives access to.
VdfReadIterator(const VdfContext &context, const TfToken &inputName)
Constructs a read iterator.
bool operator!=(const VdfReadIterator &rhs) const
Returns true if this iterator and rhs do not compare equal.
bool IsAtEnd() const
Returns true if the iterator is done iterating and false otherwise.
void AdvanceToEnd()
Advance the iterator to the end.
std::forward_iterator_tag iterator_category
The STL category of this iterator type.
value_type * pointer
Type of a pointer to a value of this iterator.
bool operator==(const VdfReadIterator &rhs) const
Returns true if this iterator and rhs compare equal.
size_t ComputeSize() const
Returns the total number of data elements that will be iterated over.
value_type & reference
Type of a reference to a value of this iterator.
pointer operator->() const
Returns pointer to current element.
reference operator*() const
Returns reference to current element.
This class enables iteration over subranges of input values, where each subrange contains values orig...
A read-only accessor for low-level acces to the contents of the VdfVector.
size_t GetNumValues() const
Returns the size of the vector, i.e.
This class is used to abstract away knowledge of the cache data used for each node.
ReadAccessor< TYPE > GetReadAccessor() const
GetReadAccessor() allows low level read-only access to the content of of the VdfVector via the Vdf_Ve...
#define TF_DEV_AXIOM(cond)
The same as TF_AXIOM, but compiled only in dev builds.
bool Vdf_IsPoolOutput(const VdfOutput &output)
Returns true if output is a pool output, i.e., an output that has an associated input,...