BALL 1.5.0
pyCAPIKernel.h
Go to the documentation of this file.
1#ifndef BALL_PYTHON_PYCAPIKERNEL_H
2#define BALL_PYTHON_PYCAPIKERNEL_H
3
5
6#include <vector>
7
8namespace BALL
9{
10 class PyCAPIKernel : public PyKernel
11 {
12 public:
14 ~PyCAPIKernel() override;
15
16 bool isStarted() const override;
17 std::string getErrorMessage() const override { return last_err_; };
18
19 std::pair<bool, std::string> run(std::string str) override;
20 BALL_DEPRECATED bool runFile(std::string filename) override;
21 bool execute(const std::string& module, const std::string& func, const KeyValArgs& args) override;
22
23 private:
30 PyObject* loadModule(const std::string& name);
31
38 bool errorOccurred();
39
40 PyObject* main_module_ {nullptr};
41 PyObject* context_ {nullptr};
42 std::string last_err_ {};
43 std::vector<PyObject*> modules_ {};
44 };
45}
46
47#endif // BALL_PYTHON_PYCAPIKERNEL_H
Definition: constants.h:13
std::string getErrorMessage() const override
Definition: pyCAPIKernel.h:17
BALL_DEPRECATED bool runFile(std::string filename) override
bool execute(const std::string &module, const std::string &func, const KeyValArgs &args) override
std::pair< bool, std::string > run(std::string str) override
bool isStarted() const override
~PyCAPIKernel() override
std::map< std::string, std::string > KeyValArgs
Definition: pyKernel.h:17
#define BALL_DEPRECATED
Definition: COMMON/global.h:64