24 #ifndef PXR_BASE_TF_PY_OVERRIDE_H 25 #define PXR_BASE_TF_PY_OVERRIDE_H 29 #include "pxr/base/tf/pyLock.h" 30 #include "pxr/base/tf/pyObjWrapper.h" 32 #include <boost/python/override.hpp> 34 PXR_NAMESPACE_OPEN_SCOPE
68 boost::python::converter::return_from_python<T> converter;
69 return converter(m_obj.release());
76 boost::python::converter::return_from_python<T&> converter;
78 const_cast<boost::python::handle<>&
>(m_obj).release());
82 T as(boost::type<T>* = 0)
85 boost::python::converter::return_from_python<T> converter;
86 return converter(m_obj.release());
90 T unchecked(boost::type<T>* = 0)
93 return boost::python::extract<T>(m_obj)();
97 mutable boost::python::handle<> m_obj;
117 template <
typename Arg>
118 constexpr
static char _PyObjArg()
131 template <
typename... Args>
138 static const char pyCallFormat[] =
139 {
'(', _PyObjArg<Args>()...,
')',
'\0' };
144 const_cast<char*>(pyCallFormat),
145 boost::python::converter::arg_to_python<Args>(args).get()...));
150 PXR_NAMESPACE_CLOSE_SCOPE
152 #endif // PXR_BASE_TF_PY_OVERRIDE_H TfPyMethodResult & operator=(TfPyMethodResult const &other)
Implement assign to do python refcounting while holding the GIL.
TF_API PyObject * ptr() const
Underlying PyObject* access.
TfPyOverride(boost::python::handle<> callable)
Clients must hold the GIL to construct.
A reimplementation of boost::python::override.
Convenience class for accessing the Python Global Interpreter Lock.
TfPyMethodResult operator()(Args const &... args) const
Call the override.
~TfPyMethodResult()
Implement dtor to do python refcounting while holding the GIL.
Boost Python object wrapper.
A reimplementation of boost::python::detail::method_result.