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

A class representing a VEX value. More...

#include <CVEX_Value.h>

Public Member Functions

 CVEX_ValueT (const UT_StringHolder &name, CVEX_Type type, bool varying)
 
 ~CVEX_ValueT ()
 
const UT_StringHoldergetName () const
 Query name of VEX value. More...
 
CVEX_Type getType () const
 Query type of VEX value. More...
 
void setType (CVEX_Type type)
 
bool isExport () const
 Query whether the VEX value is an export (or read-only) More...
 
bool isVarying () const
 Query whether the VEX value is uniform or varying. More...
 
int getArraySize () const
 
voidgetRawData ()
 
bool isPackedArray () const
 
bool setTypedData (VEXint< PREC > *data, int array_size)
 
bool setTypedData (VEXfloat< PREC > *data, int array_size)
 
bool setTypedData (VEXvec2< PREC > *data, int array_size)
 
bool setTypedData (VEXvec3< PREC > *data, int array_size)
 
bool setTypedData (VEXvec4< PREC > *data, int array_size)
 
bool setTypedData (VEXmat2< PREC > *data, int array_size)
 
bool setTypedData (VEXmat3< PREC > *data, int array_size)
 
bool setTypedData (VEXmat4< PREC > *data, int array_size)
 
bool setTypedData (CVEX_StringArray &stringdata)
 
bool setTypedData (CVEX_DictArray &dictdata)
 
bool setTypedData (UT_Array< UT_Array< VEXint< PREC >> > &intdata)
 
bool setTypedData (UT_PackedArrayOfArrays< VEXint< PREC >> &intdata, int arraysize=0)
 
bool setTypedData (UT_Array< UT_Array< VEXfloat< PREC >> > &fltdata)
 This is stored as xyzxyzxyz for vector data. More...
 
bool setTypedData (UT_PackedArrayOfArrays< VEXfloat< PREC >> &fltdata, int arraysize=0)
 
bool setTypedData (UT_Array< CVEX_StringArray > &stringdata)
 
bool setTypedData (UT_Array< CVEX_DictArray > &dictdata)
 
bool setRawData (CVEX_Type type, void *data, int array_size)
 Type unsafe way of setting VEX data. Avoid using if possible. More...
 
voidgetData ()
 
bool setData (void *data, int array_size)
 
bool setData (CVEX_StringArray &stringdata)
 
void setIsConstant (bool isconstant)
 
bool isConstant () const
 

Static Public Member Functions

static int getTupleSize (CVEX_Type t)
 
static CVEX_Type getArrayBaseType (CVEX_Type t)
 
static VEX_Type cvexToVexType (CVEX_Type type, bool &isarray)
 
static CVEX_Type vexToCVexType (VEX_Type vextype, bool isarray)
 

Friends

template<VEX_Precision ALLPREC>
class CVEX_ContextT
 
template<VEX_Precision ALLPREC>
class CVEX_ValueListT
 

Detailed Description

template<VEX_Precision PREC>
class CVEX_ValueT< PREC >

A class representing a VEX value.

The CVEX_Value objects are created internally in the CVEX library. They provide a mapping from the CVEX library to the underlying VEX representation of objects.

Examples:
CVEX/cvexsample.C, CVEX/simple.C, and SOP/SOP_PrimVOP.C.

Definition at line 57 of file CVEX_Value.h.

Constructor & Destructor Documentation

template<VEX_Precision PREC>
CVEX_ValueT< PREC >::CVEX_ValueT ( const UT_StringHolder name,
CVEX_Type  type,
bool  varying 
)
template<VEX_Precision PREC>
CVEX_ValueT< PREC >::~CVEX_ValueT ( )

Member Function Documentation

template<VEX_Precision PREC>
static VEX_Type CVEX_ValueT< PREC >::cvexToVexType ( CVEX_Type  type,
bool &  isarray 
)
static

Given the list of vex parameters, returns the list of cvex parmeters that have valid cvex types.

template<VEX_Precision PREC>
static CVEX_Type CVEX_ValueT< PREC >::getArrayBaseType ( CVEX_Type  t)
static
template<VEX_Precision PREC>
int CVEX_ValueT< PREC >::getArraySize ( ) const
inline

Query the array size of the VEX value.

Note
This is not the used for VEX arrays, but rather represents the number of entries in the varying array.
Examples:
CVEX/cvexsample.C.

Definition at line 77 of file CVEX_Value.h.

template<VEX_Precision PREC>
void* CVEX_ValueT< PREC >::getData ( )
inline

Definition at line 142 of file CVEX_Value.h.

template<VEX_Precision PREC>
const UT_StringHolder& CVEX_ValueT< PREC >::getName ( ) const
inline

Query name of VEX value.

Examples:
CVEX/cvexsample.C.

Definition at line 66 of file CVEX_Value.h.

template<VEX_Precision PREC>
void* CVEX_ValueT< PREC >::getRawData ( )
inline

