7#ifndef PXR_EXEC_VDF_READ_WRITE_ITERATOR_H
8#define PXR_EXEC_VDF_READ_WRITE_ITERATOR_H
14#include "pxr/exec/vdf/allocateBoxedValue.h"
15#include "pxr/exec/vdf/boxedContainer.h"
24PXR_NAMESPACE_OPEN_SCOPE
142 return _accessor[*_iterator];
151 return &_accessor[*_iterator];
157 return _iterator.IsAtEnd();
163 _iterator = VdfMask::Bits::AllSetView::const_iterator();
173 return *it._iterator;
184 VdfMask::Bits::AllSetView::const_iterator _iterator;
189 std::shared_ptr<VdfMask::Bits> _bits;
205 _output = _GetRequiredOutputForWriting(context, name);
209 _Initialize(context);
220 return Vdf_AllocateBoxedValue<T>(context, name, count)
231 return Vdf_AllocateBoxedValue<T>(context,
TfToken(), count)
241 if (_output != rhs._output) {
246 const bool atEnd = IsAtEnd();
247 const bool rhsAtEnd = rhs.
IsAtEnd();
248 if (atEnd || rhsAtEnd) {
249 return atEnd == rhsAtEnd;
254 return *_iterator == *rhs._iterator;
270 const VdfMask *requestMask =
nullptr;
271 const VdfMask *affectsMask =
nullptr;
272 if (!_GetOutputMasks(context, *_output, &requestMask, &affectsMask)) {
278 VdfVector *v = _GetOutputValueForWriting(context, *_output);
280 v,
"Output '%s' is missing buffer.",
281 _output->GetName().GetText())) {
288 if (_accessor.IsEmpty()) {
296 if (ARCH_UNLIKELY(affectsMask->
GetSize() != _accessor.GetNumValues())) {
299 (affectsMask->
GetSize() == 1 && _accessor.IsBoxed()));
301 _bits = std::make_shared<VdfMask::Bits>(_accessor.GetNumValues());
303 _iterator = _bits->GetAllSetView().begin();
308 _iterator = affectsMask->
GetBits().GetAllSetView().begin();
312PXR_NAMESPACE_CLOSE_SCOPE
Token for efficient comparison, assignment, and hashing of known strings.
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.
size_t GetSize() const
Returns the size of the mask.
bool IsEmpty() const
Returns true if this mask is empty, i.e.
VdfMask::Bits const & GetBits() const
Get this mask's content as CtCompressedfBits.
A VdfOutput represents an output on a node.
This iterator provides read access to input values, and write access to the associated output values.
int difference_type
The type used to identify distance between instances of this iterator.
bool IsAtEnd() const
Returns true if the iterator is done iterating and false otherwise.
void AdvanceToEnd()
Advance the iterator to the end.
static VdfReadWriteIterator Allocate(const VdfContext &context, const TfToken &name, size_t count)
Allocates storage for count elements at the given input or output and returns a read/write iterator a...
VdfReadWriteIterator & operator++()
Increment operator to point to the next element.
std::forward_iterator_tag iterator_category
The STL category of this iterator type.
value_type * pointer
The type of a pointer to a value of this iterator.
VdfReadWriteIterator(const VdfContext &context)
Constructs a read/write iterator for the only output on the current node.
bool operator==(const VdfReadWriteIterator &rhs) const
Returns true if this iterator and rhs compare equal.
value_type & reference
Type of a reference to a value of this iterator.
reference operator*() const
Returns reference to current element.
bool operator!=(const VdfReadWriteIterator &rhs) const
Returns true if this iterator and rhs do not compare equal.
pointer operator->() const
Returns pointer to current element.
T value_type
Type of the elements this iterator gives access to.
A read/write accessor for low-level access 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.
ReadWriteAccessor< TYPE > GetReadWriteAccessor() const
GetReadWriteAccessor() allows low level access to the content of the VdfVector via the Vdf_VectorData...
#define TF_DEV_AXIOM(cond)
The same as TF_AXIOM, but compiled only in dev builds.
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.