diff options
Diffstat (limited to 'python/astra/src')
-rw-r--r-- | python/astra/src/PythonPluginAlgorithm.cpp | 8 | ||||
-rw-r--r-- | python/astra/src/PythonPluginAlgorithm.h | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/python/astra/src/PythonPluginAlgorithm.cpp b/python/astra/src/PythonPluginAlgorithm.cpp index d461f06..3c892ff 100644 --- a/python/astra/src/PythonPluginAlgorithm.cpp +++ b/python/astra/src/PythonPluginAlgorithm.cpp @@ -124,6 +124,14 @@ void CPluginAlgorithm::run(int _iNrIterations){ PyGILState_Release(state); } +PyObject *CPluginAlgorithm::getInstance() const { + if (instance) + Py_INCREF(instance); + return instance; +} + + + CPythonPluginAlgorithmFactory::CPythonPluginAlgorithmFactory(){ if(!Py_IsInitialized()){ Py_Initialize(); diff --git a/python/astra/src/PythonPluginAlgorithm.h b/python/astra/src/PythonPluginAlgorithm.h index 947e30d..b7072d6 100644 --- a/python/astra/src/PythonPluginAlgorithm.h +++ b/python/astra/src/PythonPluginAlgorithm.h @@ -49,6 +49,9 @@ public: bool initialize(const Config& _cfg); void run(int _iNrIterations); + // Return instance (including INCREF) + PyObject *getInstance() const; + private: PyObject * instance; |