7#ifndef PXR_EXEC_VDF_INPUT_VECTOR_H
8#define PXR_EXEC_VDF_INPUT_VECTOR_H
14#include "pxr/exec/vdf/api.h"
23PXR_NAMESPACE_OPEN_SCOPE
29class VDF_API_TYPE Vdf_InputVectorBase :
public VdfNode
35 size_t GetSize()
const {
36 return _values.GetSize();
58 ~Vdf_InputVectorBase() override;
67class VDF_API_TYPE VdfInputVector final : public Vdf_InputVectorBase
73 VdfInputVector(
VdfNetwork *
const network,
size_t n) :
77 .Connector<T>(VdfTokens->out),
84 void SetValue(
const size_t index,
const T &value)
86 if (!
TF_VERIFY(index < _values.GetSize())) {
96 void SetValue(
const size_t index, T &&value)
98 if (!
TF_VERIFY(index < _values.GetSize())) {
103 a[index] = std::move(value);
108 bool IsValueEqual(
const size_t index,
const T &val)
const
110 if (
const T *v = GetValue(index)) {
120 const T *GetValue(
const size_t index)
const
122 if (index >= _values.GetSize()) {
134 ~VdfInputVector()
override;
136 typedef VdfInputVector<T> This;
141 if (
const This *other =
dynamic_cast<const This *
>(&rhs)) {
142 return _ValuesAreEqual(other);
154 bool _ValuesAreEqual(
const This *
const rhs)
const
156 const size_t size = _values.GetSize();
157 if (size == rhs->_values.GetSize()) {
159 _values.GetReadAccessor<T>();
160 const VdfVector &rhsValues = rhs->_values;
162 rhsValues.GetReadAccessor<T>();
163 for (
size_t i = 0; i < size; ++i) {
200VdfInputVector<T>::~VdfInputVector() =
default;
202PXR_NAMESPACE_CLOSE_SCOPE
Low-level utilities for informing users of various internal and external diagnostic conditions.
TfType represents a dynamic runtime type.
A context is the parameter bundle passed to callbacks of computations.
A VdfNetwork is a collection of VdfNodes and their connections.
This is the base class for all nodes in a VdfNetwork.
virtual VDF_API bool _IsDerivedEqual(const VdfNode &rhs) const
Can be overridden by derived classes to facilitate equality comparision.
virtual VDF_API size_t GetMemoryUsage() const
Returns the amount of memory used by the node in bytes.
virtual void Compute(const VdfContext &context) const =0
This is the method called to perform computation.
VdfOutputSpecs is a container for VdfOutputSpec objects.
A VdfTypedVector implements a VdfVector with a specific type.
A read-only accessor for low-level acces to the contents of the VdfVector.
A read/write accessor for low-level access to the contents of the VdfVector.
This class is used to abstract away knowledge of the cache data used for each node.
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.