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

#include <CVEX_Data.h>

Public Member Functions

 CVEX_DataBinder (CVEX_Data &data, exint buffer_size)
 
virtual ~CVEX_DataBinder ()
 
exint getBufferSize () const
 Return the size of the data buffers. More...
 
bool setAndBindData (CVEX_ValueT< PREC > &value)
 
bool bindData (CVEX_ValueT< PREC > &value)
 
bool isVarying (const UT_StringRef &name) const
 

Protected Member Functions

virtual bool setData (UT_Array< Int > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_Array< Float > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_Array< String > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_Array< Dict > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_Array< Vec2 > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_Array< Vec3 > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_Array< Vec4 > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_Array< Mat2 > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_Array< Mat3 > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_Array< Mat4 > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_PackedArrayOfArrays< Int > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_PackedArrayOfArrays< Float > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_PackedArrayOfArrays< String > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_PackedArrayOfArrays< Dict > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_PackedArrayOfArrays< Vec2 > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_PackedArrayOfArrays< Vec3 > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_PackedArrayOfArrays< Vec4 > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_PackedArrayOfArrays< Mat2 > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_PackedArrayOfArrays< Mat3 > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 
virtual bool setData (UT_PackedArrayOfArrays< Mat4 > &data, exint data_size, const UT_StringRef &data_name)
 Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals. More...
 

Detailed Description

template<VEX_Precision PREC>
class CVEX_DataBinder< PREC >

A helper class for binding data buffers to CVEX values. It abstracts the buffer management by allowing to override a virtual method for the particular data type.

For example:

class MY_Binder : public CVEX_DataBinder32
{
public:
MY_Binder(CVEX_Data &data, exint size, fpreal32 multipiler)
: CVEX_DataBinder32(data, size), myMultiplier(multipiler) {}
...
virtual bool setData( UT_Array<Float> &data,
const UT_StringRef &data_name ) override
{
for( int i=0; i < getBufferSize(); i++ )
data = myMultiplier * (fpreal32) i;
}
private:
fpreal32 myMultiplier;
};
MY_Binder binder( data, 10, 0.1 );
binder.setAndBindData( *cvex_context.findInput( "foo_in" ));

For example, binding an output buffer:

CVEX_DataBinder32 binder( data, 10 );
binder.bindData( *cvex_context.findOutput( "bar_out" ));

Definition at line 258 of file CVEX_Data.h.

Constructor & Destructor Documentation

template<VEX_Precision PREC>
CVEX_DataBinder< PREC >::CVEX_DataBinder ( CVEX_Data data,
exint  buffer_size 
)

Creates a binder object for binding data buffers to CVEX values. The is the data holder that stores the data buffers. The buffer_size specifies the size of buffers this class will create, and should be equal to the value passed into CVEX_Context::run().

template<VEX_Precision PREC>
virtual CVEX_DataBinder< PREC >::~CVEX_DataBinder ( )
virtual

Member Function Documentation

template<VEX_Precision PREC>
bool CVEX_DataBinder< PREC >::bindData ( CVEX_ValueT< PREC > &  value)

Creates a new data buffer, initializes it to zero (without calling the virtuals), then binds it to the given CVEX value.

template<VEX_Precision PREC>
exint CVEX_DataBinder< PREC >::getBufferSize ( ) const
inline

Return the size of the data buffers.

Definition at line 269 of file CVEX_Data.h.

template<VEX_Precision PREC>
bool CVEX_DataBinder< PREC >::isVarying ( const UT_StringRef name) const
inline

After binding data, this query will return true if the value is varying (and the associated buffer size is large as specified in the constructor parameter) or uniform (and size is 1).

Definition at line 283 of file CVEX_Data.h.

template<VEX_Precision PREC>
bool CVEX_DataBinder< PREC >::setAndBindData ( CVEX_ValueT< PREC > &  value)

Creates a new data buffer, calls the virtuals to fill it with data, then binds it to the given CVEX value.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_Array< Int > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_Array< Float > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_Array< String > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_Array< Dict > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_Array< Vec2 > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_Array< Vec3 > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_Array< Vec4 > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_Array< Mat2 > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_Array< Mat3 > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_Array< Mat4 > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_PackedArrayOfArrays< Int > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_PackedArrayOfArrays< Float > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_PackedArrayOfArrays< String > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_PackedArrayOfArrays< Dict > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_PackedArrayOfArrays< Vec2 > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_PackedArrayOfArrays< Vec3 > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_PackedArrayOfArrays< Vec4 > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_PackedArrayOfArrays< Mat2 > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_PackedArrayOfArrays< Mat3 > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.

template<VEX_Precision PREC>
virtual bool CVEX_DataBinder< PREC >::setData ( UT_PackedArrayOfArrays< Mat4 > &  data,
exint  data_size,
const UT_StringRef data_name 
)
protectedvirtual

Precision-dependent data types (Int, Float, Vec2, ...) used in virtuals.

Virtuals intended to be overriden by the subclass. Their purpose is to get the values from some custom data source and set the value of the parameter. The data is the data buffer over which the CVEX program will run. The data_size is the number of elements to set. It will be equal to getBufferSize() for varying data, and 1 for uniform. UT_Array is pre-sized to this size, however UT_PackedArrayOfArray() can't be pre-sized; so this many elements must be appended. The data_name is the name of the data buffer.


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