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 .
|
|
| ~VtValue () |
| Destructor.
|
|
VtValue & | operator= (VtValue const &other) |
| Copy assignment from another VtValue.
|
|
VtValue & | operator= (VtValue &&other) noexcept |
| Move assignment from another VtValue.
|
|
template<class T > |
VtValue & | operator= (T const &obj) |
| Assignment operator from any type.
|
|
VtValue & | operator= (char const *cstr) |
| Assigning a char const * gives a VtValue holding a std::string.
|
|
VtValue & | operator= (char *cstr) |
| Assigning a char * gives a VtValue holding a std::string.
|
|
VtValue & | Swap (VtValue &rhs) noexcept |
| Swap this with rhs.
|
|
template<class T > |
void | Swap (T &rhs) |
| Swap the held value with rhs. If this value is holding a T,.
|
|
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 > |
std::enable_if_t< std::is_same< T, typename Vt_ValueGetStored< T >::Type >::value, 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 > |
std::enable_if_t< std::is_same< T, typename Vt_ValueGetStored< T >::Type >::value > | UncheckedMutate (Fn &&mutateFn) |
| Invoke mutateFn , 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 |
| Returns true iff this is holding an array type (see VtIsArray<>).
|
|
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 |
| Returns the typeid of the type held by this value.
|
|
VT_API std::type_info const & | GetElementTypeid () const |
| Return the typeid of elements in a array valued 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 () && |
|
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 () && |
|
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 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.
|
|
bool | operator== (const VtValue &rhs) const |
| Test two values for equality.
|
|
bool | operator!= (const VtValue &rhs) const |
|
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 163 of file value.h.