diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2016-01-20 18:08:59 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2016-01-21 14:30:46 +0100 |
commit | 56809b0359af7e9108adeb1fd21823a225edf6fa (patch) | |
tree | 002a12b986b8d943556c42570fcda216e73ad79d /python/astra/plugin_c.pyx | |
parent | cd12edcd3ada212f27088a4e26e3eee5f89bcbad (diff) | |
download | astra-56809b0359af7e9108adeb1fd21823a225edf6fa.tar.gz astra-56809b0359af7e9108adeb1fd21823a225edf6fa.tar.bz2 astra-56809b0359af7e9108adeb1fd21823a225edf6fa.tar.xz astra-56809b0359af7e9108adeb1fd21823a225edf6fa.zip |
Remove dependency of libastra on libpython by refactoring PluginAlgorithm
Diffstat (limited to 'python/astra/plugin_c.pyx')
-rw-r--r-- | python/astra/plugin_c.pyx | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/python/astra/plugin_c.pyx b/python/astra/plugin_c.pyx index 8d6816b..775ccd4 100644 --- a/python/astra/plugin_c.pyx +++ b/python/astra/plugin_c.pyx @@ -32,21 +32,25 @@ import inspect from libcpp.string cimport string from libcpp cimport bool -cdef CPluginAlgorithmFactory *fact = getSingletonPtr() +cdef CPythonPluginAlgorithmFactory *fact = getSingletonPtr() from . import utils -cdef extern from "astra/PluginAlgorithm.h" namespace "astra": - cdef cppclass CPluginAlgorithmFactory: +cdef extern from "src/PythonPluginAlgorithm.h" namespace "astra": + cdef cppclass CPythonPluginAlgorithmFactory: bool registerPlugin(string className) bool registerPlugin(string name, string className) bool registerPluginClass(object className) bool registerPluginClass(string name, object className) object getRegistered() - string getHelp(string name) + string getHelp(string &name) + +cdef extern from "src/PythonPluginAlgorithm.h" namespace "astra::CPythonPluginAlgorithmFactory": + cdef CPythonPluginAlgorithmFactory* getSingletonPtr() cdef extern from "astra/PluginAlgorithm.h" namespace "astra::CPluginAlgorithmFactory": - cdef CPluginAlgorithmFactory* getSingletonPtr() + # NB: Using wrong pointer type here for convenience + cdef void registerFactory(CPythonPluginAlgorithmFactory *) def register(className, name=None): if inspect.isclass(className): @@ -65,3 +69,6 @@ def get_registered(): def get_help(name): return utils.wrap_from_bytes(fact.getHelp(six.b(name))) + +# Register python plugin factory with astra +registerFactory(fact) |