If you can build a wrapper function which returns a
boost::numeric::ublas::vector<float>, you can use the wrappers into
the mds-utils library (http://code.google.com/p/mds-utils/  ...  it's
my library). If you build the doxygen documentation, you'll find a
"Python C++ extensions utilities": use the "vector.hpp" and look at
the usage examples.

Bye.
Michele

2010/1/20 Ng, Enrico <enrico...@lmco.com>:
> I have C code similar to the following:
>
> float image_data[IMAGE_SIZE];
> const float *get_data()
>
> get_data returns a pointer to image_data.  I'd like to expose get_data to 
> python and have it return a copy of the array in some Python type.  (it is 
> actually a 2D array of image data)
>
>
> In the wrapper code, I tried something like:
>
> numeric::array  py_get_data()
> {
>  return numeric::array(get_data());
> }
>
> With
>  .def("get_data", &wrap::py_get_data)
>
>
> But I get this error:
>
> TypeError: No to_python (by-value) converter found for C++ type: float
>
>
> I thought I had done this in the past but I must be missing something.  Any 
> help would be much appreciated.
>
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig@python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>



-- 
Michele De Stefano
http://www.linkedin.com/in/micdestefano
http://code.google.com/p/mds-utils
http://xoomer.virgilio.it/michele_de_stefano
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to