| 298 | |
| 299 | |
| 300 | PyObject* PyStreamingAlgorithm::paramValue(PyStreamingAlgorithm* self, PyObject* obj) { |
| 301 | if (!PyString_Check(obj)) { |
| 302 | PyErr_SetString(PyExc_TypeError, "expected string as argument"); |
| 303 | return NULL; |
| 304 | } |
| 305 | |
| 306 | string name = PyString_AS_STRING(obj); |
| 307 | |
| 308 | // check if parameter exists |
| 309 | if (self->algo->defaultParameters().find(name) == self->algo->defaultParameters().end()) { |
| 310 | ostringstream msg; |
| 311 | msg << "'" << name << "' is not a parameter of " << self->algo->name(); |
| 312 | PyErr_SetString(PyExc_ValueError, msg.str().c_str()); |
| 313 | return NULL; |
| 314 | } |
| 315 | |
| 316 | // determine the type of the parameter and return the appropriate Python object |
| 317 | PyObject* result = paramToPython( self->algo->parameter(name) ); |
| 318 | |
| 319 | if (result == NULL) { |
| 320 | // param not configured |
| 321 | Py_RETURN_NONE; |
| 322 | } |
| 323 | else { |
| 324 | return result; |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | |
| 329 | PyObject* PyStreamingAlgorithm::getDoc(PyStreamingAlgorithm* self) { |
nothing calls this directly
no test coverage detected