24 #ifndef PXR_BASE_TF_PY_OBJ_WRAPPER_H 25 #define PXR_BASE_TF_PY_OBJ_WRAPPER_H 29 #include "pxr/base/tf/api.h" 31 #ifdef PXR_PYTHON_SUPPORT_ENABLED 36 #include <boost/functional/hash.hpp> 37 #include <boost/python/object_fwd.hpp> 38 #include <boost/python/object_operators.hpp> 45 #include <type_traits> 49 PXR_NAMESPACE_OPEN_SCOPE
53 class TfPyObjWrapperStub
56 static constexpr std::size_t Size = 16;
57 static constexpr std::size_t Align = 8;
60 std::aligned_storage<Size, Align>::type _stub;
90 #ifdef PXR_PYTHON_SUPPORT_ENABLED 92 :
public boost::python::api::object_operators<TfPyObjWrapper>
94 typedef boost::python::object object;
112 object const &
Get()
const {
123 TF_API PyObject *
ptr()
const;
130 return (
size_t) o.
ptr();
145 friend class boost::python::api::object_operators<
TfPyObjWrapper>;
146 operator object const &()
const {
151 std::shared_ptr<object> _objectPtr;
154 static_assert(
sizeof(
TfPyObjWrapper) ==
sizeof(TfPyObjWrapperStub),
155 "ABI break: Incompatible class sizes.");
156 static_assert(
alignof(
TfPyObjWrapper) ==
alignof(TfPyObjWrapperStub),
157 "ABI break: Incompatible class alignments.");
159 #else // PXR_PYTHON_SUPPORT_ENABLED 165 #endif // PXR_PYTHON_SUPPORT_ENABLED 167 PXR_NAMESPACE_CLOSE_SCOPE
169 #endif // PXR_BASE_TF_PY_OBJ_WRAPPER_H TF_API bool operator!=(TfPyObjWrapper const &other) const
Inequality.
TF_API PyObject * ptr() const
Underlying PyObject* access.
TF_API TfPyObjWrapper()
Default construct a TfPyObjWrapper holding a reference to python None.
object const & Get() const
Underlying object access.
Intended to replace a direct include of Python.h, which causes several build problems with certain co...
friend size_t hash_value(TfPyObjWrapper const &o)
Produce a hash code for this object.
Boost Python object wrapper.
TF_API bool operator==(TfPyObjWrapper const &other) const
Equality.