|
HDK
|
Include dependency graph for visitValue.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Namespaces | |
| Vt_ValueVisitDetail | |
Macros | |
| #define | VT_CASE_FOR_TYPE_INDEX(unused, elem) |
| #define | VT_CASE_FOR_TYPE_INDEX(unused, elem) |
| #define | VT_CASE_FOR_TYPE_INDEX(unused, elem) |
Functions | |
| template<class T , class Visitor , class... Args> | |
| auto | Vt_ValueVisitDetail::Visit (VtValue const &val, Visitor &&visitor, int, Args &&...args) -> decltype(std::forward< Visitor >(visitor)(val.UncheckedGet< T >(), std::forward< Args >(args)...)) |
| template<class T , class Visitor , class... Args> | |
| auto | Vt_ValueVisitDetail::Visit (VtValue const &val, Visitor &&visitor, long, Args &&...args) |
| template<class Visitor , class... Args> | |
| auto | VtVisitValue (VtValue const &value, Visitor &&visitor, Args &&...args) |
| template<template< class T, class...> class Visitor, typename... TypeArgs, typename... FnArgs> | |
| auto | VtVisitValueType (VtValue const &value, FnArgs &&...args) |
| template<template< class T, template< class...> class, class...> class Visitor, template< class...> class Tmpl, typename... TypeArgs, typename... FnArgs> | |
| auto | VtVisitValueType (VtValue const &value, FnArgs &&...args) |
| #define VT_CASE_FOR_TYPE_INDEX | ( | unused, | |
| elem | |||
| ) |
| #define VT_CASE_FOR_TYPE_INDEX | ( | unused, | |
| elem | |||
| ) |
| #define VT_CASE_FOR_TYPE_INDEX | ( | unused, | |
| elem | |||
| ) |
| auto VtVisitValue | ( | VtValue const & | value, |
| Visitor && | visitor, | ||
| Args &&... | args | ||
| ) |
Invoke visitor with value's held object if value holds an object of one of the "known" value types (those in VT_VALUE_TYPES, see vt/types.h). If value does not hold a known type, or if it is empty, or if visitor cannot be called with an object of the held type, then call visitor with value itself. Note this means that visitor must be callable with a VtValue argument.
VtVisitValue() can be lower overhead compared to a chained-if of VtValue::IsHolding() calls, or a hash-table-lookup dispatch. Additionally, visitors can handle related types with a single case, rather than calling out all types individually. For example:
Note that the visitor is invoked as a normal C++ call expression, so implicit conversions and standard overload resolution (including controlling overload resolution via techniques like enable_if) can take place. For example, consider the following, where the double-specific overload is invoked for VtValues holding double, float, and GfHalf.
Any additional passed arguments following the visitor are forwarded to it.
Definition at line 109 of file visitValue.h.
| auto VtVisitValueType | ( | VtValue const & | value, |
| FnArgs &&... | args | ||
| ) |
Invoke Visitor<T, ...>::Visit(...) with T being value 's held object's type if value holds an object of one of the "known" value types (those in VT_VALUE_TYPES, see vt/types.h). If value does not hold a known type or if it is empty, then invoke Visitor with T == VtValue.
VtVisitValueType() can be lower overhead compared to a chained-if of VtValue::IsHolding() calls, or a hash-table-lookup dispatch. Additionally, visitors can use partial template specialization to handle related types with a single case, rather than calling out all types individually. For example:
Any explicitly passed template arguments are passed to Visitor and function are forwarded to Visit().
Definition at line 187 of file visitValue.h.
| auto VtVisitValueType | ( | VtValue const & | value, |
| FnArgs &&... | args | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This overload accepts a leading class template argument that is passed along to the Visitor as its second template argument. This can be useful to invoke factories that instantiate types dependent on the VtValue held-type. For example:
Definition at line 243 of file visitValue.h.