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>
42 #include <hboost/operators.hpp>
63 class SdfHandle :
private hboost::totally_ordered<SdfHandle<T> > {
101 return const_cast<SpecType*
>(&_spec);
114 #if !defined(doxygen)
122 return _spec.IsDormant() ? 0 : &This::_spec;
128 return _spec.IsDormant();
135 return _spec == other._spec;
141 bool operator<(const SdfHandle<U>& other)
const
143 return _spec < other._spec;
155 nullptr : const_cast<SpecType*>(&x._spec);
189 template <
typename T>
200 template <
typename T>
208 template<
class DST,
class SRC>
216 const SdfSpec& srcSpec,
const std::type_info& destType);
220 const SdfSpec& srcSpec,
const std::type_info& destType);
222 template <
class DST,
class SRC>
224 : std::integral_constant<bool,
225 std::is_base_of<DST, SRC>::value ||
226 std::is_base_of<SRC, DST>::value>
239 template <
typename DST,
typename SRC>
244 typedef typename DST::SpecType Spec;
248 return Handle(Sdf_CastAccess::CastSpec<Spec,SRC>(x.
GetSpec()));
254 template <
typename DST,
typename SRC>
266 template <
typename DST,
typename SRC>
271 typedef typename DST::SpecType Spec;
274 "Spec and SRC must be directly related.");
276 return Handle(Sdf_CastAccess::CastSpec<Spec,SRC>(x.
GetSpec()));
279 template <
typename T>
291 template <
typename DST,
typename SRC>
296 typedef typename DST::SpecType Spec;
300 return Handle(Sdf_CastAccess::CastSpec<Spec,SRC>(x.
GetSpec()));
309 template <
typename DST,
typename SRC>
314 typedef typename DST::SpecType Spec;
316 return Handle(Sdf_CastAccess::CastSpec<Spec,SRC>(x.
GetSpec()));
320 template <
typename DST_SPEC,
typename SRC_SPEC>
325 return Sdf_CastAccess::CastSpec<DST_SPEC,SRC_SPEC>(
x);
332 #define SDF_DECLARE_HANDLES(cls) \
333 typedef SdfHandleTo<class cls>::Handle cls##Handle; \
334 typedef SdfHandleTo<class cls>::ConstHandle cls##ConstHandle; \
335 typedef SdfHandleTo<class cls>::Vector cls##HandleVector; \
336 typedef SdfHandleTo<class cls>::ConstVector cls##ConstHandleVector
340 #endif // PXR_USD_SDF_DECLARE_HANDLES_H
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
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)
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
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)