7 #ifndef PXR_USD_SDF_DECLARE_HANDLES_H
8 #define PXR_USD_SDF_DECLARE_HANDLES_H
23 #include <type_traits>
83 return const_cast<SpecType*
>(&_spec);
104 return _spec.IsDormant() ? 0 : &This::_spec;
110 return _spec.IsDormant();
117 return _spec == other._spec;
123 return !(lhs == rhs);
129 bool operator<(const SdfHandle<U>& other)
const
131 return _spec < other._spec;
161 nullptr : const_cast<SpecType*>(&x._spec);
185 template <
typename T>
196 template <
typename T>
204 template<
class DST,
class SRC>
212 const SdfSpec& srcSpec,
const std::type_info& destType);
216 const SdfSpec& srcSpec,
const std::type_info& destType);
218 template <
class DST,
class SRC>
220 : std::integral_constant<bool,
221 std::is_base_of<DST, SRC>::value ||
222 std::is_base_of<SRC, DST>::value>
235 template <
typename DST,
typename SRC>
240 typedef typename DST::SpecType Spec;
244 return Handle(Sdf_CastAccess::CastSpec<Spec,SRC>(x.
GetSpec()));
250 template <
typename DST,
typename SRC>
262 template <
typename DST,
typename SRC>
267 typedef typename DST::SpecType Spec;
270 "Spec and SRC must be directly related.");
272 return Handle(Sdf_CastAccess::CastSpec<Spec,SRC>(x.
GetSpec()));
275 template <
typename T>
287 template <
typename DST,
typename SRC>
292 typedef typename DST::SpecType Spec;
296 return Handle(Sdf_CastAccess::CastSpec<Spec,SRC>(x.
GetSpec()));
305 template <
typename DST,
typename SRC>
310 typedef typename DST::SpecType Spec;
312 return Handle(Sdf_CastAccess::CastSpec<Spec,SRC>(x.
GetSpec()));
316 template <
typename DST_SPEC,
typename SRC_SPEC>
321 return Sdf_CastAccess::CastSpec<DST_SPEC,SRC_SPEC>(
x);
328 #define SDF_DECLARE_HANDLES(cls) \
329 typedef SdfHandleTo<class cls>::Handle cls##Handle; \
330 typedef SdfHandleTo<class cls>::ConstHandle cls##ConstHandle; \
331 typedef SdfHandleTo<class cls>::Vector cls##HandleVector; \
332 typedef SdfHandleTo<class cls>::ConstVector cls##ConstHandleVector
336 #endif // PXR_USD_SDF_DECLARE_HANDLES_H
friend bool operator>=(const SdfHandle &lhs, const SdfHandle &rhs)
SdfHandle(const SpecType &spec)
std::vector< ConstHandle > ConstVector
SdfHandle< NonConstSpecType > NonConstThis
SdfHandle< typename DST::SpecType > TfStatic_cast(const SdfHandle< SRC > &x)
SdfHandleTo< T >::Handle SdfCreateHandle(T *p)
SpecType * operator->() const
ARCH_API std::string ArchGetDemangled(const std::string &typeName)
std::set< SdfHandleTo< SdfLayer >::Handle > SdfLayerHandleSet
TfWeakPtr< SdfLayer > Handle
SdfHandle< typename DST::SpecType > TfSafeDynamic_cast(const SdfHandle< SRC > &x)
std::vector< ConstHandle > ConstVector
friend bool operator<=(const SdfHandle &lhs, const SdfHandle &rhs)
std::vector< Handle > Vector
std::vector< TfRefPtr< SdfLayer > > SdfLayerRefPtrVector
SdfHandle< typename DST::SpecType > TfDynamic_cast(const SdfHandle< SRC > &x)
friend SpecType * get_pointer(const SdfHandle &x)
static DST CastSpec(const SRC &spec)
friend bool operator>(const SdfHandle &lhs, const SdfHandle &rhs)
SDF_API bool Sdf_CanCastToTypeCheckSchema(const SdfSpec &srcSpec, const std::type_info &destType)
SdfHandle< typename DST::SpecType > SdfSpecDynamic_cast(const SdfHandle< SRC > &x)
std::remove_const< SpecType >::type NonConstSpecType
SDF_API bool Sdf_CanCastToType(const SdfSpec &srcSpec, const std::type_info &destType)
SdfHandle(const SdfHandle< U > &x)
SdfHandleTo< T >::Handle SdfCreateNonConstHandle(T const *p)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
friend bool operator!=(const SdfHandle &lhs, const SdfHandle &rhs)
SdfHandle(const Sdf_IdentityRefPtr &id)
This & operator=(const SdfHandle< U > &x)
TfWeakPtr< const SdfLayer > ConstHandle
SdfHandle< typename T::SpecType > TfConst_cast(const SdfHandle< const typename T::SpecType > &x)
SpecType This::* UnspecifiedBoolType
#define PXR_NAMESPACE_CLOSE_SCOPE
OIIO_UTIL_API const char * c_str(string_view str)
SdfHandle< const T > ConstHandle
const SpecType & GetSpec() const
TfRefPtr< SdfLayer > SdfLayerRefPtr
std::vector< Handle > Vector
friend size_t hash_value(const This &x)
Hash.
SdfHandle< typename DST::SpecType > SdfSpecStatic_cast(const SdfHandle< SRC > &x)
bool operator==(const SdfHandle< U > &other) const
Compares handles for equality.
This & operator=(const This &x)