Re: [C++-sig] Wrap a c++ function that returns boost::shared_ptr<> type?

2008-12-17 Thread lin yun
Actually I used return_range with element type of unsigned short. Python interprets the element as int. You mean it is not difficult to wrap a function that returns vector> then? OK. Then the C++ class needs to take care of the memory when using return_range. I am still a newbie in boost python.

Re: [C++-sig] Wrap a c++ function that returns boost::shared_ptr<> type?

2008-12-17 Thread Roman Yakovenko
2008/12/18 lin yun : >> Yes. I believe Py++ deals with boost::shared_ptr without invoking the >> user. Just use default call policy. > That's good news! How about vector> ? No :-(, unsigned short is immutable type. You will have too write wrapper. Take a look on Py++ - ctypes functionality: http

Re: [C++-sig] Wrap a c++ function that returns boost::shared_ptr<> type?

2008-12-17 Thread lin yun
> Yes. I believe Py++ deals with boost::shared_ptr without invoking the > user. Just use default call policy. That's good news! How about vector> ? > Can you provide small example of what you are trying to do? I have a C++ function "imgreader" which reads an image and return a "unsigned short *"

Re: [C++-sig] Wrap a c++ function that returns boost::shared_ptr<> type?

2008-12-17 Thread Roman Yakovenko
2008/12/18 lin yun : > Hi, folks: > > I am trying to wrap a c++ function that returns a boost::shared_ptr class> type using boost.python, is that possible? Yes. I believe Py++ deals with boost::shared_ptr without invoking the user. Just use default call policy. > BTW, I used the call policy retur

[C++-sig] Wrap a c++ function that returns boost::shared_ptr<> type?

2008-12-17 Thread lin yun
Hi, folks: I am trying to wrap a c++ function that returns a boost::shared_ptr type using boost.python, is that possible? BTW, I used the call policy return_range included in Py++ for returning a pointer to a vector. It worked ! My question is that which side is responsible for releasing the mem

[C++-sig] Enums with duplicated values.

2008-12-17 Thread Hugo Lima
Hi; I need wrap enums with duplicated values, but boost::python do not support it. At the boost website you can find the quote: "Scott Snyder provided a patch; Dave was dissatisfied for some reason, but maybe it should just be applied if no further action occurs http://aspn.activestate.com/ASPN/M

Re: [C++-sig] Dynamic resolution of members and methods

2008-12-17 Thread Jérémie Delaitre
Stefan Seefeld a écrit : Jérémie Delaitre wrote: Ok, I have find a way to resolve all of my problem. I simply declare a new custom type which is callable. This way, when the user type in python 'myObj.myFunc(...)', mytype_getattro is called with 'myObj' as self and 'myFunc' as arg. Then, I retu

Re: [C++-sig] Dynamic resolution of members and methods

2008-12-17 Thread Stefan Seefeld
Jérémie Delaitre wrote: Ok, I have find a way to resolve all of my problem. I simply declare a new custom type which is callable. This way, when the user type in python 'myObj.myFunc(...)', mytype_getattro is called with 'myObj' as self and 'myFunc' as arg. Then, I return a new instance of the

Re: [C++-sig] Dynamic resolution of members and methods

2008-12-17 Thread Jérémie Delaitre
Ok, I have find a way to resolve all of my problem. I simply declare a new custom type which is callable. This way, when the user type in python 'myObj.myFunc(...)', mytype_getattro is called with 'myObj' as self and 'myFunc' as arg. Then, I return a new instance of the callable type which is fi