MLIR  20.0.0git
Public Member Functions | List of all members
mlir::python::PyObjectRef< T > Class Template Reference

Template for a reference to a concrete type which captures a python reference to its underlying python object. More...

#include "Bindings/Python/IRModule.h"

+ Inheritance diagram for mlir::python::PyObjectRef< T >:

Public Member Functions

 PyObjectRef (T *referrent, nanobind::object object)
 
 PyObjectRef (PyObjectRef &&other) noexcept
 
 PyObjectRef (const PyObjectRef &other)
 
 ~PyObjectRef ()=default
 
int getRefCount ()
 
nanobind::object releaseObject ()
 Releases the object held by this instance, returning it. More...
 
T * get ()
 
T * operator-> ()
 
nanobind::object getObject ()
 
 operator bool () const
 

Detailed Description

template<typename T>
class mlir::python::PyObjectRef< T >

Template for a reference to a concrete type which captures a python reference to its underlying python object.

Definition at line 50 of file IRModule.h.

Constructor & Destructor Documentation

◆ PyObjectRef() [1/3]

template<typename T >
mlir::python::PyObjectRef< T >::PyObjectRef ( T *  referrent,
nanobind::object  object 
)
inline

Definition at line 52 of file IRModule.h.

◆ PyObjectRef() [2/3]

template<typename T >
mlir::python::PyObjectRef< T >::PyObjectRef ( PyObjectRef< T > &&  other)
inlinenoexcept

Definition at line 58 of file IRModule.h.

◆ PyObjectRef() [3/3]

template<typename T >
mlir::python::PyObjectRef< T >::PyObjectRef ( const PyObjectRef< T > &  other)
inline

Definition at line 63 of file IRModule.h.

◆ ~PyObjectRef()

template<typename T >
mlir::python::PyObjectRef< T >::~PyObjectRef ( )
default

Member Function Documentation

◆ get()

template<typename T >
T* mlir::python::PyObjectRef< T >::get ( )
inline

Definition at line 83 of file IRModule.h.

Referenced by maybeInsertOperation().

◆ getObject()

template<typename T >
nanobind::object mlir::python::PyObjectRef< T >::getObject ( )
inline

◆ getRefCount()

template<typename T >
int mlir::python::PyObjectRef< T >::getRefCount ( )
inline

Definition at line 67 of file IRModule.h.

◆ operator bool()

template<typename T >
mlir::python::PyObjectRef< T >::operator bool ( ) const
inline

Definition at line 92 of file IRModule.h.

◆ operator->()

template<typename T >
T* mlir::python::PyObjectRef< T >::operator-> ( )
inline

Definition at line 84 of file IRModule.h.

◆ releaseObject()

template<typename T >
nanobind::object mlir::python::PyObjectRef< T >::releaseObject ( )
inline

Releases the object held by this instance, returning it.

This is the proper thing to return from a function that wants to return the reference. Note that this does not work from initializers.

Definition at line 76 of file IRModule.h.

Referenced by mlir::python::PyMlirContext::createFromCapsule(), mlir::python::PyModule::createFromCapsule(), mlir::python::PyOperation::createFromCapsule(), and mlir::python::PyConcreteOpInterface< ConcreteIface >::getOperationObject().


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