Loading...
Searching...
No Matches
VdfReadWriteIterator< T > Class Template Referencefinal

This iterator provides read access to input values, and write access to the associated output values. More...

#include <readWriteIterator.h>

+ Inheritance diagram for VdfReadWriteIterator< T >:

Public Types

using value_type = T
 Type of the elements this iterator gives access to.
 
using difference_type = int
 The type used to identify distance between instances of this iterator.
 
using reference = value_type &
 Type of a reference to a value of this iterator.
 
using pointer = value_type *
 The type of a pointer to a value of this iterator.
 
using iterator_category = std::forward_iterator_tag
 The STL category of this iterator type.
 

Public Member Functions

 VdfReadWriteIterator (const VdfContext &context, const TfToken &name)
 Constructs a read/write iterator for the given input or output.
 
 VdfReadWriteIterator (const VdfContext &context)
 Constructs a read/write iterator for the only output on the current node.
 
bool operator== (const VdfReadWriteIterator &rhs) const
 Returns true if this iterator and rhs compare equal.
 
bool operator!= (const VdfReadWriteIterator &rhs) const
 Returns true if this iterator and rhs do not compare equal.
 
VdfReadWriteIteratoroperator++ ()
 Increment operator to point to the next element.
 
reference operator* () const
 Returns reference to current element.
 
pointer operator-> () const
 Returns pointer to current element.
 
bool IsAtEnd () const
 Returns true if the iterator is done iterating and false otherwise.
 
void AdvanceToEnd ()
 Advance the iterator to the end.
 

Static Public Member Functions

static VdfReadWriteIterator Allocate (const VdfContext &context, const TfToken &name, size_t count)
 Allocates storage for count elements at the given input or output and returns a read/write iterator at the beginning of that newly allocated storage.
 
static VdfReadWriteIterator Allocate (const VdfContext &context, size_t count)
 Allocates storage for count elements at the only output on the current node and returns a read/write iterator at the beginning of that newly allocated storage.
 

Friends

int Vdf_GetIteratorIndex (const VdfReadWriteIterator &it)
 

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.
 

Detailed Description

template<typename T>
class VdfReadWriteIterator< T >

This iterator provides read access to input values, and write access to the associated output values.

If the output does not have an associated input, read/write access is provided to the output values.

On construction, VdfReadWriteIterator will look for an input with the specified name. If the specified name does not refer to a valid input, or if the input does not have an associated output, VdfReadWriteIterator will look for an output with the specified name. If no valid output is available, a runtime error will be emitted.

When constructed without an explicit input/output name, VdfReadWriteIterator will look for the single output on the current node. If the node has more than one output, a runtime error will be emitted.

For outputs with an affects mask, the data elements visited by the iterator will be limited to those set in the affects mask. All data elements will be visited for outputs without an affects mask.

Note
This is a mutable ForwardIterator with the exception of a missing post-increment operator. The implementation of a post-increment operator would be slower than that of pre-increment and to prevent erroneous use it has been omitted entirely.

Definition at line 54 of file readWriteIterator.h.

Member Typedef Documentation

◆ difference_type

using difference_type = int

The type used to identify distance between instances of this iterator.

Definition at line 64 of file readWriteIterator.h.

◆ iterator_category

using iterator_category = std::forward_iterator_tag

The STL category of this iterator type.

Definition at line 76 of file readWriteIterator.h.

◆ pointer

using pointer = value_type *

The type of a pointer to a value of this iterator.

Definition at line 72 of file readWriteIterator.h.

◆ reference

using reference = value_type &

Type of a reference to a value of this iterator.

Definition at line 68 of file readWriteIterator.h.

◆ value_type

using value_type = T

Type of the elements this iterator gives access to.

Definition at line 60 of file readWriteIterator.h.

Constructor & Destructor Documentation

◆ VdfReadWriteIterator() [1/2]

VdfReadWriteIterator ( const VdfContext context,
const TfToken name 
)

Constructs a read/write iterator 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 199 of file readWriteIterator.h.

◆ VdfReadWriteIterator() [2/2]

VdfReadWriteIterator ( const VdfContext context)
inlineexplicit

Constructs a read/write iterator 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 90 of file readWriteIterator.h.

Member Function Documentation

◆ AdvanceToEnd()

void AdvanceToEnd ( )
inline

Advance the iterator to the end.

Definition at line 162 of file readWriteIterator.h.

◆ Allocate() [1/2]

VdfReadWriteIterator< T > Allocate ( const VdfContext context,
const TfToken name,
size_t  count 
)
static

Allocates storage for count elements at the given input or output and returns a read/write iterator at the beginning of that newly allocated storage.

The elements in the storage will be default initialized.

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 215 of file readWriteIterator.h.

◆ Allocate() [2/2]

VdfReadWriteIterator< T > Allocate ( const VdfContext context,
size_t  count 
)
static

Allocates storage for count elements at the only output on the current node and returns a read/write iterator at the beginning of that newly allocated storage.

The elements in the storage will be default initialized.

If the node has more than a single output, a coding error will be emitted.

Definition at line 227 of file readWriteIterator.h.

◆ IsAtEnd()

bool IsAtEnd ( ) const
inline

Returns true if the iterator is done iterating and false otherwise.

Definition at line 156 of file readWriteIterator.h.

◆ operator!=()

bool operator!= ( const VdfReadWriteIterator< T > &  rhs) const
inline

Returns true if this iterator and rhs do not compare equal.

Definition at line 127 of file readWriteIterator.h.

◆ operator*()

reference operator* ( ) const
inline

Returns reference to current element.

Calling this on an iterator that IsAtEnd() is invalid and will lead to undefined behavior.

Definition at line 139 of file readWriteIterator.h.

◆ operator++()

VdfReadWriteIterator< T > & operator++

Increment operator to point to the next element.

Calling this on an iterator that IsAtEnd() is invalid and will lead to undefined behavior.

Definition at line 259 of file readWriteIterator.h.

◆ operator->()

pointer operator-> ( ) const
inline

Returns pointer to current element.

Calling this on an iterator that IsAtEnd() is invalid and will lead to undefined behavior.

Definition at line 148 of file readWriteIterator.h.

◆ operator==()

bool operator== ( const VdfReadWriteIterator< T > &  rhs) const

Returns true if this iterator and rhs compare equal.

Definition at line 238 of file readWriteIterator.h.

Friends And Related Function Documentation

◆ Vdf_GetIteratorIndex

int Vdf_GetIteratorIndex ( const VdfReadWriteIterator< T > &  it)
friend

Definition at line 172 of file readWriteIterator.h.


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