7#ifndef PXR_EXEC_VDF_REQUEST_H
8#define PXR_EXEC_VDF_REQUEST_H
14#include "pxr/exec/vdf/api.h"
18#include "pxr/base/tf/bits.h"
26PXR_NAMESPACE_OPEN_SCOPE
48 explicit VdfRequest(
const VdfMaskedOutputVector& vector);
56 explicit VdfRequest(VdfMaskedOutputVector&& vector);
75 size_t GetSize()
const;
91 using iterator_category = std::forward_iterator_tag;
95 using difference_type = std::ptrdiff_t;
100 reference operator*()
const {
return _Dereference(); }
101 pointer operator->()
const {
return &(_Dereference()); }
103 const_iterator &operator++() {
108 const_iterator operator++(
int) {
109 const_iterator r(*
this);
114 bool operator==(
const const_iterator& rhs)
const {
118 bool operator!=(
const const_iterator& rhs)
const {
123 friend class VdfRequest;
134 bool _Equal(
const const_iterator& rhs)
const {
135 return _mo == rhs._mo;
143 size_t _ComputeIndex()
const;
154 const_iterator begin()
const;
159 const_iterator end()
const;
170 IndexedView(
const VdfRequest &request) : _r(&request) {}
174 size_t GetSize()
const {
175 return _r->_request->size();
183 return !_r->_bits.GetSize() || _r->_bits.IsSet(i)
184 ? &(*_r->_request)[i]
189 const VdfRequest *_r;
200 void Add(
const const_iterator& iterator);
206 void Remove(
const const_iterator& iterator);
224 friend bool operator==(
const VdfRequest& lhs,
const VdfRequest& rhs)
226 return (lhs._request == rhs._request ||
227 *lhs._request == *rhs._request) &&
228 lhs._bits == rhs._bits;
234 friend bool operator!=(
const VdfRequest& lhs,
const VdfRequest& rhs)
236 return !(lhs == rhs);
240 size_t operator()(
const VdfRequest &request)
const
246 const size_t num = std::min<size_t>(request.GetSize(), 3);
248 const VdfMaskedOutputVector &outputs = *request._request;
249 for(
size_t i = 0; i < num; i++) {
251 hash, VdfMaskedOutput::Hash()(outputs[i]));
255 if (request.GetSize() > 3) {
257 hash, VdfMaskedOutput::Hash()(outputs.back()));
269 void _Add(
size_t index);
275 void _Remove(
size_t index);
279 std::shared_ptr<const VdfMaskedOutputVector> _request;
289PXR_NAMESPACE_CLOSE_SCOPE
Fast bit array that keeps track of the number of bits set and can find the next set in a timely manne...
static size_t Combine(Args &&... args)
Produce a hash code by combining the hash codes of several objects.
Class to hold on to an externally owned output and a mask.
A VdfNetwork is a collection of VdfNodes and their connections.