|
HDK
|
#include <value.h>
Public Member Functions | |
| VtValue () | |
| Default ctor gives empty VtValue. More... | |
| VtValue (VtValue const &other) | |
Copy construct with other. More... | |
| VtValue (VtValue &&other) noexcept | |
Move construct with other. More... | |
| template<class T > | |
| VtValue (T const &obj) | |
| VT_API | VtValue (VtValueRef ref) |
| Construct with VtValueRef. More... | |
| ~VtValue () | |
| Destructor. More... | |
| VtValue & | operator= (VtValue const &other) |
| Copy assignment from another VtValue. More... | |
| VtValue & | operator= (VtValue &&other) noexcept |
| Move assignment from another VtValue. More... | |
| VT_API VtValue & | operator= (VtValueRef ref) |
| Assignment from VtValueRef. More... | |
| template<class T > | |
| VtValue & | operator= (T const &obj) |
| Assignment operator from any type. More... | |
| VtValue & | Swap (VtValue &rhs) noexcept |
| Swap this with rhs. More... | |
| template<class T > | |
| void | Swap (T &rhs) |
| template<class T > | |
| void | UncheckedSwap (T &rhs) |
| void | UncheckedSwap (VtValue &rhs) |
| template<class T > | |
| T | Remove () |
| template<class T > | |
| T | UncheckedRemove () |
| template<class T , class Fn > | |
| bool | Mutate (Fn &&mutateFn) |
| template<class T , class Fn > | |
| void | UncheckedMutate (Fn &&mutateFn) |
| template<class T > | |
| bool | IsHolding () const |
| VT_API bool | IsArrayValued () const |
| Return true if this holds a VtArray instance, false otherwise. More... | |
| VT_API bool | IsArrayEditValued () const |
| Return true if this holds a VtArrayEdit instance, false otherwise. More... | |
| size_t | GetArraySize () const |
| VT_API std::type_info const & | GetTypeid () const |
| Return the typeid of the type held by this value. More... | |
| VT_API std::type_info const & | GetElementTypeid () const |
| VT_API TfType | GetType () const |
| Returns the TfType of the type held by this value. More... | |
| VT_API std::string | GetTypeName () const |
| Return the type name of the held typeid. More... | |
| int | GetKnownValueTypeIndex () const |
| template<class T > | |
| T const & | UncheckedGet () const & |
| template<class T > | |
| T | UncheckedGet ()&& |
| template<class T > | |
| T const & | Get () const & |
| template<class T > | |
| T | Get ()&& |
| template<class T > | |
| T | GetWithDefault (T const &def=T()) const |
| template<typename T > | |
| VtValue & | Cast () |
| VtValue & | CastToTypeOf (VtValue const &other) |
| VtValue & | CastToTypeid (std::type_info const &type) |
| template<typename T > | |
| bool | CanCast () const |
| bool | CanCastToTypeOf (VtValue const &other) const |
| bool | CanCastToTypeid (std::type_info const &type) const |
| bool | IsEmpty () const |
| Returns true iff this value is empty. More... | |
| VT_API VtValueRef | Ref () const & |
| VT_API VtValueRef | Ref ()&& |
| VT_API | operator VtValueRef () const & |
| Implicitly convert to VtValueRef. More... | |
| VT_API | operator VtValueRef ()&& |
| Implicitly convert to an rvalue VtValueRef. More... | |
| VT_API bool | CanHash () const |
| Return true if the held object provides a hash implementation. More... | |
| VT_API size_t | GetHash () const |
| Return a hash code for the held object by calling VtHashValue() on it. More... | |
| VT_API bool | CanComposeOver () const |
| VT_API bool | CanTransform () const |
| bool | operator== (const VtValue &rhs) const |
| Test two values for equality. More... | |
| bool | operator!= (const VtValue &rhs) const |
| template<> | |
| const VtValue & | Get () const & |
| template<> | |
| VtValue | Get ()&& |
| template<> | |
| const VtValue & | UncheckedGet () const & |
| template<> | |
| VtValue | UncheckedGet ()&& |
| template<> | |
| bool | IsHolding () const |
| template<> | |
| bool | IsHolding () const |
| template<class T > | |
| PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE VtValue & | operator= (T const &obj) |
| template<> | |
| VtValue & | operator= (VtValueRef const &obj)=delete |
Static Public Member Functions | |
| template<class T > | |
| static VtValue | Take (T &obj) |
| template<typename From , typename To > | |
| static void | RegisterCast (VtValue(*castFn)(VtValue const &)) |
| Register a cast from VtValue holding From to VtValue holding To. More... | |
| template<typename From , typename To > | |
| static void | RegisterSimpleCast () |
| Register a simple cast from VtValue holding From to VtValue. More... | |
| template<typename From , typename To > | |
| static void | RegisterSimpleBidirectionalCast () |
| template<typename T > | |
| static VtValue | Cast (VtValue const &val) |
| static VT_API VtValue | CastToTypeOf (VtValue const &val, VtValue const &other) |
| static VT_API VtValue | CastToTypeid (VtValue const &val, std::type_info const &type) |
| static bool | CanCastFromTypeidToTypeid (std::type_info const &from, std::type_info const &to) |
Friends | |
| struct | _HoldAside |
| struct | Vt_ValueShapeDataAccess |
| struct | Vt_ValueTestAccess |
| void | swap (VtValue &lhs, VtValue &rhs) |
| Overloaded swap() for generic code/stl/etc. More... | |
| size_t | hash_value (VtValue const &val) |
| template<typename T > | |
| bool | operator== (VtValue const &lhs, T const &rhs) |
| Tests for equality. More... | |
| template<typename T > | |
| bool | operator== (T const &lhs, VtValue const &rhs) |
| template<typename T > | |
| bool | operator!= (VtValue const &lhs, T const &rhs) |
| Tests for inequality. More... | |
| template<typename T > | |
| bool | operator!= (T const &lhs, VtValue const &rhs) |
| VT_API friend std::ostream & | operator<< (std::ostream &out, const VtValue &self) |
| Calls through to operator << on the held object. More... | |
| TfPyObjWrapper | Vt_GetPythonObjectFromHeldValue (VtValue const &self) |
Provides a container which may hold any type, and provides introspection and iteration over array types. See VtIsArray for more info.
VtValue provides a suite of "Cast" methods that convert or create a VtValue holding a requested type (via template parameter, typeid, or type-matching to another VtValue) from the type of the currently-held value. Clients can add conversions between their own types using the RegisterCast(), RegisterSimpleCast(), and RegisterSimpleBidirectionalCast() methods. Conversions from plugins can be guaranteed to be registered before they are needed by registering them from within a
block.
Conversions between most of the basic "value types" that are intrinsically convertible are builtin, including all numeric types (including Gf's half), std::string/TfToken, GfVec* (for vecs of the same dimension), and VtArray<T> for floating-point POD and GfVec of the preceding.
The conversions between all scalar numeric types are performed with range checks such as provided by boost::numeric_cast(), and will fail, returning an empty VtValue if the source value is out of range of the destination type.
Conversions between GfVec and other compound-numeric types provide no more or less safety or checking than the conversion constructors of the types themselves. This includes VtArray, even VtArray<T> for T in scalar types that are range-checked when held singly.
|
inline |
|
inline |
|
inlinenoexcept |
|
inlineexplicit |
|
explicit |
Construct with VtValueRef.
|
inline |
Return if this can be cast to T.
|
inlinestatic |
Return if a value of type from can be cast to type to.
|
inline |
Return if this can be cast to type.
|
inline |
Return if this can be cast to type.
| VT_API bool VtValue::CanComposeOver | ( | ) | const |
Return true if this value holds a type that has been declared at compile time to support composing over other types. This is a fast check that can be used to avoid calling VtValueComposeOver(strong, weak) if strong does not support composing over. Empty VtValue always can compose over.
| VT_API bool VtValue::CanHash | ( | ) | const |
Return true if the held object provides a hash implementation.
| VT_API bool VtValue::CanTransform | ( | ) | const |
Return true if this value holds a type that has been declared to support value transforms at compile time. This is a fast check that can be used to avoid calling the relatively slower VtValueTryTransform(obj, xform) if obj does not support transforms at all. Empty VtValue does not support transforms.
|
inline |
Return this holding value type cast to T. This value is left empty if the cast fails.
|
static |
|
inline |
Return this holding value type cast to type. This value is left empty if the cast fails.
Return this holding value type cast to same type that other is holding. This value is left empty if the cast fails.
|
inline |
Returns a const reference to the held object if the held object is of type T. Issues an error and returns a const reference to a default value if the held object is not of type T. Use IsHolding to verify correct type before calling this function. The default value returned in case of type mismatch is constructed using Vt_DefaultValueFactory<T>. That may be specialized for client types. The default implementation of the default value factory produces a value-initialized T.
|
inline |
|
inline |
Return the number of elements in the held value if IsArrayValued(), return 0 otherwise.
| VT_API std::type_info const& VtValue::GetElementTypeid | ( | ) | const |
If this value holds a VtArray or VtArrayEdit instance, return the typeid of its element type. For example, if this value holds a VtIntArray or a VtIntArrayEdit, return typeid(int). Otherwise return typeid(void).
| VT_API size_t VtValue::GetHash | ( | ) | const |
Return a hash code for the held object by calling VtHashValue() on it.
|
inline |
| VT_API std::type_info const& VtValue::GetTypeid | ( | ) | const |
Return the typeid of the type held by this value.
| VT_API std::string VtValue::GetTypeName | ( | ) | const |
Return the type name of the held typeid.
| VT_API bool VtValue::IsArrayEditValued | ( | ) | const |
Return true if this holds a VtArrayEdit instance, false otherwise.
| VT_API bool VtValue::IsArrayValued | ( | ) | const |
Return true if this holds a VtArray instance, false otherwise.
|
inline |
|
inline |
|
inline |
| VT_API VtValue::operator VtValueRef | ( | ) | const |
Implicitly convert to VtValueRef.
| VT_API VtValue::operator VtValueRef | ( | ) |
Implicitly convert to an rvalue VtValueRef.
|
inline |
| VT_API VtValue& VtValue::operator= | ( | VtValueRef | ref | ) |
Assignment from VtValueRef.
| PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE VtValue& VtValue::operator= | ( | T const & | obj | ) |
|
delete |
|
inline |
| VT_API VtValueRef VtValue::Ref | ( | ) | const |
Return a VtValueRef that refers to the current object held by this VtValue. The returned VtValueRef is invalidated and must not be used after this VtValue is modified or destroyed.
| VT_API VtValueRef VtValue::Ref | ( | ) |
Return a VtValueRef that refers to the current object held by this rvalue VtValue. The returned VtValueRef is invalidated and must not be used after this VtValue is modified or destroyed.
|
inlinestatic |
|
inlinestatic |
|
inline |
Create a new VtValue, taking its contents from obj.
This is equivalent to creating a VtValue holding a value-initialized T instance, then invoking swap(<held-value>, obj), leaving obj in a default-constructed (value-initialized) state. In the case that obj is expensive to copy, it may be significantly faster to use this idiom when obj need not retain its contents:
Rather than:
|
inline |
Returns a const reference to the held object if the held object is of type T. Invokes undefined behavior otherwise. This is the fastest Get() method to use after a successful IsHolding() check.
|
inline |
|
inline |
|
inline |
|
inline |
Calls through to operator << on the held object.
|
friend |
|
friend |