summaryrefslogtreecommitdiffstats
path: root/include/astra/PluginAlgorithm.h
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2016-02-22 12:12:27 +0100
committerWillem Jan Palenstijn <wjp@usecode.org>2016-02-22 12:12:27 +0100
commitcd395d2af23530f9da471fd6c512e9890c08f69d (patch)
tree0fb1b8431ef1773d0f4fcee9e780a19a371021a9 /include/astra/PluginAlgorithm.h
parent3743fdc534b39958c105f4124ad1130d3e8b042a (diff)
parentd2705f52766716b4d4627a62de92e7a2480b6b86 (diff)
downloadastra-cd395d2af23530f9da471fd6c512e9890c08f69d.tar.gz
astra-cd395d2af23530f9da471fd6c512e9890c08f69d.tar.bz2
astra-cd395d2af23530f9da471fd6c512e9890c08f69d.tar.xz
astra-cd395d2af23530f9da471fd6c512e9890c08f69d.zip
Merge pull request #111 from wjp/pluginbuild
Remove dependency of libastra on libpython
Diffstat (limited to 'include/astra/PluginAlgorithm.h')
-rw-r--r--include/astra/PluginAlgorithm.h57
1 files changed, 16 insertions, 41 deletions
diff --git a/include/astra/PluginAlgorithm.h b/include/astra/PluginAlgorithm.h
index 667e813..cbd80fc 100644
--- a/include/astra/PluginAlgorithm.h
+++ b/include/astra/PluginAlgorithm.h
@@ -29,62 +29,37 @@ $Id$
#ifndef _INC_ASTRA_PLUGINALGORITHM
#define _INC_ASTRA_PLUGINALGORITHM
-#ifdef ASTRA_PYTHON
-
-#include "astra/Algorithm.h"
-#include "astra/Singleton.h"
-#include "astra/XMLDocument.h"
-#include "astra/XMLNode.h"
-
-// Slightly hackish forward declaration of PyObject
-struct _object;
-typedef _object PyObject;
+#include "astra/Globals.h"
+#include <map>
+#include <string>
namespace astra {
-class _AstraExport CPluginAlgorithm : public CAlgorithm {
-
-public:
-
- CPluginAlgorithm(PyObject* pyclass);
- ~CPluginAlgorithm();
-
- bool initialize(const Config& _cfg);
- void run(int _iNrIterations);
-
-private:
- PyObject * instance;
-};
+class CAlgorithm;
-class _AstraExport CPluginAlgorithmFactory : public Singleton<CPluginAlgorithmFactory> {
+class _AstraExport CPluginAlgorithmFactory {
public:
+ CPluginAlgorithmFactory() { }
+ virtual ~CPluginAlgorithmFactory() { }
- CPluginAlgorithmFactory();
- ~CPluginAlgorithmFactory();
+ virtual CAlgorithm * getPlugin(const std::string &name) = 0;
- CPluginAlgorithm * getPlugin(std::string name);
+ virtual bool registerPlugin(std::string name, std::string className) = 0;
+ virtual bool registerPlugin(std::string className) = 0;
- bool registerPlugin(std::string name, std::string className);
- bool registerPlugin(std::string className);
- bool registerPluginClass(std::string name, PyObject * className);
- bool registerPluginClass(PyObject * className);
+ virtual std::map<std::string, std::string> getRegisteredMap() = 0;
- PyObject * getRegistered();
- std::map<std::string, std::string> getRegisteredMap();
-
- std::string getHelp(std::string name);
+ virtual std::string getHelp(const std::string &name) = 0;
+
+ static void registerFactory(CPluginAlgorithmFactory *factory) { m_factory = factory; }
+ static CPluginAlgorithmFactory* getFactory() { return m_factory; }
private:
- PyObject * pluginDict;
- PyObject *inspect, *six;
+ static CPluginAlgorithmFactory *m_factory;
};
-PyObject* XMLNode2dict(XMLNode node);
-
}
#endif
-
-#endif