|
🛰️航天仿真算法库 SpaceAST 0.0.1
|
#include <PythonAPI.hpp>
Public 成员函数 | |
| PythonAPI (bool shouldLoadDynamicLib) | |
| errc_t | load (StringView libpath) |
| errc_t | tryload (const std::vector< std::string > &libpaths) |
| errc_t | unload () |
| bool | isLoaded () const |
| void | Py_Initialize () |
| int | Py_FinalizeEx () |
| int | Py_IsInitialized () |
| int | PyRun_SimpleString (const char *command) |
| PyObject * | PyImport_ImportModule (const char *name) |
| PyObject * | PyObject_GetAttrString (PyObject *o, const char *attr_name) |
| PyObject * | PyObject_CallObject (PyObject *callable, PyObject *args) |
| void | Py_DecRef (PyObject *o) |
| void | Py_IncRef (PyObject *o) |
| void | PyErr_Print () |
| PyObject * | PyErr_Occurred () |
| const char * | PyUnicode_AsUTF8 (PyObject *unicode) |
| PyObject * | PyRun_String (const char *str, int start, PyObject *globals, PyObject *locals) |
| long | PyLong_AsLong (PyObject *o) |
| double | PyFloat_AsDouble (PyObject *o) |
| PyObject * | PyLong_FromLong (long v) |
| PyObject * | PyFloat_FromDouble (double v) |
| PyObject * | PyUnicode_FromString (const char *u) |
| PyObject * | PyBool_FromLong (long v) |
| PyObject * | PyDict_New () |
| int | PyDict_SetItemString (PyObject *dict, const char *key, PyObject *val) |
| PyObject * | PyDict_GetItemString (PyObject *dict, const char *key) |
| int | PyObject_SetAttrString (PyObject *o, const char *attr_name, PyObject *v) |
| int | PyObject_IsInstance (PyObject *obj, PyObject *cls) |
| void | PyErr_Fetch (PyObject **ptype, PyObject **pvalue, PyObject **ptraceback) |
| PyObject * | PyObject_Str (PyObject *o) |
| int | PyGILState_Ensure () |
| void | PyGILState_Release (int gstate) |
| PyObject * | PyFloat_Type () const |
| PyObject * | PyLong_Type () const |
| PyObject * | PyBool_Type () const |
| PyObject * | PyUnicode_Type () const |
静态 Public 成员函数 | |
| static PythonAPI * | Instance () |
Protected 成员函数 | |
| void | checkerror () |
| A_DISABLE_COPY (PythonAPI) | |
Protected 属性 | |
| void * | library_ {nullptr} |
| funcarray | functions_ {} |
| std::mutex | mutex_ |
Python API — 与 Python C API 接口一致的动态加载包装
通过动态加载 Python 共享库的方式提供 Python C API 的核心函数。 公开方法名和签名与 Python C API 严格一致,但底层为运行时动态解析。