| 141 | } |
| 142 | |
| 143 | PyObject* toPython(void* obj, Edt tp) { |
| 144 | switch (tp) { |
| 145 | case REAL: return PyReal::toPythonCopy((Real*)obj); |
| 146 | case STRING: return String::toPythonCopy((string*)obj); |
| 147 | case INTEGER: return Integer::toPythonCopy((int*)obj); |
| 148 | case BOOL: return Boolean::toPythonCopy((bool*)obj); |
| 149 | case STEREOSAMPLE: return PyStereoSample::toPythonCopy((StereoSample*)obj); |
| 150 | case VECTOR_REAL: return VectorReal::toPythonRef((RogueVector<Real>*)obj); |
| 151 | case VECTOR_STRING: return VectorString::toPythonCopy((vector<string>*)obj); |
| 152 | case VECTOR_COMPLEX: return VectorComplex::toPythonRef((RogueVector<complex<Real> >*)obj); |
| 153 | case VECTOR_INTEGER: return VectorInteger::toPythonRef((RogueVector<int>*)obj); |
| 154 | case VECTOR_STEREOSAMPLE: return VectorStereoSample::toPythonCopy((vector<StereoSample>*)obj); |
| 155 | case VECTOR_VECTOR_REAL: return VectorVectorReal::toPythonCopy((vector<vector<Real> >*)obj); |
| 156 | case VECTOR_VECTOR_STRING: return VectorVectorString::toPythonCopy((vector<vector<string> >*)obj); |
| 157 | case VECTOR_VECTOR_STEREOSAMPLE: return VectorVectorStereoSample::toPythonCopy((vector<vector<StereoSample> >*)obj); |
| 158 | case MATRIX_REAL: return MatrixReal::toPythonRef((TNT::Array2D<Real>*)obj); |
| 159 | case VECTOR_MATRIX_REAL: return VectorMatrixReal::toPythonCopy((vector<TNT::Array2D<Real> >*)obj); |
| 160 | case POOL: return PyPool::toPythonRef((Pool*)obj); |
| 161 | |
| 162 | // WARNING: This list is very incomplete. For example, paramToPython uses this function and is |
| 163 | // supposed to support every kind of parameter including Maps of things which are obviously not |
| 164 | // currently supported in this function. To complete this list, make sure to see paramToPython. |
| 165 | |
| 166 | default: |
| 167 | throw EssentiaException("toPython: Unable to convert data type to a python type: ", edtToString(tp)); |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | typedef map<string, Real> mapreal; |
| 172 | typedef map<string, vector<Real> > mapvectorreal; |
no test coverage detected