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

GT_DataArray implementation that wraps a VtArray. More...

Inherits GT_DataArray.

Public Types

using This = GusdGT_VtArray< T >
 
using ValueType = T
 
using ArrayType = VtArray< T >
 
using PODType = typename GusdPodTupleTraits< T >::ValueType
 

Public Member Functions

 SYS_STATIC_ASSERT (GusdIsPodTuple< T >())
 
 GusdGT_VtArray (const ArrayType &array, GT_Type type=GT_TYPE_NONE)
 
 GusdGT_VtArray (GT_Type type=GT_TYPE_NONE)
 
virtual const char * className () const
 
const T & operator() (GT_Offset o) const
 
PODType operator() (GT_Offset o, int idx) const
 
const ArrayTypeoperator* () const
 
const PODType * data () const
 
void swap (ArrayType &o)
 Swap our array contents with another array. More...
 
virtual GT_DataArrayHandle harden () const
 
const PODType * getData (GT_Offset o) const
 
template<typename PODT >
PODT getT (GT_Offset o, int idx=0) const
 Access to individual elements as given POD type. More...
 
template<typename PODT >
const PODT * getArrayT (GT_DataArrayHandle &buf) const
 Get access to a raw array of data. More...
 
template<typename PODT >
void importT (GT_Offset o, PODT *dst, int tsize=-1) const
 Extract a tuple into dst. More...
 
template<typename PODT >
void fillArrayT (PODT *dst, GT_Offset start, GT_Size length, int tsize=-1, int stride=-1) const
 Extract data for entire array into dst. More...
 
template<typename PODT >
void extendedFillT (PODT *dst, GT_Offset start, GT_Size length, int tsize=-1, int nrepeats=1, int stride=-1) const
 Extended form of array extraction that supports repeated elems. More...
 
virtual GT_Storage getStorage () const
 
virtual GT_Size getTupleSize () const
 
virtual GT_Size entries () const
 
virtual GT_Type getTypeInfo () const
 
virtual int64 getMemoryUsage () const
 
 _DECL_GETTERS (U8, uint8)
 
 _DECL_GETTERS (I32, int32)
 
 _DECL_GETTERS (I64, int64)
 
 _DECL_GETTERS (F16, fpreal16)
 
 _DECL_GETTERS (F32, fpreal32)
 
 _DECL_GETTERS (F64, fpreal64)
 

Static Public Attributes

static const int tupleSize = GusdGetTupleSize<T>()
 
static const GT_Storage storage
 

Protected Member Functions

void _UpdateDataPointer (bool makeUnique)
 Update our _data member to point at the array data. More...
 

Protected Attributes

ArrayType _array
 
const GT_Type _type
 
GT_Size _size
 
const PODType * _data
 

Detailed Description

template<class T>
class GusdGT_VtArray< T >

GT_DataArray implementation that wraps a VtArray.

This allows, in some cases, for arrays read in from USD to be pushed into GT prims without having to incur copying. Example:

* VtArray<int> valsFromUSD;
* GT_DataArrayHandle hnd(new GusdGT_VtArray<int>(valsFromUSD));
*

These arrays are designed to be read-only. If you need to make edits, use the following pattern:

* // swap data into tmp array, modify.
* srcData.swap(tmp);
* tmp[10] = 37;
* // swap data back into place.
* srcData.swap(tmp);
*

Note that this kind of swapping trick does not require the full array to be copied; only the internal references are swapped.

Definition at line 67 of file GT_VtArray.h.

Member Function Documentation

void _UpdateDataPointer ( bool  makeUnique)
protected

Update our _data member to point at the array data.

This must be called after any operation that changes the contents of _array.

Definition at line 222 of file GT_VtArray.h.

void extendedFillT ( PODT *  dst,
GT_Offset  start,
GT_Size  length,
int  tsize = -1,
int  nrepeats = 1,
int  stride = -1 
) const

Extended form of array extraction that supports repeated elems.

Definition at line 330 of file GT_VtArray.h.

void fillArrayT ( PODT *  dst,
GT_Offset  start,
GT_Size  length,
int  tsize = -1,
int  stride = -1 
) const

Extract data for entire array into dst.

Definition at line 302 of file GT_VtArray.h.

const PODT * getArrayT ( GT_DataArrayHandle &  buf) const

Get access to a raw array of data.

If OTHERPODT is not the same as the array's underlying type, the raw array will be stored in the given buf.

Definition at line 265 of file GT_VtArray.h.

PODT getT ( GT_Offset  o,
int  idx = 0 
) const

Access to individual elements as given POD type.

For performance, this is preferred to the virtual getXX() methods.

Definition at line 254 of file GT_VtArray.h.

void importT ( GT_Offset  o,
PODT *  dst,
int  tsize = -1 
) const

Extract a tuple into dst.

Definition at line 287 of file GT_VtArray.h.

void swap ( ArrayType o)

Swap our array contents with another array.

Definition at line 233 of file GT_VtArray.h.

Member Data Documentation

const GT_Storage storage
static
Initial value:

Definition at line 78 of file GT_VtArray.h.


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