Cantera  3.1.0a1
Loading...
Searching...
No Matches
PythonHandle Class Reference

Class that holds an owned or weak (borrowed) reference to a Python object. More...

#include <PythonHandle.h>

Inheritance diagram for PythonHandle:
[legend]

Detailed Description

Class that holds an owned or weak (borrowed) reference to a Python object.

Definition at line 16 of file PythonHandle.h.

Public Member Functions

 PythonHandle (PyObject *obj, bool weak)
 Create a handle to hold a Python object.
 
 PythonHandle (const PythonHandle &)=delete
 
PythonHandleoperator= (const PythonHandle &)=delete
 
void * get () override
 Get the underlying external object.
 
- Public Member Functions inherited from ExternalHandle
 ExternalHandle (const ExternalHandle &)=delete
 
virtual void * get ()
 Get the underlying external object.
 

Private Attributes

PyObject * m_obj
 
bool m_weak
 

Constructor & Destructor Documentation

◆ PythonHandle()

PythonHandle ( PyObject *  obj,
bool  weak 
)
inline

Create a handle to hold a Python object.

Parameters
objThe Python object to be held
weaktrue if this is a weak reference to the Python object and this handle is not responsible for deleting the Python object, or false if this handle should own a reference to the Python object

Definition at line 24 of file PythonHandle.h.

◆ ~PythonHandle()

~PythonHandle ( )
inline

Definition at line 32 of file PythonHandle.h.

Member Function Documentation

◆ get()

void * get ( )
inlineoverridevirtual

Get the underlying external object.

Reimplemented from ExternalHandle.

Definition at line 38 of file PythonHandle.h.

Member Data Documentation

◆ m_obj

PyObject* m_obj
private

Definition at line 43 of file PythonHandle.h.

◆ m_weak

bool m_weak
private

Definition at line 44 of file PythonHandle.h.


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