Mercurial > hg > vampy-host
diff native/PyPluginObject.cpp @ 93:4bed6bf67243
Return simple array for simple data
author | Chris Cannam |
---|---|
date | Mon, 02 Feb 2015 16:08:42 +0000 |
parents | dd56716714e0 |
children | 216ed5a72c36 |
line wrap: on
line diff
--- a/native/PyPluginObject.cpp Mon Jan 26 12:28:30 2015 +0000 +++ b/native/PyPluginObject.cpp Mon Feb 02 16:08:42 2015 +0000 @@ -173,6 +173,8 @@ static PyObject * convertOutput(const Plugin::OutputDescriptor &desc, int ix) { + VectorConversion conv; + PyObject *outdict = PyDict_New(); PyDict_SetItemString (outdict, "identifier", pystr(desc.identifier)); @@ -181,8 +183,19 @@ PyDict_SetItemString (outdict, "description", pystr(desc.description)); PyDict_SetItemString - (outdict, "bin_count", PyInt_FromLong(desc.binCount)); - if (desc.binCount > 0) { + (outdict, "unit", pystr(desc.unit)); + PyDict_SetItemString + (outdict, "has_fixed_bin_count", PyInt_FromLong(desc.hasFixedBinCount)); + if (desc.hasFixedBinCount) { + PyDict_SetItemString + (outdict, "bin_count", PyInt_FromLong(desc.binCount)); + if (!desc.binNames.empty()) { + PyDict_SetItemString + (outdict, "bin_names", conv.PyValue_From_StringVector(desc.binNames)); + } + } + if (!desc.hasFixedBinCount || + (desc.hasFixedBinCount && (desc.binCount > 0))) { if (desc.hasKnownExtents) { PyDict_SetItemString (outdict, "has_known_extents", Py_True);