mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-07 02:27:47 +08:00
Merge branch 'python_singleton' of github.com:introlab/rtabmap into gtest
This commit is contained in:
@@ -21,16 +21,24 @@ class gil_scoped_release;
|
||||
namespace rtabmap {
|
||||
|
||||
/**
|
||||
* Create a single PythonInterface on main thread at
|
||||
* global scope before any Python classes.
|
||||
* Process-wide singleton owning the embedded Python interpreter.
|
||||
* Call PythonInterface::instance() from the main thread (typically near
|
||||
* the top of main()) before any Python-using class is constructed.
|
||||
*/
|
||||
class RTABMAP_CORE_EXPORT PythonInterface
|
||||
{
|
||||
public:
|
||||
PythonInterface();
|
||||
virtual ~PythonInterface();
|
||||
// Pass a caller tag (e.g. class name) so the main-thread assertion
|
||||
// can report who triggered the first construction.
|
||||
static PythonInterface & instance(const std::string & caller = "");
|
||||
|
||||
PythonInterface(const PythonInterface &) = delete;
|
||||
PythonInterface & operator=(const PythonInterface &) = delete;
|
||||
|
||||
private:
|
||||
explicit PythonInterface(const std::string & caller);
|
||||
~PythonInterface();
|
||||
|
||||
pybind11::scoped_interpreter* guard_;
|
||||
pybind11::gil_scoped_release* release_;
|
||||
};
|
||||
|
||||
@@ -50,7 +50,6 @@ class Memory;
|
||||
class BayesFilter;
|
||||
class Signature;
|
||||
class Optimizer;
|
||||
class PythonInterface;
|
||||
|
||||
/**
|
||||
* @class Rtabmap
|
||||
@@ -1040,11 +1039,6 @@ private:
|
||||
Transform _pathTransformToGoal;
|
||||
int _pathStuckCount;
|
||||
float _pathStuckDistance;
|
||||
|
||||
#ifdef RTABMAP_PYTHON
|
||||
PythonInterface * _python;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
} // namespace rtabmap
|
||||
|
||||
Reference in New Issue
Block a user