RTC Toolkit 5.0.0
Loading...
Searching...
No Matches
pythonInterpreter.hpp
Go to the documentation of this file.
1
13#ifndef RTCTK_COMPONENTFRAMEWORK_PYTHONINTERPRETER_HPP
14#define RTCTK_COMPONENTFRAMEWORK_PYTHONINTERPRETER_HPP
15
17#include <rtctk/config.hpp>
18
19#include <pybind11/embed.h>
20#include <pybind11/pybind11.h>
21
23
62public:
74 public:
75 explicit SetupFailure(const std::string& message);
76 };
77
90 explicit PythonInterpreter(bool init_signal_handlers = true,
91 int argc = 0,
92 const char* const* argv = nullptr,
93 bool add_program_dir_to_path = true);
94
107 explicit PythonInterpreter(PyConfig* config,
108 int argc = 0,
109 const char* const* argv = nullptr,
110 bool add_program_dir_to_path = true);
111
116
118
119private:
120 RTCTK_LOCAL void ImportPythonModules();
121
122 pybind11::scoped_interpreter m_interpreter; // This must be declared first.
123 pybind11::module m_threading_module;
124 pybind11::module m_vector_module;
125 pybind11::module m_matrix_module;
126 pybind11::gil_scoped_release m_release_gil; // This must be declared last.
127};
128
129} // namespace rtctk::componentFramework
130
131#endif // RTCTK_COMPONENTFRAMEWORK_PYTHONINTERPRETER_HPP
This exception is raised when the Python interpreter cannot be initialised properly.
Definition pythonInterpreter.hpp:73
Helper class for managing the lifecycle of an embedded Python interpreter.
Definition pythonInterpreter.hpp:61
PythonInterpreter(const PythonInterpreter &)=delete
PythonInterpreter & operator=(PythonInterpreter &&)=delete
PythonInterpreter(PythonInterpreter &&)=delete
PythonInterpreter & operator=(const PythonInterpreter &)=delete
The RtctkException class is the base class for all Rtctk exceptions.
Definition exceptions.hpp:211
Project-wide configuration header.
#define RTCTK_LOCAL
Helper to hide a class or function from the public symbol table.
Definition config.hpp:60
#define RTCTK_API
Helper to indicate that a class or function must be exported in the public symbol table.
Definition config.hpp:33
Provides macros and utilities for exception handling.
Definition commandReplier.cpp:22
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23