HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CVEX_Value Class Reference

A class representing a VEX value. More...

#include <CVEX_Value.h>

Public Member Functions

 CVEX_Value (const UT_StringHolder &name, CVEX_Type type, bool varying)
 
 ~CVEX_Value ()
 
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 (int *data, int array_size)
 
bool setTypedData (fpreal32 *data, int array_size)
 
bool setTypedData (UT_Vector2F *data, int array_size)
 
bool setTypedData (UT_Vector3F *data, int array_size)
 
bool setTypedData (UT_Vector4F *data, int array_size)
 
bool setTypedData (UT_Matrix2F *data, int array_size)
 
bool setTypedData (UT_Matrix3F *data, int array_size)
 
bool setTypedData (UT_Matrix4F *data, int array_size)
 
bool setTypedData (CVEX_StringArray &stringdata)
 
bool setTypedData (UT_Array< UT_Array< int32 > > &intdata)
 
bool setTypedData (UT_PackedArrayOfArrays< int32 > &intdata, int arraysize=0)
 
bool setTypedData (UT_Array< UT_Array< fpreal32 > > &fltdata)
 This is stored as xyzxyzxyz for vector data. More...
 
bool setTypedData (UT_PackedArrayOfArrays< fpreal32 > &fltdata, int arraysize=0)
 
bool setTypedData (UT_Array< CVEX_StringArray > &stringdata)
 
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)
 

Friends

class CVEX_Context
 

Detailed Description

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 50 of file CVEX_Value.h.

Constructor & Destructor Documentation

CVEX_Value::CVEX_Value ( const UT_StringHolder name,
CVEX_Type  type,
bool  varying 
)
CVEX_Value::~CVEX_Value ( )

Member Function Documentation

static CVEX_Type CVEX_Value::getArrayBaseType ( CVEX_Type  t)
static
int CVEX_Value::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 67 of file CVEX_Value.h.

void* CVEX_Value::getData ( )
inline

Definition at line 130 of file CVEX_Value.h.

const UT_StringHolder& CVEX_Value::getName ( void  ) const
inline

Query name of VEX value.

Examples:
CVEX/cvexsample.C.

Definition at line 56 of file CVEX_Value.h.

void* CVEX_Value::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 81 of file CVEX_Value.h.

static int CVEX_Value::getTupleSize ( CVEX_Type  t)
static
CVEX_Type CVEX_Value::getType ( ) const
inline

Query type of VEX value.

Examples:
CVEX/cvexsample.C.

Definition at line 58 of file CVEX_Value.h.

bool CVEX_Value::isConstant ( ) const
inline

Definition at line 151 of file CVEX_Value.h.

bool CVEX_Value::isExport ( ) const
inline

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

Examples:
CVEX/cvexsample.C.

Definition at line 61 of file CVEX_Value.h.

bool CVEX_Value::isPackedArray ( ) const
inline

Definition at line 83 of file CVEX_Value.h.

bool CVEX_Value::isVarying ( ) const
inline

Query whether the VEX value is uniform or varying.

Examples:
SOP/SOP_PrimVOP.C.

Definition at line 63 of file CVEX_Value.h.

bool CVEX_Value::setData ( void data,
int  array_size 
)
inline

Definition at line 134 of file CVEX_Value.h.

bool CVEX_Value::setData ( CVEX_StringArray stringdata)
inline

Definition at line 138 of file CVEX_Value.h.

void CVEX_Value::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 149 of file CVEX_Value.h.

bool CVEX_Value::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.
void CVEX_Value::setType ( CVEX_Type  type)
bool CVEX_Value::setTypedData ( int 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.
bool CVEX_Value::setTypedData ( fpreal32 data,
int  array_size 
)
bool CVEX_Value::setTypedData ( UT_Vector2F data,
int  array_size 
)
bool CVEX_Value::setTypedData ( UT_Vector3F data,
int  array_size 
)
bool CVEX_Value::setTypedData ( UT_Vector4F data,
int  array_size 
)
bool CVEX_Value::setTypedData ( UT_Matrix2F data,
int  array_size 
)
bool CVEX_Value::setTypedData ( UT_Matrix3F data,
int  array_size 
)
bool CVEX_Value::setTypedData ( UT_Matrix4F data,
int  array_size 
)
bool CVEX_Value::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.

bool CVEX_Value::setTypedData ( UT_Array< UT_Array< int32 > > &  intdata)
bool CVEX_Value::setTypedData ( UT_PackedArrayOfArrays< int32 > &  intdata,
int  arraysize = 0 
)
bool CVEX_Value::setTypedData ( UT_Array< UT_Array< fpreal32 > > &  fltdata)

This is stored as xyzxyzxyz for vector data.

bool CVEX_Value::setTypedData ( UT_PackedArrayOfArrays< fpreal32 > &  fltdata,
int  arraysize = 0 
)
bool CVEX_Value::setTypedData ( UT_Array< CVEX_StringArray > &  stringdata)

Friends And Related Function Documentation

friend class CVEX_Context
friend

Definition at line 173 of file CVEX_Value.h.


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