Get the raw data pointer. For numeric types, the data refers to a raw array of data (depending on the getType() of the value.

  • CVEX_TYPE_INTEGER int
  • CVEX_TYPE_FLOAT fpreal32
  • CVEX_TYPE_VECTOR2 UT_Vector2F
  • CVEX_TYPE_VECTOR3 UT_Vector3F
  • CVEX_TYPE_VECTOR4 UT_Vector4F
  • CVEX_TYPE_MATRIX2 UT_Matrix2F
  • CVEX_TYPE_MATRIX3 UT_Matrix3F
  • CVEX_TYPE_MATRIX4 UT_Matrix4F For CVEX_TYPE_STRING, the data will point to a UT_StringArray.
Examples:
CVEX/cvexsample.C.

Definition at line 91 of file CVEX_Value.h.

template<VEX_Precision PREC>
static int CVEX_ValueT< PREC >::getTupleSize ( CVEX_Type  t)
static
template<VEX_Precision PREC>
CVEX_Type CVEX_ValueT< PREC >::getType ( ) const
inline

Query type of VEX value.

Examples:
CVEX/cvexsample.C.

Definition at line 68 of file CVEX_Value.h.

template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::isConstant ( ) const
inline

Definition at line 163 of file CVEX_Value.h.

template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::isExport ( ) const
inline

Query whether the VEX value is an export (or read-only)

Examples:
CVEX/cvexsample.C.

Definition at line 71 of file CVEX_Value.h.

template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::isPackedArray ( ) const
inline

Definition at line 93 of file CVEX_Value.h.

template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::isVarying ( ) const
inline

Query whether the VEX value is uniform or varying.

Examples:
SOP/SOP_PrimVOP.C.

Definition at line 73 of file CVEX_Value.h.

template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setData ( void data,
int  array_size 
)
inline

Definition at line 146 of file CVEX_Value.h.

template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setData ( CVEX_StringArray stringdata)
inline

Definition at line 150 of file CVEX_Value.h.

template<VEX_Precision PREC>
void CVEX_ValueT< PREC >::setIsConstant ( bool  isconstant)
inline

The IsConstant determines eligibility for constant folding. It likely implies Uniform. But it is quite reasonable to have a Uniform parameter that isn't constant, it is then a demand that the VEX Assemble does not fold the input regardless of the initial value during load()

Definition at line 161 of file CVEX_Value.h.

template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setRawData ( CVEX_Type  type,
void data,
int  array_size 
)

Type unsafe way of setting VEX data. Avoid using if possible.

Examples:
SOP/SOP_PrimVOP.C.
template<VEX_Precision PREC>
void CVEX_ValueT< PREC >::setType ( CVEX_Type  type)
template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( VEXint< PREC > *  data,
int  array_size 
)

The array size is NOT the size in bytes, but rather the array size of the input data. It should either be 1 or N, where N is the number of values being computed by VEX.

When passing data for output variables, please check to see whether the output variable is uniform or varying. Varying values need to have a full array of data (including string arrays).

The CVEX_Value object will hold a pointer to the CVEX_StringArray, so the data must be persistent.

Examples:
CVEX/cvexsample.C, CVEX/simple.C, and SOP/SOP_PrimVOP.C.
template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( VEXfloat< PREC > *  data,
int  array_size 
)
template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( VEXvec2< PREC > *  data,
int  array_size 
)
template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( VEXvec3< PREC > *  data,
int  array_size 
)
template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( VEXvec4< PREC > *  data,
int  array_size 
)
template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( VEXmat2< PREC > *  data,
int  array_size 
)
template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( VEXmat3< PREC > *  data,
int  array_size 
)
template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( VEXmat4< PREC > *  data,
int  array_size 
)
template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( CVEX_StringArray stringdata)

When setting values for string types, you need to pass in a CVEX_StringArray instead of a void *. For input variables, the length of the array will determine whether the parameter is varying or uniform.

The CVEX_Value object will hold a pointer to the CVEX_StringArray, so the data must be persistent.

When setting data for outputs, the packed arrays should be empty and the array size specified.

template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( CVEX_DictArray dictdata)
template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( UT_Array< UT_Array< VEXint< PREC >> > &  intdata)
template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( UT_PackedArrayOfArrays< VEXint< PREC >> &  intdata,
int  arraysize = 0 
)
template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( UT_Array< UT_Array< VEXfloat< PREC >> > &  fltdata)

This is stored as xyzxyzxyz for vector data.

template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( UT_PackedArrayOfArrays< VEXfloat< PREC >> &  fltdata,
int  arraysize = 0 
)
template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( UT_Array< CVEX_StringArray > &  stringdata)
template<VEX_Precision PREC>
bool CVEX_ValueT< PREC >::setTypedData ( UT_Array< CVEX_DictArray > &  dictdata)
template<VEX_Precision PREC>
static CVEX_Type CVEX_ValueT< PREC >::vexToCVexType ( VEX_Type  vextype,
bool  isarray 
)
static

Friends And Related Function Documentation

template<VEX_Precision PREC>
template<VEX_Precision ALLPREC>
friend class CVEX_ContextT
friend

Definition at line 191 of file CVEX_Value.h.

template<VEX_Precision PREC>
template<VEX_Precision ALLPREC>
friend class CVEX_ValueListT
friend

Definition at line 193 of file CVEX_Value.h.


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