7 #ifndef PXR_BASE_TF_PY_NOTICE_WRAPPER_H
8 #define PXR_BASE_TF_PY_NOTICE_WRAPPER_H
19 #include "pxr/external/boost/python/bases.hpp"
20 #include "pxr/external/boost/python/class.hpp"
21 #include "pxr/external/boost/python/extract.hpp"
22 #include "pxr/external/boost/python/handle.hpp"
24 #include <type_traits>
38 (*_generators)[
typeid(
T).
name()] = This::_Generate<T>;
63 template <
class Notice>
67 using namespace pxr_boost::python;
69 Notice
const *wrapper =
static_cast<Notice
const *
>(objPtr);
70 return wrapper ?
object(wrapper->GetNoticePythonObject()) :
object();
74 template <
typename NoticeType,
typename BaseType>
79 "Notice type must be derived from or equal to TfNotice.");
83 "BaseType type must be derived from or equal to TfNotice.");
88 "BaseType type must be a base of notice, unless both "
89 "BaseType and Notice type are equal to TfNotice.");
98 pxr_boost::python::bases<>,
99 pxr_boost::python::bases<BaseType>>;
101 typedef pxr_boost::python::class_<NoticeType, This, Bases>
ClassType;
104 std::string wrappedName =
name;
105 if (wrappedName.empty()) {
107 wrappedName = TfType::Find<NoticeType>().GetTypeName();
111 Tf_PyNoticeObjectGenerator::Register<NoticeType>();
115 return ClassType(wrappedName.c_str(), pxr_boost::python::no_init)
122 return pxr_boost::python::handle<>(pxr_boost::python::borrowed(_self));
127 template <
typename... Args>
129 : NoticeType(
args...)
137 #define TF_INSTANTIATE_NOTICE_WRAPPER(T, Base) \
138 TF_REGISTRY_FUNCTION(TfType) \
140 TfType::Define< TfPyNoticeWrapper<T, Base>, \
141 TfType::Bases<Base> >(); \
146 #endif // PXR_BASE_TF_PY_NOTICE_WRAPPER_H
TF_API std::string TfStringGetSuffix(const std::string &name, char delimiter= '.')
GLsizei const GLfloat * value
TfPyNoticeWrapper(PyObject *self, Args...args)
virtual ~Tf_PyNoticeObjectFinder()
TF_API void Tf_RegisterPythonObjectFinderInternal(std::type_info const &type, Tf_PyObjectFinderBase const *finder)
TfPyNoticeWrapper< NoticeType, BaseType > This
static TF_API pxr_boost::python::object Invoke(TfNotice const &n)
static ClassType Wrap(std::string const &name=std::string())
Tf_PyNoticeObjectGenerator This
GLuint const GLchar * name
virtual pxr_boost::python::handle GetNoticePythonObject() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
pxr_boost::python::class_< NoticeType, This, Bases > ClassType
pxr_boost::python::object(* MakeObjectFunc)(TfNotice const &)
virtual pxr_boost::python::handle GetNoticePythonObject() const =0
#define PXR_NAMESPACE_CLOSE_SCOPE
**If you just want to fire and args
virtual TF_API ~TfPyNoticeWrapperBase()
virtual pxr_boost::python::object Find(void const *objPtr) const
std::conditional_t< std::is_same< NoticeType, TfNotice >::value, pxr_boost::python::bases<>, pxr_boost::python::bases< BaseType >> Bases