Provides a container which may hold any type, and provides introspection and iteration over array types.
More...
|
| | VtValue () |
| | Default ctor gives empty VtValue.
|
| |
| | VtValue (VtValue const &other) |
| | Copy construct with other.
|
| |
| | VtValue (VtValue &&other) noexcept |
| | Move construct with other.
|
| |
| template<class T > |
| | VtValue (T const &obj) |
| | Construct a VtValue holding a copy of obj.
|
| |
| VT_API | VtValue (VtValueRef ref) |
| | Construct with VtValueRef.
|
| |
| | ~VtValue () |
| | Destructor.
|
| |
| VtValue & | operator= (VtValue const &other) |
| | Copy assignment from another VtValue.
|
| |
| VtValue & | operator= (VtValue &&other) noexcept |
| | Move assignment from another VtValue.
|
| |
| VT_API VtValue & | operator= (VtValueRef ref) |
| | Assignment from VtValueRef.
|
| |
| template<class T > |
| VtValue & | operator= (T const &obj) |
| | Assignment operator from any type.
|
| |
| VtValue & | Swap (VtValue &rhs) noexcept |
| | Swap this with rhs.
|
| |
| template<class T > |
| void | Swap (T &rhs) |
| | Swap the held value with rhs.
|
| |
| template<class T > |
| void | UncheckedSwap (T &rhs) |
| | Swap the held value with rhs.
|
| |
| void | UncheckedSwap (VtValue &rhs) |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
| |
| template<class T > |
| T | Remove () |
| | Make this value empty and return the held T instance.
|
| |
| template<class T > |
| T | UncheckedRemove () |
| | Make this value empty and return the held T instance.
|
| |
| template<class T , class Fn > |
| bool | Mutate (Fn &&mutateFn) |
| | If this value holds an object of type T, invoke mutateFn, passing it a non-const reference to the held object and return true.
|
| |
| template<class T , class Fn > |
| void | UncheckedMutate (Fn &&mutateFn) |
| | Invoke mutateFn, passing it a non-const reference to the held object which must be of type T.
|
| |
| template<class T > |
| bool | IsHolding () const |
| | Return true if this value is holding an object of type T, false otherwise.
|
| |
| VT_API bool | IsArrayValued () const |
| | Return true if this holds a VtArray instance, false otherwise.
|
| |
| VT_API bool | IsArrayEditValued () const |
| | Return true if this holds a VtArrayEdit instance, false otherwise.
|
| |
| size_t | GetArraySize () const |
| | Return the number of elements in the held value if IsArrayValued(), return 0 otherwise.
|
| |
| VT_API std::type_info const & | GetTypeid () const |
| | Return the typeid of the type held by this value.
|
| |
| VT_API std::type_info const & | GetElementTypeid () const |
| | If this value holds a VtArray or VtArrayEdit instance, return the typeid of its element type.
|
| |
| VT_API TfType | GetType () const |
| | Returns the TfType of the type held by this value.
|
| |
| VT_API std::string | GetTypeName () const |
| | Return the type name of the held typeid.
|
| |
| int | GetKnownValueTypeIndex () const |
| | Return VtKnownValueTypeIndex<T> for the held type T.
|
| |
| template<class T > |
| T const & | UncheckedGet () const & |
| | Returns a const reference to the held object if the held object is of type T.
|
| |
| template<class T > |
| T | UncheckedGet () && |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. In case *this is an rvalue, move the held value out and return by value.
|
| |
| template<class T > |
| T const & | Get () const & |
| | Returns a const reference to the held object if the held object is of type T.
|
| |
| template<class T > |
| T | Get () && |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. In case *this is an rvalue, move the held value out and return by value.
|
| |
| template<class T > |
| T | GetWithDefault (T const &def=T()) const |
| | Return a copy of the held object if the held object is of type T.
|
| |
| template<typename T > |
| VtValue & | Cast () |
| | Return this holding value type cast to T.
|
| |
| VtValue & | CastToTypeOf (VtValue const &other) |
| | Return this holding value type cast to same type that other is holding.
|
| |
| VtValue & | CastToTypeid (std::type_info const &type) |
| | Return this holding value type cast to type.
|
| |
| template<typename T > |
| bool | CanCast () const |
| | Return if this can be cast to T.
|
| |
| bool | CanCastToTypeOf (VtValue const &other) const |
| | Return if this can be cast to type.
|
| |
| bool | CanCastToTypeid (std::type_info const &type) const |
| | Return if this can be cast to type.
|
| |
| bool | IsEmpty () const |
| | Returns true iff this value is empty.
|
| |
| VT_API VtValueRef | Ref () const & |
| | Return a VtValueRef that refers to the current object held by this VtValue.
|
| |
| VT_API VtValueRef | Ref () && |
| | Return a VtValueRef that refers to the current object held by this rvalue VtValue.
|
| |
| VT_API | operator VtValueRef () const & |
| | Implicitly convert to VtValueRef.
|
| |
| VT_API | operator VtValueRef () && |
| | Implicitly convert to an rvalue VtValueRef.
|
| |
| VT_API bool | CanHash () const |
| | Return true if the held object provides a hash implementation.
|
| |
| VT_API size_t | GetHash () const |
| | Return a hash code for the held object by calling VtHashValue() on it.
|
| |
| VT_API bool | CanComposeOver () const |
| | Return true if this value holds a type that has been declared at compile time to support composing over other types.
|
| |
| VT_API bool | CanTransform () const |
| | Return true if this value holds a type that has been declared to support value transforms at compile time.
|
| |
| bool | operator== (const VtValue &rhs) const |
| | Test two values for equality.
|
| |
| bool | operator!= (const VtValue &rhs) const |
| |
|
template<> |
| VtValue & | operator= (VtValueRef const &obj)=delete |
| |
Provides a container which may hold any type, and provides introspection and iteration over array types.
See VtIsArray for more info.
Held-type Conversion with VtValue::Cast
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
}
Provides a container which may hold any type, and provides introspection and iteration over array typ...
#define TF_REGISTRY_FUNCTION(KEY_TYPE)
Define a function that is called on demand by TfRegistryManager.
block.
Builtin Type Conversion
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.
Numeric Conversion Safety
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.
Definition at line 89 of file value.h.