Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
MantidQt::Widgets::Common::Python::InstanceHolder Class Reference

Holds a Python instance of an object with a method to access it. More...

#include <Object.h>

Public Member Functions

 InstanceHolder (Object obj)
 Construct an InstanceHolder with an existing Python object. More...
 
 InstanceHolder (Object obj, const char *attr)
 Construct an InstanceHolder with an existing Python object. More...
 
const Objectpyobj () const
 Return the held instance object. More...
 
 ~InstanceHolder ()
 The destructor must hold the GIL to be able reduce the refcount of the object. More...
 

Private Attributes

Object m_instance
 

Detailed Description

Holds a Python instance of an object with a method to access it.

Definition at line 64 of file Object.h.

Constructor & Destructor Documentation

◆ InstanceHolder() [1/2]

MantidQt::Widgets::Common::Python::InstanceHolder::InstanceHolder ( Object  obj)
inlineexplicit

Construct an InstanceHolder with an existing Python object.

Parameters
objAn existing Python instance

Definition at line 70 of file Object.h.

◆ InstanceHolder() [2/2]

MantidQt::Widgets::Common::Python::InstanceHolder::InstanceHolder ( Object  obj,
const char *  attr 
)
inline

Construct an InstanceHolder with an existing Python object.

The provided object is checked to ensure it has the named attr

Parameters
objAn existing Python instance
attrThe name of an attribute that must exist on the wrapped object

Definition at line 79 of file Object.h.

References pyobj().

◆ ~InstanceHolder()

MantidQt::Widgets::Common::Python::InstanceHolder::~InstanceHolder ( )
inline

The destructor must hold the GIL to be able reduce the refcount of the object.

Definition at line 88 of file Object.h.

References m_instance.

Member Function Documentation

◆ pyobj()

const Object & MantidQt::Widgets::Common::Python::InstanceHolder::pyobj ( ) const
inline

Return the held instance object.

Definition at line 94 of file Object.h.

References m_instance.

Referenced by InstanceHolder().

Member Data Documentation

◆ m_instance

Object MantidQt::Widgets::Common::Python::InstanceHolder::m_instance
private

Definition at line 97 of file Object.h.

Referenced by pyobj(), and ~InstanceHolder().


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