RTC Toolkit 6.0.0
Loading...
Searching...
No Matches
pythonInterpreter.hpp
Go to the documentation of this file.
1
11
12#ifndef RTCTK_COMPONENTFRAMEWORK_PYTHONINTERPRETER_HPP
13#define RTCTK_COMPONENTFRAMEWORK_PYTHONINTERPRETER_HPP
14
16#include <rtctk/config.hpp>
17
18#include <pybind11/embed.h>
19#include <pybind11/pybind11.h>
20
22
61public:
73 public:
74 explicit SetupFailure(const std::string& message);
75 };
76
89 explicit PythonInterpreter(bool init_signal_handlers = true,
90 int argc = 0,
91 const char* const* argv = nullptr,
92 bool add_program_dir_to_path = true);
93
106 explicit PythonInterpreter(PyConfig* config,
107 int argc = 0,
108 const char* const* argv = nullptr,
109 bool add_program_dir_to_path = true);
110
115
117
118private:
119 RTCTK_LOCAL void ImportPythonModules();
120
121 pybind11::scoped_interpreter m_interpreter; // This must be declared first.
122 pybind11::module m_threading_module;
123 pybind11::module m_vector_module;
124 pybind11::module m_matrix_module;
125 pybind11::gil_scoped_release m_release_gil; // This must be declared last.
126};
127
128} // namespace rtctk::componentFramework
129
130#endif // RTCTK_COMPONENTFRAMEWORK_PYTHONINTERPRETER_HPP
SetupFailure(const std::string &message)
Definition pythonInterpreter.cpp:18
PythonInterpreter(const PythonInterpreter &)=delete
PythonInterpreter(bool init_signal_handlers=true, int argc=0, const char *const *argv=nullptr, bool add_program_dir_to_path=true)
Initialises the embedded Python interpreter.
Definition pythonInterpreter.cpp:22
PythonInterpreter & operator=(PythonInterpreter &&)=delete
PythonInterpreter(PythonInterpreter &&)=delete
PythonInterpreter & operator=(const PythonInterpreter &)=delete
RtctkException() noexcept
Definition exceptions.cpp:112
Project-wide configuration header.
#define RTCTK_LOCAL
Helper to hide a class or function from the public symbol table.
Definition config.hpp:59
#define RTCTK_API
Helper to indicate that a class or function must be exported in the public symbol table.
Definition config.hpp:32
Provides macros and utilities for exception handling.
Definition commandReplier.cpp:21