CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
PyBind11InterpreterSentry Class Reference

#include <PyBind11ProcessDesc.h>

Public Member Functions

 PyBind11InterpreterSentry (bool ownsInterpreter)
 
 ~PyBind11InterpreterSentry ()
 

Public Attributes

pybind11::object mainModule
 

Private Attributes

bool const ownsInterpreter_
 

Detailed Description

Definition at line 15 of file PyBind11ProcessDesc.h.

Constructor & Destructor Documentation

◆ PyBind11InterpreterSentry()

PyBind11InterpreterSentry::PyBind11InterpreterSentry ( bool  ownsInterpreter)

Definition at line 12 of file PyBind11ProcessDesc.cc.

References ownsInterpreter_.

13  : mainModule(), ownsInterpreter_(ownsInterpreter) {
14  if (ownsInterpreter_) {
15  pybind11::initialize_interpreter();
16  }
17 }

◆ ~PyBind11InterpreterSentry()

PyBind11InterpreterSentry::~PyBind11InterpreterSentry ( )

Definition at line 19 of file PyBind11ProcessDesc.cc.

References mainModule, resolutioncreator_cfi::object, and ownsInterpreter_.

19  {
20  if (ownsInterpreter_) {
22  pybind11::finalize_interpreter();
23  }
24 }

Member Data Documentation

◆ mainModule

pybind11::object PyBind11InterpreterSentry::mainModule

◆ ownsInterpreter_

bool const PyBind11InterpreterSentry::ownsInterpreter_
private

Definition at line 23 of file PyBind11ProcessDesc.h.

Referenced by PyBind11InterpreterSentry(), and ~PyBind11InterpreterSentry().