7#ifndef PXR_BASE_TF_PY_OBJ_WRAPPER_H
8#define PXR_BASE_TF_PY_OBJ_WRAPPER_H
12#include "pxr/base/tf/api.h"
15#ifdef PXR_PYTHON_SUPPORT_ENABLED
20#include "pxr/external/boost/python/object_fwd.hpp"
21#include "pxr/external/boost/python/object_operators.hpp"
32PXR_NAMESPACE_OPEN_SCOPE
36class TfPyObjWrapperStub
39 static constexpr std::size_t Size = 16;
40 static constexpr std::size_t Align = 8;
44 ARCH_PRAGMA_UNUSED_PRIVATE_FIELD
45 std::aligned_storage<Size, Align>::type _stub;
76#ifdef PXR_PYTHON_SUPPORT_ENABLED
78 :
public pxr_boost::python::api::object_operators<TfPyObjWrapper>
80 typedef pxr_boost::python::object object;
98 object const &
Get()
const {
109 TF_API PyObject *
ptr()
const;
116 return (
size_t) o.
ptr();
131 friend class pxr_boost::python::api::object_operators<
TfPyObjWrapper>;
132 operator object const &()
const {
137 std::shared_ptr<object> _objectPtr;
140static_assert(
sizeof(
TfPyObjWrapper) ==
sizeof(TfPyObjWrapperStub),
141 "ABI break: Incompatible class sizes.");
142static_assert(
alignof(
TfPyObjWrapper) ==
alignof(TfPyObjWrapperStub),
143 "ABI break: Incompatible class alignments.");
153PXR_NAMESPACE_CLOSE_SCOPE
Boost Python object wrapper.
TF_API bool operator==(TfPyObjWrapper const &other) const
Equality.
TF_API PyObject * ptr() const
Underlying PyObject* access.
friend size_t hash_value(TfPyObjWrapper const &o)
Produce a hash code for this object.
object const & Get() const
Underlying object access.
TF_API bool operator!=(TfPyObjWrapper const &other) const
Inequality.
TF_API TfPyObjWrapper()
Default construct a TfPyObjWrapper holding a reference to python None.
TF_API TfPyObjWrapper(object obj)
Construct a TfPyObjectWrapper wrapping obj.
Pragmas for controlling compiler-specific behaviors.
Intended to replace a direct include of Python.h, which causes several build problems with certain co...