[C++-sig] Very New to Boost Python
Ajay Murthy
ajay.murthy at philips.com
Fri May 11 06:33:51 CEST 2007
Hi All,
I am very new to Boost.Python and I am facing the following problem.
Here is my C++ class declaration:
class Matrix
{
public:
Matrix(int rows, int cols);
Matrix(const Matrix& m);
inline int GetCols() { return numCols;}
inline int GetRows() { return numRows;}
int** Get_Buffer();
void SetStride(int x, int y);
Matrix& operator*(const Matrix& m);
Vector& operator[](int index);
Matrix& operator=(const Matrix& m);
private:
void SetSize(int rows, int cols);
int numCols, numRows;
Vector* matrix;
int ystride;
};
And the corresponding Boost.Python wrapper is
BOOST_PYTHON_MODULE(DataTypes)
{
class_<Matrix>("Matrix", init<int, int>())
.def("GetCols", &Matrix::GetCols)
.def("GetRows", &Matrix::GetRows)
.def("SetStride", &Matrix::SetStride)
//.def("Get_Buffer", &Matrix::Get_Buffer)
//.def(self * self)
//.def(__getitem__(self, int)
//.def(__setitem__(self, int, int)
;
}
As you might have already observed, I have commented out few lines in the
wrapper. If i uncomment it, bjam doesnt work.
>From the initial analysis it seems to be a problem with the methods which
accepts/returns arguments other than the primitive types. I may be wrong
here.
Anyways, could anyone please explain me what the problem could be and the
solution for the same.
Also, it would help if you could point me to some good documentation. The
documentation in the boost.python page is very helpful for basic
understanding but not after that.
thanks in advance,
Ajay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070511/367fdf26/attachment.htm>
More information about the Cplusplus-sig
mailing list