MCPcopy Create free account
hub / github.com/astra-toolbox/astra-toolbox / getPlugin

Method getPlugin

python/astra/src/PythonPluginAlgorithmFactory.cpp:145–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145CAlgorithm * 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
163PyObject * CPythonPluginAlgorithmFactory::getRegistered(){
164 Py_INCREF(pluginDict);

Callers 1

findPluginMethod · 0.80

Calls 2

getItemStringRefFunction · 0.85
getClassFromStringFunction · 0.85

Tested by

no test coverage detected