Loading [MathJax]/extensions/tex2jax.js
LSST Applications g00d24c3146+07134a258f,g0fba68d861+c6b9c001b5,g1ec0fe41b4+f536777771,g1fd858c14a+958e7c0317,g216c3ac8a7+c5d9439d40,g35bb328faa+fcb1d3bbc8,g4d2262a081+0aed3363b2,g53246c7159+fcb1d3bbc8,g56a49b3a55+a44ca4bdea,g5a012ec0e7+3632fc3ff3,g60b5630c4e+07134a258f,g67b6fd64d1+ed4b5058f4,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g8180f54f50+a220987f6f,g8352419a5c+fcb1d3bbc8,g8852436030+bef424d5ca,g89139ef638+ed4b5058f4,g9125e01d80+fcb1d3bbc8,g94187f82dc+07134a258f,g989de1cb63+ed4b5058f4,g9ccd5d7f00+b7cae620c0,g9d31334357+07134a258f,g9f33ca652e+31a8ea3a30,gabe3b4be73+1e0a283bba,gabf8522325+fa80ff7197,gb1101e3267+c50a309191,gb58c049af0+f03b321e39,gb89ab40317+ed4b5058f4,gc0af124501+69caa252ab,gcf25f946ba+bef424d5ca,gd6cbbdb0b4+bb83cc51f8,gdd6d3460e7+d236de904b,gde0f65d7ad+d50ffb433c,ge278dab8ac+d65b3c2b70,ge410e46f29+ed4b5058f4,gf5e32f922b+fcb1d3bbc8,gf67bdafdda+ed4b5058f4,w.2025.16
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
lsst::base::PythonModuleImporter Class Reference
Inheritance diagram for lsst::base::PythonModuleImporter:
lsst::base::ModuleImporter

Static Public Member Functions

static ModuleImporter const * get ()
 
static bool import (std::string const &name)
 Import the given Python module, and return true if successful.
 

Protected Member Functions

virtual bool _import (std::string const &name) const
 

Detailed Description

Definition at line 32 of file cppimport.cc.

Member Function Documentation

◆ _import()

bool lsst::base::PythonModuleImporter::_import ( std::string const & name) const
protectedvirtual

Implements lsst::base::ModuleImporter.

Definition at line 46 of file cppimport.cc.

46 {
47 PyObject* mod = PyImport_ImportModule(name.c_str());
48 if (mod) {
49 Py_DECREF(mod);
50 return true;
51 } else {
52 // If the Python C API call returned a null pointer, it will
53 // also have set an exception. We don't want that, because
54 // this isn't necessarily an error (that's up to the caller).
55 PyErr_Clear();
56 }
57 return false;
58}

◆ get()

static ModuleImporter const * lsst::base::PythonModuleImporter::get ( )
inlinestatic

Definition at line 34 of file cppimport.cc.

34 {
35 static PythonModuleImporter const instance;
36 return &instance;
37 }

◆ import()

bool lsst::base::ModuleImporter::import ( std::string const & name)
staticinherited

Import the given Python module, and return true if successful.

Definition at line 49 of file ModuleImporter.cc.

49 {
50 return getImporterSingleton()->_import(name);
51}

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