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" 32 #ifdef PXR_PYTHON_SUPPORT_ENABLED 37 #include <boost/functional/hash.hpp> 38 #include <boost/python/object_fwd.hpp> 39 #include <boost/python/object_operators.hpp> 46 #include <type_traits> 50 PXR_NAMESPACE_OPEN_SCOPE
54 class TfPyObjWrapperStub
57 static constexpr std::size_t Size = 16;
58 static constexpr std::size_t Align = 8;
62 ARCH_PRAGMA_UNUSED_PRIVATE_FIELD
63 std::aligned_storage<Size, Align>::type _stub;
94 #ifdef PXR_PYTHON_SUPPORT_ENABLED 96 :
public boost::python::api::object_operators<TfPyObjWrapper>
98 typedef boost::python::object object;
116 object const &
Get()
const {
127 TF_API PyObject *
ptr()
const;
134 return (
size_t) o.
ptr();
149 friend class boost::python::api::object_operators<
TfPyObjWrapper>;
150 operator object const &()
const {
155 std::shared_ptr<object> _objectPtr;
158 static_assert(
sizeof(
TfPyObjWrapper) ==
sizeof(TfPyObjWrapperStub),
159 "ABI break: Incompatible class sizes.");
160 static_assert(
alignof(
TfPyObjWrapper) ==
alignof(TfPyObjWrapperStub),
161 "ABI break: Incompatible class alignments.");
163 #else // PXR_PYTHON_SUPPORT_ENABLED 169 #endif // PXR_PYTHON_SUPPORT_ENABLED 171 PXR_NAMESPACE_CLOSE_SCOPE
173 #endif // PXR_BASE_TF_PY_OBJ_WRAPPER_H Pragmas for controlling compiler-specific behaviors.
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.