RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
PythonInterface.h
1/*
2 * PythonInterface.h
3 *
4 * Created on: Jan. 14, 2021
5 * Author: mathieu
6 */
7
8#ifndef CORELIB_SRC_PYTHON_PYTHONINTERFACE_H_
9#define CORELIB_SRC_PYTHON_PYTHONINTERFACE_H_
10
11#include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
12
13#include <string>
14#include <rtabmap/utilite/UMutex.h>
15
16namespace pybind11 {
17class scoped_interpreter;
18class gil_scoped_release;
19}
20
21namespace rtabmap {
22
28class RTABMAP_CORE_EXPORT PythonInterface
29{
30public:
31 // Pass a caller tag (e.g. class name) so the main-thread assertion
32 // can report who triggered the first construction.
33 static PythonInterface & instance(const std::string & caller = "");
34
35 PythonInterface(const PythonInterface &) = delete;
36 PythonInterface & operator=(const PythonInterface &) = delete;
37
38private:
39 explicit PythonInterface(const std::string & caller);
41
42 pybind11::scoped_interpreter* guard_;
43 pybind11::gil_scoped_release* release_;
44};
45
46std::string RTABMAP_CORE_EXPORT getPythonTraceback();
47
48}
49
50#endif /* CORELIB_SRC_PYTHON_PYTHONINTERFACE_H_ */