HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
valueTransform.h File Reference
#include "pxr/pxr.h"
#include "pxr/base/vt/dictionary.h"
#include "pxr/base/vt/types.h"
#include "pxr/base/vt/value.h"
#include "pxr/base/vt/valueRef.h"
#include <optional>
+ Include dependency graph for valueTransform.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Vt_TransformImpl
 

Functions

template<class Xf >
bool VtValueCanTransform (VtValueRef obj, Xf const &xfObj)
 
template<class Xf >
VtValue VtValueTryTransform (VtValueRef obj, Xf const &xfObj)
 
VT_API void Vt_RegisterTypedTransform (std::type_info const &objType, std::type_info const &xfType, void(*voidFn)(), VtValue(*xform)(VtValueRef, void const *, void(*)()))
 
template<bool RegisterForArrays, class T , class Xf >
void Vt_RegisterTransformImpl (T(*fn)(T const &obj, Xf const &xform))
 
template<class T , class Xf >
void VtRegisterTransformNoArrays (T(*fn)(T const &obj, Xf const &xform))
 
template<class T , class Xf >
void VtRegisterTransform (T(*fn)(T const &obj, Xf const &xform))
 
VT_API void Vt_RegisterErasedTransform (std::type_info const &objType, void(*voidFn)(), VtValue(*xform)(VtValueRef, void(*)(), TfFunctionRef< VtValue(VtValueRef)>))
 
template<class T >
void VtRegisterErasedTransform (std::optional< T >(*fn)(T const &obj, TfFunctionRef< VtValue(VtValueRef)>))
 

Function Documentation

VT_API void Vt_RegisterErasedTransform ( std::type_info const &  objType,
void(*)()  voidFn,
VtValue(*)(VtValueRef, void(*)(), TfFunctionRef< VtValue(VtValueRef)>)  xform 
)
template<bool RegisterForArrays, class T , class Xf >
void Vt_RegisterTransformImpl ( T(*)(T const &obj, Xf const &xform)  fn)

Definition at line 88 of file valueTransform.h.

VT_API void Vt_RegisterTypedTransform ( std::type_info const &  objType,
std::type_info const &  xfType,
void(*)()  voidFn,
VtValue(*)(VtValueRef, void const *, void(*)())  xform 
)
template<class T >
void VtRegisterErasedTransform ( std::optional< T >(*)(T const &obj, TfFunctionRef< VtValue(VtValueRef)>)  fn)

Register a type-erased transform-forwarder for objects of type T that may contain VtValues (directly or indirectly). For example, VtDictionary, which is a map from string keys to VtValues, registers type-erased transform support to forward a transform to all of its values.

Definition at line 184 of file valueTransform.h.

template<class T , class Xf >
void VtRegisterTransform ( T(*)(T const &obj, Xf const &xform)  fn)

Register a strongly-typed transformation of T by Xf, plus VtArray<T> and VtArrayEdit<T>, transforming their elements and literals respectively. Call VtRegisterTransformNoArrays() to avoid registering for arrays & array edits.

Definition at line 166 of file valueTransform.h.

template<class T , class Xf >
void VtRegisterTransformNoArrays ( T(*)(T const &obj, Xf const &xform)  fn)

Register a strongly-typed transformation of T by Xf but do not register transforms for VtArray<T> and VtArrayEdit<T>. Call VtRegisterTransform() to include arrays & array edits.

Definition at line 155 of file valueTransform.h.

template<class Xf >
bool VtValueCanTransform ( VtValueRef  obj,
Xf const &  xfObj 
)

Return true if obj is not empty, views an object that supports value transforms, and has value transform support registered for transforms of type Xf. Note that the type Xf does not have specific requirements, but typically represents a possibly "polymorphic" transform that can apply to many types. For example, "Transpose" may apply to many matrix types. Or "Normalize" to many vector types.

Definition at line 51 of file valueTransform.h.

template<class Xf >
VtValue VtValueTryTransform ( VtValueRef  obj,
Xf const &  xfObj 
)

Attempt to transform obj by xfObj and return the result. If no transformation is done, return an empty value. Strongly typed transforms are preferred to type-erased transforms.

Definition at line 64 of file valueTransform.h.