24 #ifndef PXR_USD_SDF_DECLARE_HANDLES_H
25 #define PXR_USD_SDF_DECLARE_HANDLES_H
39 #include <type_traits>
41 #include <hboost/intrusive_ptr.hpp>
100 return const_cast<SpecType*
>(&_spec);
113 #if !defined(doxygen)
121 return _spec.IsDormant() ? 0 : &This::_spec;
127 return _spec.IsDormant();
134 return _spec == other._spec;
140 return !(lhs == rhs);
146 bool operator<(const SdfHandle<U>& other)
const
148 return _spec < other._spec;
178 nullptr : const_cast<SpecType*>(&x._spec);
212 template <
typename T>
223 template <
typename T>
231 template<
class DST,
class SRC>
239 const SdfSpec& srcSpec,
const std::type_info& destType);
243 const SdfSpec& srcSpec,
const std::type_info& destType);
245 template <
class DST,
class SRC>
247 : std::integral_constant<bool,
248 std::is_base_of<DST, SRC>::value ||
249 std::is_base_of<SRC, DST>::value>
262 template <
typename DST,
typename SRC>
267 typedef typename DST::SpecType Spec;
271 return Handle(Sdf_CastAccess::CastSpec<Spec,SRC>(x.
GetSpec()));
277 template <
typename DST,
typename SRC>
289 template <
typename DST,
typename SRC>
294 typedef typename DST::SpecType Spec;
297 "Spec and SRC must be directly related.");
299 return Handle(Sdf_CastAccess::CastSpec<Spec,SRC>(x.
GetSpec()));
302 template <
typename T>
314 template <
typename DST,
typename SRC>
319 typedef typename DST::SpecType Spec;
323 return Handle(Sdf_CastAccess::CastSpec<Spec,SRC>(x.
GetSpec()));
332 template <
typename DST,
typename SRC>
337 typedef typename DST::SpecType Spec;
339 return Handle(Sdf_CastAccess::CastSpec<Spec,SRC>(x.
GetSpec()));
343 template <
typename DST_SPEC,
typename SRC_SPEC>
348 return Sdf_CastAccess::CastSpec<DST_SPEC,SRC_SPEC>(
x);
355 #define SDF_DECLARE_HANDLES(cls) \
356 typedef SdfHandleTo<class cls>::Handle cls##Handle; \
357 typedef SdfHandleTo<class cls>::ConstHandle cls##ConstHandle; \
358 typedef SdfHandleTo<class cls>::Vector cls##HandleVector; \
359 typedef SdfHandleTo<class cls>::ConstVector cls##ConstHandleVector
363 #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
hboost::intrusive_ptr< Sdf_Identity > Sdf_IdentityRefPtr
SdfHandle< typename DST::SpecType > TfSafeDynamic_cast(const SdfHandle< SRC > &x)
Y * get_pointer(TfWeakPtrFacade< X, Y > const &p)
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
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)