| 143 | } |
| 144 | |
| 145 | CAlgorithm * CPythonPluginAlgorithmFactory::getPlugin(const std::string &name){ |
| 146 | PyObject *className = getItemStringRef(pluginDict, name.c_str()); |
| 147 | if (!className) return NULL; |
| 148 | CPluginAlgorithm *alg = NULL; |
| 149 | if(PyBytes_Check(className)){ |
| 150 | std::string str = std::string(PyBytes_AsString(className)); |
| 151 | PyObject *pyclass = getClassFromString(str); |
| 152 | if(pyclass!=NULL){ |
| 153 | alg = new CPluginAlgorithm(pyclass); |
| 154 | Py_DECREF(pyclass); |
| 155 | } |
| 156 | }else{ |
| 157 | alg = new CPluginAlgorithm(className); |
| 158 | } |
| 159 | Py_DECREF(className); |
| 160 | return alg; |
| 161 | } |
| 162 | |
| 163 | PyObject * CPythonPluginAlgorithmFactory::getRegistered(){ |
| 164 | Py_INCREF(pluginDict); |
no test coverage detected