7 #ifndef PXR_BASE_TF_PY_OVERRIDE_H
8 #define PXR_BASE_TF_PY_OVERRIDE_H
15 #include "pxr/external/boost/python/override.hpp"
16 #include "pxr/external/boost/python/type.hpp"
52 pxr_boost::python::converter::return_from_python<T> converter;
53 return converter(m_obj.release());
60 pxr_boost::python::converter::return_from_python<T&> converter;
62 const_cast<pxr_boost::python::handle<>&
>(m_obj).release());
66 T as(pxr_boost::python::type<T>* = 0)
69 pxr_boost::python::converter::return_from_python<T> converter;
70 return converter(m_obj.release());
77 return pxr_boost::python::extract<T>(m_obj)();
81 mutable pxr_boost::python::handle<> m_obj;
101 template <
typename Arg>
102 constexpr
static char _PyObjArg()
115 template <
typename... Args>
122 static const char pyCallFormat[] =
123 {
'(', _PyObjArg<Args>()...,
')',
'\0' };
128 const_cast<char*>(pyCallFormat),
129 pxr_boost::python::converter::arg_to_python<Args>(args).
get()...));
136 #endif // PXR_BASE_TF_PY_OVERRIDE_H
TfPyMethodResult & operator=(TfPyMethodResult const &other)
Implement assign to do python refcounting while holding the GIL.
T as(pxr_boost::python::type< T > *=0)
~TfPyMethodResult()
Implement dtor to do python refcounting while holding the GIL.
TfPyMethodResult operator()(Args const &...args) const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
T unchecked(pxr_boost::python::type< T > *=0)
#define PXR_NAMESPACE_CLOSE_SCOPE
**If you just want to fire and args
TfPyOverride(pxr_boost::python::handle<> callable)
Clients must hold the GIL to construct.