![]() |
|
VdfReadWriteAccessor allows for random access to output data. More...
#include <readWriteAccessor.h>
Inheritance diagram for VdfReadWriteAccessor< T >:Public Member Functions | |
| VdfReadWriteAccessor (const VdfContext &context, const TfToken &name) | |
| Constructs a read/write accessor for the given input or output. | |
| VdfReadWriteAccessor (const VdfContext &context) | |
| Constructs a read/write accessor for the only output on the current node. | |
| const T & | operator[] (size_t index) const |
| Provides constant random access to the data stored at the output. | |
| T & | operator[] (size_t index) |
| Provides mutable random access to the data stored at the output. | |
| bool | IsEmpty () const |
Returns true if there is no data stored at the output. | |
| size_t | GetSize () const |
| Returns the size of the data stored at the output. | |
Additional Inherited Members | |
Protected Member Functions inherited from VdfIterator | |
| ~VdfIterator ()=default | |
| Disallow destruction via base class pointers. | |
| const VdfNode & | _GetNode (const VdfContext &context) const |
| Returns the current node being run. | |
| const VdfExecutorInterface & | _GetExecutor (const VdfContext &context) const |
| Returns the executor for the given context. | |
| VDF_API const VdfVector * | _GetInputValue (const VdfContext &context, const VdfConnection &connection, const VdfMask &mask) const |
| Returns a vector for reading an input value. | |
| VDF_API const VdfVector & | _GetRequiredInputValue (const VdfContext &context, const VdfConnection &connection, const VdfMask &mask) const |
Returns the cached output value for a given output, or issues an error message if a cache value is not available. | |
| VDF_API const VdfOutput * | _GetRequiredOutputForWriting (const VdfContext &context, const TfToken &name) const |
Returns the output for writing based on the name provided. | |
| VDF_API VdfVector * | _GetOutputValueForWriting (const VdfContext &context, const VdfOutput &output) const |
| Returns a vector for writing an output value into. | |
| VDF_API bool | _GetOutputMasks (const VdfContext &context, const VdfOutput &output, const VdfMask **requestMask, const VdfMask **affectsMask) const |
Retrieves the request and affects masks of the given output. | |
| VDF_API bool | _IsRequiredInput (const VdfContext &context, const VdfConnection &connection) const |
Returns true when the connection is scheduled and required, and false otherwise. | |
| VDF_API const VdfMask * | _GetRequestMask (const VdfContext &context, const VdfOutput &output) const |
Returns the request mask of output, if the output has been scheduled and NULL otherwise. | |
| VDF_API void | _ForEachScheduledOutput (const VdfContext &context, const VdfNode &node, const VdfScheduledOutputCallback &callback) const |
Loops over each scheduled output of node and calls callback with the output and request mask in an efficient manner. | |
VdfReadWriteAccessor allows for random access to output data.
The index into the data is in iteration space, i.e. access to index N returns the value of the N-th element as visited by the VdfReadWriteIterator.
If the memory layout of the output values is not contiguous in the output buffer (e.g. a non-contiguous affects mask), the accessor will redirect access to the underlying data. This indirection can be costly. If the data is contiguous in memory, fast access will be provided through what is essentially access through pointer indirection / indexing of array elements.
Note that the memory layout of output buffers is an implementation detail of the system influenced by many factors. Subsequently, no assumptions can be made about whether access will take the fast- or the slow-path.
The only way to guarantee fast indirection is by accessing data through iterators (e.g. VdfReadWriteIterator). The use of iterators instead of using VdfReadWriteAccessor is strongly encouraged.
Definition at line 48 of file readWriteAccessor.h.
| VdfReadWriteAccessor | ( | const VdfContext & | context, |
| const TfToken & | name | ||
| ) |
Constructs a read/write accessor for the given input or output.
If no input with the specified name exists on the current node, or if the input does not have an associated output, attempt to find an output named name. Emits a coding error if name does not name an input or an output.
Definition at line 114 of file readWriteAccessor.h.
|
inline |
Constructs a read/write accessor for the only output on the current node.
If the node has more than a single output, a coding error will be emitted.
Definition at line 64 of file readWriteAccessor.h.
|
inline |
Returns the size of the data stored at the output.
Definition at line 90 of file readWriteAccessor.h.
|
inline |
Returns true if there is no data stored at the output.
Definition at line 84 of file readWriteAccessor.h.
| T & operator[] | ( | size_t | index | ) |
Provides mutable random access to the data stored at the output.
Note that index must be within [0, GetSize()). Out of bounds access will lead to undefined behavior.
Definition at line 169 of file readWriteAccessor.h.
|
inline |
Provides constant random access to the data stored at the output.
Note that index must be within [0, GetSize()). Out of bounds access will lead to undefined behavior.
Definition at line 72 of file readWriteAccessor.h.