HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VdfReadWriteAccessor< T > Class Template Reference

#include <readWriteAccessor.h>

+ Inheritance diagram for VdfReadWriteAccessor< T >:

Public Member Functions

 VdfReadWriteAccessor (const VdfContext &context, const TfToken &name)
 
 VdfReadWriteAccessor (const VdfContext &context)
 
const Toperator[] (size_t index) const
 
Toperator[] (size_t index)
 
bool IsEmpty () const
 
size_t GetSize () const
 

Additional Inherited Members

- Protected Member Functions inherited from VdfIterator
 ~VdfIterator ()=default
 
const VdfNode_GetNode (const VdfContext &context) const
 
const VdfExecutorInterface_GetExecutor (const VdfContext &context) const
 
VDF_API const VdfVector_GetInputValue (const VdfContext &context, const VdfConnection &connection, const VdfMask &mask) const
 
VDF_API const VdfVector_GetRequiredInputValue (const VdfContext &context, const VdfConnection &connection, const VdfMask &mask) const
 
VDF_API const VdfOutput_GetRequiredOutputForWriting (const VdfContext &context, const TfToken &name) const
 
VDF_API VdfVector_GetOutputValueForWriting (const VdfContext &context, const VdfOutput &output) const
 
VDF_API bool _GetOutputMasks (const VdfContext &context, const VdfOutput &output, const VdfMask **requestMask, const VdfMask **affectsMask) const
 
VDF_API bool _IsRequiredInput (const VdfContext &context, const VdfConnection &connection) const
 
VDF_API const VdfMask_GetRequestMask (const VdfContext &context, const VdfOutput &output) const
 
VDF_API void _ForEachScheduledOutput (const VdfContext &context, const VdfNode &node, const VdfScheduledOutputCallback &callback) const
 

Detailed Description

template<typename T>
class VdfReadWriteAccessor< T >

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.

Warning
Due to performance caveats described below, accessing values through an iterator (e.g. VdfReadWriteIterator) is preferred, if the data is accessed in a forward iterating pattern.

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.

Constructor & Destructor Documentation

template<typename T >
VdfReadWriteAccessor< T >::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.

template<typename T >
VdfReadWriteAccessor< T >::VdfReadWriteAccessor ( const VdfContext context)
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.

Member Function Documentation

template<typename T >
size_t VdfReadWriteAccessor< T >::GetSize ( ) const
inline

Returns the size of the data stored at the output.

Definition at line 90 of file readWriteAccessor.h.

template<typename T >
bool VdfReadWriteAccessor< T >::IsEmpty ( ) const
inline

Returns true if there is no data stored at the output.

Definition at line 84 of file readWriteAccessor.h.

template<typename T >
const T& VdfReadWriteAccessor< T >::operator[] ( size_t  index) const
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.

template<typename T >
T & VdfReadWriteAccessor< 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.


The documentation for this class was generated from the following file: