MLIR
22.0.0git
|
Provides a facility like nanobind::class_ for defining a new class in a scope, but this allows extension of an arbitrary Python class, defining methods on it is a similar way. More...
#include "mlir/Bindings/Python/NanobindAdaptors.h"
Public Member Functions | |
pure_subclass (nanobind::handle scope, const char *derivedClassName, const nanobind::object &superClass) | |
template<typename Func , typename... Extra> | |
pure_subclass & | def (const char *name, Func &&f, const Extra &...extra) |
template<typename Func , typename... Extra> | |
pure_subclass & | def_property_readonly (const char *name, Func &&f, const Extra &...extra) |
template<typename Func , typename... Extra> | |
pure_subclass & | def_staticmethod (const char *name, Func &&f, const Extra &...extra) |
template<typename Func , typename... Extra> | |
pure_subclass & | def_classmethod (const char *name, Func &&f, const Extra &...extra) |
nanobind::object | get_class () const |
Protected Attributes | |
nanobind::object | superClass |
nanobind::object | thisClass |
Provides a facility like nanobind::class_ for defining a new class in a scope, but this allows extension of an arbitrary Python class, defining methods on it is a similar way.
Classes defined in this way are very similar to if defined in Python in the usual way but use nanobind machinery to do it. These are not "real" nanobind classes but pure Python classes with no relation to a concrete C++ class.
Derived from a discussion upstream: https://github.com/pybind/pybind11/issues/1193 (plus a fair amount of extra curricular poking) TODO: If this proves useful, see about including it in nanobind.
Definition at line 373 of file NanobindAdaptors.h.
|
inline |
Definition at line 375 of file NanobindAdaptors.h.
References superClass, and thisClass.
|
inline |
Definition at line 389 of file NanobindAdaptors.h.
References thisClass.
Referenced by mlir::python::nanobind_adaptors::mlir_attribute_subclass::mlir_attribute_subclass(), and mlir::python::nanobind_adaptors::mlir_type_subclass::mlir_type_subclass().
|
inline |
Definition at line 424 of file NanobindAdaptors.h.
References thisClass.
Referenced by NB_MODULE(), populateDialectLLVMSubmodule(), populateDialectSMTSubmodule(), and populateDialectSparseTensorSubmodule().
|
inline |
Definition at line 398 of file NanobindAdaptors.h.
References thisClass.
Referenced by populateDialectSparseTensorSubmodule().
|
inline |
Definition at line 410 of file NanobindAdaptors.h.
References thisClass.
Referenced by mlir::python::nanobind_adaptors::mlir_attribute_subclass::mlir_attribute_subclass(), mlir::python::nanobind_adaptors::mlir_type_subclass::mlir_type_subclass(), and mlir::python::nanobind_adaptors::mlir_value_subclass::mlir_value_subclass().
|
inline |
Definition at line 438 of file NanobindAdaptors.h.
References thisClass.
|
protected |
Definition at line 441 of file NanobindAdaptors.h.
Referenced by pure_subclass().
|
protected |
Definition at line 442 of file NanobindAdaptors.h.
Referenced by def(), def_classmethod(), def_property_readonly(), def_staticmethod(), get_class(), mlir::python::nanobind_adaptors::mlir_attribute_subclass::mlir_attribute_subclass(), mlir::python::nanobind_adaptors::mlir_type_subclass::mlir_type_subclass(), mlir::python::nanobind_adaptors::mlir_value_subclass::mlir_value_subclass(), and pure_subclass().