MLIR 22.0.0git
mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::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 "mlir/Bindings/Python/IRCore.h"

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

Public Types

using NBTypedT = nanobind::typed<nanobind::object, 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.
T * get ()
T * operator-> ()
nanobind::object getObject ()
 operator bool () const

Detailed Description

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

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

Definition at line 68 of file IRCore.h.

Member Typedef Documentation

◆ NBTypedT

template<typename T>
using mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyObjectRef< T >::NBTypedT = nanobind::typed<nanobind::object, T>

Definition at line 112 of file IRCore.h.

Constructor & Destructor Documentation

◆ PyObjectRef() [1/3]

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

Definition at line 70 of file IRCore.h.

◆ PyObjectRef() [2/3]

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

Definition at line 76 of file IRCore.h.

◆ PyObjectRef() [3/3]

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

Definition at line 81 of file IRCore.h.

◆ ~PyObjectRef()

Member Function Documentation

◆ get()

◆ getObject()

◆ getRefCount()

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

Definition at line 85 of file IRCore.h.

◆ operator bool()

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

Definition at line 110 of file IRCore.h.

◆ operator->()

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

Definition at line 102 of file IRCore.h.

◆ releaseObject()

template<typename T>
nanobind::object mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::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 94 of file IRCore.h.

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRCore().


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