RslIter< T > Class Template Reference

RslIter< T > Class Template Reference

#include <RslPlugin.h>

Public Member Functions

 RslIter (const RslArg *arg)
 Construct an iterator from an argument.
 
 RslIter (const T *data, const RslContext *ctx)
 
T & operator* ()
 
const T & operator* () const
 
RslIter< T > & operator++ ()
 
RslIter< T > operator++ (int)
 
void Reset ()
 Reset the iterator to point at the first active point.
 
bool IsVarying () const
 
template<>
RslIter< RtMatrix > & operator++ ()
 

Detailed Description

template<typename T>
class RslIter< T >

An iterator is used to access grid data. Incrementing an iterator skips over inactive grid points. An iterator is constructed from an RslArg and used as follows:

RslFloatIter a(argv[0]);
RslFloatIter b(argv[1]);
RslFloatIter c(argv[2]);
int n = argv[0]->NumValues();
for (int i = 0; i < n; ++i) {
a = *b + *c;
++a; ++b; ++c;
}

Run-time type assertions are recommended to guard against inadvert type errors:

assert(argv[0].IsFloat());

This should be unnecessary because the shader compiler guarantees that the argument values match the parameter types specified in the plugin function prototype (in the RslFunctionTable). However, type assertions guard against inadvertent prototype errors, and they help catch errors in overloaded functions that can otherwise be difficult to diagnose.

Constructor & Destructor Documentation

template<typename T>
RslIter< T >::RslIter ( const T *  data,
const RslContext ctx 
)
inline

Construct a uniform iterator for user-provided data. This is useful for optional arguments with default values.

Member Function Documentation

template<typename T>
bool RslIter< T >::IsVarying ( ) const
inline

Returns true if the iterator is varying. Note that uniform iterators need not be incremented (although it does no harm).

template<typename T>
T& RslIter< T >::operator* ( )
inline

Dereference this iterator, yielding a non-const reference. This method is automatically selected when a dereferenced iterator is the target of an assignment, such as "*a = 0".

template<typename T>
const T& RslIter< T >::operator* ( ) const
inline

Get a const reference to the data pointed to by this iterator. This method is automatically selected by the compiler when appropriate.

template<typename T>
RslIter<T>& RslIter< T >::operator++ ( )
inline

Increment this iterator to point to the data for the next active point. An internal acceleration structure makes this a constant-time operation.

template<typename T>
RslIter<T> RslIter< T >::operator++ ( int  )
inline

Post-increment this iterator. Returns a copy of the iterator prior to incrementing, so it's not terribly efficient. The dummy integer argument is the standard C++ way of distinguishing between pre- and post-increment operators.


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