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

#include <CVEX_Data.h>

Public Member Functions

 CVEX_Data ()
 Creates an object that holds and manages the data buffers. More...
 
 ~CVEX_Data ()
 
bool hasBuffer (const UT_StringRef &name) const
 Returns true if the data has a buffer of the given name. More...
 
CVEX_Type getCvexType (const UT_StringRef &name) const
 
template<typename T >
UT_Array< T > * addDataBuffer (const UT_StringRef &name, CVEX_Type type)
 
template<typename T >
UT_PackedArrayOfArrays< T > * addArrayDataBuffer (const UT_StringRef &name, CVEX_Type type)
 
template<typename T >
UT_Array< T > * findDataBuffer (const UT_StringRef &name) const
 
template<typename T >
UT_PackedArrayOfArrays< T > * findArrayDataBuffer (const UT_StringRef &name) const
 
void setIsVarying (const UT_StringRef &name, bool is_var) const
 
bool isVarying (const UT_StringRef &name) const
 

Detailed Description

Class for storing CVEX data buffers, where each buffer contains data for a CVEX_Value object. The CVEX_Data class owns the buffers and manages their allocation and deallocation. Each buffer also has a corresponding name and CVEX type, which can be useful when transferring data to and from the buffers.

For example:

CVEX_ValueT<PREC> *value = cvex_context.findInput("foo");
auto *buffer = data.addDataBuffer<fpreal32>("foo", value->getType());
buffer.setSize( 10 );
for( int i=0; i<10; ++i )
buffer[i] = 0.1 * (fpreal32) i;
value->setTypedData( buffer->data(), buffer->size() );

Definition at line 38 of file CVEX_Data.h.

Constructor & Destructor Documentation

CVEX_Data::CVEX_Data ( )

Creates an object that holds and manages the data buffers.

CVEX_Data::~CVEX_Data ( )

Member Function Documentation

template<typename T >
UT_PackedArrayOfArrays< T > * CVEX_Data::addArrayDataBuffer ( const UT_StringRef name,
CVEX_Type  type 
)

Adds a new buffer and returns it as a reference. If a buffer by that name has already been added, it is returned, provinding the type matches. If type does not match, returns nullptr. The given type is associated with that buffer

Definition at line 153 of file CVEX_Data.h.

template<typename T >
UT_Array< T > * CVEX_Data::addDataBuffer ( const UT_StringRef name,
CVEX_Type  type 
)

Adds a new buffer and returns it as a reference. If a buffer by that name has already been added, it is returned, provinding the type matches. If type does not match, returns nullptr. The given type is associated with that buffer

Definition at line 146 of file CVEX_Data.h.

template<typename T >
UT_PackedArrayOfArrays< T > * CVEX_Data::findArrayDataBuffer ( const UT_StringRef name) const

Returns the data buffer given by its name and type T, or null if not found.

Definition at line 167 of file CVEX_Data.h.

template<typename T >
UT_Array< T > * CVEX_Data::findDataBuffer ( const UT_StringRef name) const

Returns the data buffer given by its name and type T, or null if not found.

Definition at line 160 of file CVEX_Data.h.

CVEX_Type CVEX_Data::getCvexType ( const UT_StringRef name) const

Returns the CVEX type associated with the data buffer given its name, or, if buffer is not found, returns CVEX_TYPE_INVALID.

bool CVEX_Data::hasBuffer ( const UT_StringRef name) const

Returns true if the data has a buffer of the given name.

bool CVEX_Data::isVarying ( const UT_StringRef name) const

Sets and gets the varying flag. Note, caller needs to maintain the consistent value of that flag.

void CVEX_Data::setIsVarying ( const UT_StringRef name,
bool  is_var 
) const

Sets and gets the varying flag. Note, caller needs to maintain the consistent value of that flag.


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