Mercurial > hg > vampy-host
comparison 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 |
comparison
equal
deleted
inserted
replaced
92:18b412a9c4d5 | 93:4bed6bf67243 |
---|---|
171 } | 171 } |
172 | 172 |
173 static PyObject * | 173 static PyObject * |
174 convertOutput(const Plugin::OutputDescriptor &desc, int ix) | 174 convertOutput(const Plugin::OutputDescriptor &desc, int ix) |
175 { | 175 { |
176 VectorConversion conv; | |
177 | |
176 PyObject *outdict = PyDict_New(); | 178 PyObject *outdict = PyDict_New(); |
177 PyDict_SetItemString | 179 PyDict_SetItemString |
178 (outdict, "identifier", pystr(desc.identifier)); | 180 (outdict, "identifier", pystr(desc.identifier)); |
179 PyDict_SetItemString | 181 PyDict_SetItemString |
180 (outdict, "name", pystr(desc.name)); | 182 (outdict, "name", pystr(desc.name)); |
181 PyDict_SetItemString | 183 PyDict_SetItemString |
182 (outdict, "description", pystr(desc.description)); | 184 (outdict, "description", pystr(desc.description)); |
183 PyDict_SetItemString | 185 PyDict_SetItemString |
184 (outdict, "bin_count", PyInt_FromLong(desc.binCount)); | 186 (outdict, "unit", pystr(desc.unit)); |
185 if (desc.binCount > 0) { | 187 PyDict_SetItemString |
188 (outdict, "has_fixed_bin_count", PyInt_FromLong(desc.hasFixedBinCount)); | |
189 if (desc.hasFixedBinCount) { | |
190 PyDict_SetItemString | |
191 (outdict, "bin_count", PyInt_FromLong(desc.binCount)); | |
192 if (!desc.binNames.empty()) { | |
193 PyDict_SetItemString | |
194 (outdict, "bin_names", conv.PyValue_From_StringVector(desc.binNames)); | |
195 } | |
196 } | |
197 if (!desc.hasFixedBinCount || | |
198 (desc.hasFixedBinCount && (desc.binCount > 0))) { | |
186 if (desc.hasKnownExtents) { | 199 if (desc.hasKnownExtents) { |
187 PyDict_SetItemString | 200 PyDict_SetItemString |
188 (outdict, "has_known_extents", Py_True); | 201 (outdict, "has_known_extents", Py_True); |
189 PyDict_SetItemString | 202 PyDict_SetItemString |
190 (outdict, "min_value", PyFloat_FromDouble(desc.minValue)); | 203 (outdict, "min_value", PyFloat_FromDouble(desc.minValue)); |