Loading...
Searching...
No Matches
inputValueBlock.h
Go to the documentation of this file.
1//
2// Copyright 2025 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_EXEC_EF_INPUT_VALUE_BLOCK_H
8#define PXR_EXEC_EF_INPUT_VALUE_BLOCK_H
9
11
12#include "pxr/pxr.h"
13
14#include "pxr/exec/ef/api.h"
15
19
20#include <vector>
21#include <utility>
22
23PXR_NAMESPACE_OPEN_SCOPE
24
27
36{
37
38private:
39
40 // The type representing the vector of (output, value) pairs.
41 typedef std::vector< std::pair<VdfMaskedOutput, VdfVector *> > _VectorType;
42
43public:
44
47 EfInputValueBlock() = default;
48
51 EF_API
53
57
60 EF_API
62
65 EF_API
67
71
77 template <typename T>
78 void AddOutputValuePair(const VdfMaskedOutput &output, const T &value)
79 {
80 _values.push_back(std::make_pair( output, new VdfTypedVector<T>()));
81 _values.back().second->Set(value);
82 }
83
87 const VdfVector &value)
88 {
89 _values.push_back(std::make_pair( output, new VdfVector(value) ) );
90 }
91
99 EF_API
101 VdfMaskedOutputVector *invalidationRequest = NULL) const;
102
108 EF_API
110 const VdfMaskedOutputVector &invalidationRequest) const;
111
114 typedef _VectorType::const_iterator const_iterator;
115
119 return _values.begin();
120 }
121
125 return _values.end();
126 }
127
130 size_t GetSize() const {
131 return _values.size();
132 }
133
134private:
135
136 // Push invalidation on to the executor.
137 //
138 void _Invalidate(VdfExecutorInterface *executor,
139 const VdfMaskedOutputVector &invalidationRequest) const;
140
141 // Sets the output values on the executor.
142 //
143 void _SetValues(VdfExecutorInterface *executor) const;
144
145 // Clears the input value block.
146 //
147 void _Clear();
148
149 // Appends the contents of \p to this object.
150 //
151 void _Append(const EfInputValueBlock &rhs);
152
153private:
154
155 // The value pairs that make up this block.
156 _VectorType _values;
157
158};
159
162typedef std::vector< EfInputValueBlock > EfInputValueBlockVector;
163
164PXR_NAMESPACE_CLOSE_SCOPE
165
166#endif
An input value block is a vector of (output, value) pairs, each of which will be used to initialize a...
EfInputValueBlock(EfInputValueBlock &&rhs)=default
Move constructor.
size_t GetSize() const
Returns the number of outputs in this block.
_VectorType::const_iterator const_iterator
A const iterator into a block vector.
const_iterator begin() const
Returns a const_iterator to the beginning of the values vector.
EfInputValueBlock()=default
Constructs an empty input value block.
EfInputValueBlock & operator=(EfInputValueBlock &&rhs)=default
Move assignment operator.
EF_API void Apply(VdfExecutorInterface *executor, VdfMaskedOutputVector *invalidationRequest=NULL) const
Applies the input value block to an executor, by setting the output values and pushing through invali...
EF_API EfInputValueBlock(const EfInputValueBlock &rhs)
Copy constructor.
void AddOutputVectorPair(const VdfMaskedOutput &output, const VdfVector &value)
Adds an (output, VdfVector) pair to this block.
EF_API void InvalidateAndApply(VdfExecutorInterface *executor, const VdfMaskedOutputVector &invalidationRequest) const
Pushes invalidation into the executor using the supplied invalidationRequest.
EF_API ~EfInputValueBlock()
Destructor.
void AddOutputValuePair(const VdfMaskedOutput &output, const T &value)
Adds an (output, value) pair to this block.
const_iterator end() const
Returns a const_iterator to the end of the values vector.
EF_API EfInputValueBlock & operator=(const EfInputValueBlock &rhs)
Copy assignment operator.
Abstract base class for classes that execute a VdfNetwork to compute a requested set of values.
Class to hold on to an externally owned output and a mask.
Definition: maskedOutput.h:32
A VdfTypedVector implements a VdfVector with a specific type.
Definition: typedVector.h:23
This class is used to abstract away knowledge of the cache data used for each node.
Definition: vector.h:56
std::vector< EfInputValueBlock > EfInputValueBlockVector
A vector of EfInputValueBlocks.