10 #ifndef __CVEX_Data_h__
11 #define __CVEX_Data_h__
75 void setIsVarying(
const UT_StringRef &name,
bool is_var)
const;
91 : myCvexType(cvex_type), myIsVarying(
true) {}
96 CVEX_Type getCvexType()
const {
return myCvexType; }
98 void setIsVarying(
bool var) { myIsVarying = var; }
99 bool isVarying()
const {
return myIsVarying; }
107 template<
typename T>
class DataImpl :
public Data
112 , myDataPtr( std::move( data_array )) {}
114 {
return myDataPtr.get(); }
130 return find<T>( name );
132 auto data =
new DataImpl<T>( std::move( UTmakeUnique<T>() ),
type);
134 return data->getData();
141 auto it = myBufferMap.find( name );
142 if( it == myBufferMap.end() )
145 auto data =
dynamic_cast<DataImpl<T> *
>( it->second );
146 return data ?
data->getData() :
nullptr;
153 return add<UT_Array<T>>(
name,
type );
160 return add<UT_PackedArrayOfArrays<T>>(
name,
type );
167 return find<UT_Array<T>>(
name );
174 return find<UT_PackedArrayOfArrays<T>>(
name );
200 template <VEX_Precision PREC>
215 #define DECLARE_CVEX_DATA_TYPES \
216 using Int = typename CVEX_DataType<PREC>::Int; \
217 using Float = typename CVEX_DataType<PREC>::Float; \
218 using String = UT_StringHolder; \
219 using Dict = UT_OptionsHolder; \
220 using Vec2 = typename CVEX_DataType<PREC>::Vec2; \
221 using Vec3 = typename CVEX_DataType<PREC>::Vec3; \
222 using Vec4 = typename CVEX_DataType<PREC>::Vec4; \
223 using Mat2 = typename CVEX_DataType<PREC>::Mat2; \
224 using Mat3 = typename CVEX_DataType<PREC>::Mat3; \
225 using Mat4 = typename CVEX_DataType<PREC>::Mat4; \
226 using Quat = typename CVEX_DataType<PREC>::Quat; \
262 template <VEX_Precision PREC>
277 {
return myBufferSize; }
291 {
return myData.isVarying( name ); }
354 template<
typename T,
typename BIND>
408 template <VEX_Precision PREC>
428 {
return myData.isVarying( name ); }
488 bool retrieveSclrArrayBuffer(
const UT_StringRef &data_name);
490 bool retrieveVecArrayBuffer(
const UT_StringRef &data_name);
491 bool retrieveStrArrayBuffer(
const UT_StringRef &data_name);
492 bool retrieveDictArrayBuffer(
const UT_StringRef &data_name);
CVEX_InOutData()
Creates a holder for the data buffers.
bool isVarying(const UT_StringRef &name) const
#define DECLARE_CVEX_DATA_TYPES
Precision-dependent types of CVEX data.
CVEX_Data & getOutputData()
Accessors.
typename VEX_PrecisionResolver< P >::vec3_type VEXvec3
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
A class representing a VEX value.
const CVEX_Data & getInputData() const
Accessors.
bool isVarying(const UT_StringRef &name) const
typename VEX_PrecisionResolver< P >::quat_type VEXquaternion
typename VEX_PrecisionResolver< P >::float_type VEXfloat
CVEX_Data & getInputData()
Accessors.
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
typename VEX_PrecisionResolver< P >::mat4_type VEXmat4
GLuint const GLchar * name
CVEX_Type
The CVEX_Type enum defines the VEX types available to CVEX.
UT_PackedArrayOfArrays< T > * addArrayDataBuffer(const UT_StringRef &name, CVEX_Type type)
typename VEX_PrecisionResolver< P >::mat2_type VEXmat2
UT_Array< T > * addDataBuffer(const UT_StringRef &name, CVEX_Type type)
typename VEX_PrecisionResolver< P >::vec2_type VEXvec2
typename VEX_PrecisionResolver< P >::vec4_type VEXvec4
UT_Array< T > * findDataBuffer(const UT_StringRef &name) const
typename VEX_PrecisionResolver< P >::int_type VEXint
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
typename VEX_PrecisionResolver< P >::mat3_type VEXmat3
const CVEX_Data & getOutputData() const
Accessors.
UT_PackedArrayOfArrays< T > * findArrayDataBuffer(const UT_StringRef &name) const
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
bool contains(const key_type &key) const
Returns true if a value with the key is contained in the map.