| 366 | } |
| 367 | |
| 368 | void SetString(const fmi2ValueReference* vr, std::size_t nvr, fmi2String const* values) override |
| 369 | { |
| 370 | py_safe_run([this, &vr, nvr, &values](PyGILState_STATE gilState) { |
| 371 | PyObject* vrs = PyList_New(nvr); |
| 372 | PyObject* refs = PyList_New(nvr); |
| 373 | for (int i = 0; i < nvr; i++) { |
| 374 | PyList_SetItem(vrs, i, Py_BuildValue("i", vr[i])); |
| 375 | PyList_SetItem(refs, i, Py_BuildValue("s", values[i])); |
| 376 | } |
| 377 | |
| 378 | auto f = PyObject_CallMethod(pInstance_, "set_string", "(OO)", vrs, refs); |
| 379 | Py_DECREF(vrs); |
| 380 | Py_DECREF(refs); |
| 381 | if (f == nullptr) { |
| 382 | handle_py_exception("[setString] PyObject_CallMethod", gilState); |
| 383 | } |
| 384 | Py_DECREF(f); |
| 385 | clearLogBuffer(); |
| 386 | }); |
| 387 | } |
| 388 | |
| 389 | void GetReal(const fmi2ValueReference* vr, std::size_t nvr, fmi2Real* values) const override |
| 390 | { |
no test coverage detected