comparison PyTypeInterface.h @ 33:c4da8d559872 vampy2

* build fixes for Linux
author cannam
date Wed, 23 Sep 2009 11:56:46 +0000
parents a8231788216c
children c905122f79e7
comparison
equal deleted inserted replaced
32:a8231788216c 33:c4da8d559872
74 values, 74 values,
75 label 75 label
76 }; 76 };
77 77
78 /* C++ mapping of PyNone Type*/ 78 /* C++ mapping of PyNone Type*/
79 typedef struct NoneType {}; 79 struct NoneType {};
80 80
81 class PyTypeInterface 81 class PyTypeInterface
82 { 82 {
83 public: 83 public:
84 PyTypeInterface(); 84 PyTypeInterface();
145 return NULL; 145 return NULL;
146 } 146 }
147 147
148 148
149 template<typename RET> 149 template<typename RET>
150 RET PyTypeInterface::PyValue_To_VampDescriptor(PyObject* pyValue) const 150 RET PyValue_To_VampDescriptor(PyObject* pyValue) const
151 //returns e.g. Vamp::Plugin::OutputDescriptor or Vamp::Plugin::Feature 151 //returns e.g. Vamp::Plugin::OutputDescriptor or Vamp::Plugin::Feature
152 { 152 {
153 PyObject* pyDict; 153 PyObject* pyDict;
154 154
155 // Descriptors encoded as dicts 155 // Descriptors encoded as dicts
181 } 181 }
182 182
183 /// Convert a sequence (tipically list) of PySomething to 183 /// Convert a sequence (tipically list) of PySomething to
184 /// OutputList,ParameterList or FeatureList 184 /// OutputList,ParameterList or FeatureList
185 template<typename RET,typename ELEM> //<OutputList> <OutputDescriptor> 185 template<typename RET,typename ELEM> //<OutputList> <OutputDescriptor>
186 RET PyTypeInterface::PyValue_To_VampList(PyObject* pyList) const 186
187 RET PyValue_To_VampList(PyObject* pyList) const
187 { 188 {
188 // Vamp::Plugin::OutputList list; 189 // Vamp::Plugin::OutputList list;
189 // Vamp::Plugin::OutputDescriptor od; 190 // Vamp::Plugin::OutputDescriptor od;
190 RET list; 191 RET list;
191 ELEM element; 192 ELEM element;
212 return list; 213 return list;
213 } 214 }
214 215
215 /// Convert DTYPE type 1D NumpyArray to std::vector<RET> 216 /// Convert DTYPE type 1D NumpyArray to std::vector<RET>
216 template<typename RET, typename DTYPE> 217 template<typename RET, typename DTYPE>
217 std::vector<RET> PyTypeInterface::PyArray_Convert(char* raw_data_ptr, long length) const 218 std::vector<RET> PyArray_Convert(char* raw_data_ptr, long length) const
218 { 219 {
219 std::vector<RET> rValue; 220 std::vector<RET> rValue;
220 DTYPE* data = (DTYPE*) raw_data_ptr; 221 DTYPE* data = (DTYPE*) raw_data_ptr;
221 for (long i = 0; i<length; ++i){ 222 for (long i = 0; i<length; ++i){
222 #ifdef _DEBUG 223 #ifdef _DEBUG