MLIR  19.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
mlir::python::PyConcreteAttribute< DerivedTy, BaseTy > Class Template Reference

CRTP base classes for Python attributes that subclass Attribute and should be castable from it (i.e. More...

#include "Bindings/Python/IRModule.h"

+ Inheritance diagram for mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >:

Public Types

using ClassTy = pybind11::class_< DerivedTy, BaseTy >
 
using IsAFunctionTy = bool(*)(MlirAttribute)
 
using GetTypeIDFunctionTy = MlirTypeID(*)()
 

Public Member Functions

 PyConcreteAttribute ()=default
 
 PyConcreteAttribute (PyMlirContextRef contextRef, MlirAttribute attr)
 
 PyConcreteAttribute (PyAttribute &orig)
 
- Public Member Functions inherited from mlir::python::PyAttribute
 PyAttribute (PyMlirContextRef contextRef, MlirAttribute attr)
 
bool operator== (const PyAttribute &other) const
 
 operator MlirAttribute () const
 
MlirAttribute get () const
 
pybind11::object getCapsule ()
 Gets a capsule wrapping the void* within the MlirAttribute. More...
 
- Public Member Functions inherited from mlir::python::BaseContextObject
 BaseContextObject (PyMlirContextRef ref)
 
PyMlirContextRefgetContext ()
 Accesses the context reference. More...
 

Static Public Member Functions

static MlirAttribute castFrom (PyAttribute &orig)
 
static void bind (pybind11::module &m)
 
static void bindDerived (ClassTy &m)
 Implemented by derived classes to add methods to the Python subclass. More...
 
- Static Public Member Functions inherited from mlir::python::PyAttribute
static PyAttribute createFromCapsule (pybind11::object capsule)
 Creates a PyAttribute from the MlirAttribute wrapped by a capsule. More...
 

Static Public Attributes

static constexpr GetTypeIDFunctionTy getTypeIdFunction = nullptr
 

Detailed Description

template<typename DerivedTy, typename BaseTy = PyAttribute>
class mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >

CRTP base classes for Python attributes that subclass Attribute and should be castable from it (i.e.

via something like StringAttr(attr)). By default, attribute class hierarchies are one level deep (i.e. a concrete attribute class extends PyAttribute); however, intermediate python-visible base classes can be modeled by specifying a BaseTy.

Definition at line 1052 of file IRModule.h.

Member Typedef Documentation

◆ ClassTy

template<typename DerivedTy , typename BaseTy = PyAttribute>
using mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::ClassTy = pybind11::class_<DerivedTy, BaseTy>

Definition at line 1057 of file IRModule.h.

◆ GetTypeIDFunctionTy

template<typename DerivedTy , typename BaseTy = PyAttribute>
using mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::GetTypeIDFunctionTy = MlirTypeID (*)()

Definition at line 1059 of file IRModule.h.

◆ IsAFunctionTy

template<typename DerivedTy , typename BaseTy = PyAttribute>
using mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::IsAFunctionTy = bool (*)(MlirAttribute)

Definition at line 1058 of file IRModule.h.

Constructor & Destructor Documentation

◆ PyConcreteAttribute() [1/3]

template<typename DerivedTy , typename BaseTy = PyAttribute>
mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::PyConcreteAttribute ( )
default

◆ PyConcreteAttribute() [2/3]

template<typename DerivedTy , typename BaseTy = PyAttribute>
mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::PyConcreteAttribute ( PyMlirContextRef  contextRef,
MlirAttribute  attr 
)
inline

Definition at line 1063 of file IRModule.h.

◆ PyConcreteAttribute() [3/3]

template<typename DerivedTy , typename BaseTy = PyAttribute>
mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::PyConcreteAttribute ( PyAttribute orig)
inline

Definition at line 1065 of file IRModule.h.

Member Function Documentation

◆ bind()

template<typename DerivedTy , typename BaseTy = PyAttribute>
static void mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::bind ( pybind11::module &  m)
inlinestatic

Definition at line 1079 of file IRModule.h.

◆ bindDerived()

template<typename DerivedTy , typename BaseTy = PyAttribute>
static void mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::bindDerived ( ClassTy m)
inlinestatic

Implemented by derived classes to add methods to the Python subclass.

Definition at line 1124 of file IRModule.h.

◆ castFrom()

template<typename DerivedTy , typename BaseTy = PyAttribute>
static MlirAttribute mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::castFrom ( PyAttribute orig)
inlinestatic

Definition at line 1068 of file IRModule.h.

Member Data Documentation

◆ getTypeIdFunction

template<typename DerivedTy , typename BaseTy = PyAttribute>
constexpr GetTypeIDFunctionTy mlir::python::PyConcreteAttribute< DerivedTy, BaseTy >::getTypeIdFunction = nullptr
staticconstexpr

Definition at line 1060 of file IRModule.h.


The documentation for this class was generated from the following file: