diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2018-07-03 14:32:23 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2018-07-03 14:32:23 +0200 |
commit | 0d06afc38d7a8443a079d25d72ec4b4b15353974 (patch) | |
tree | 9a866e41d62d0432bad4dd49e4072cc2fed97d29 /python/astra/src | |
parent | b3822b778c2f8684217957c966dddfee178c926c (diff) | |
download | astra-0d06afc38d7a8443a079d25d72ec4b4b15353974.tar.gz astra-0d06afc38d7a8443a079d25d72ec4b4b15353974.tar.bz2 astra-0d06afc38d7a8443a079d25d72ec4b4b15353974.tar.xz astra-0d06afc38d7a8443a079d25d72ec4b4b15353974.zip |
Allow access to python plugin object via algorithm interface
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; |