Re: [C++-sig] Custom from-python converter (almost working)

2008-12-08 Thread pyplusplus
Hi, >> void >> p(vec3f *v) >> { >> printf("%f, %f, %f\n", v->x, v->y, v->z); >> } > > This is indeed not supported, since it would require "converters with > write-back". Ok, that makes sense. > vec3f const* v > > should work, but > > ve3f* v > > doesn't because the missing const indicates t

Re: [C++-sig] Custom from-python converter (almost working)

2008-12-08 Thread pyplusplus
Dang, my mailer got in the way and sent this before I finished it ... > Hi, > >>> void >>> p(vec3f *v) >>> { >>> printf("%f, %f, %f\n", v->x, v->y, v->z); >>> } >> >> This is indeed not supported, since it would require "converters with >> write-back". > > Ok, that makes sense. > >> vec3f cons

[C++-sig] Getting address of wrapped instance?

2008-12-08 Thread pyplusplus
Is there are way to get the address of the C++ instance pointed to by a given Boost.Python wrapper object? I don't need a real pointer, the address alone suffices. The use case is to deduce interrelations between C++ objects (think a DAG) from Python. As different Python wrapper objects might refe

Re: [C++-sig] Getting address of wrapped instance?

2008-12-08 Thread Renato Araujo
Hi Paul, Maybe this can help you: http://www.boost.org/doc/libs/1_36_0/libs/python/doc/v2/faq.html#xref I use: python::object o(python::ptr(my_cpp_pointer)); then I got the python object. BR On Mon, Dec 8, 2008 at 11:23 AM, <[EMAIL PROTECTED]> wrote: > Is there are way to get the address of

Re: [C++-sig] Getting address of wrapped instance?

2008-12-08 Thread Paul Melis
Hello Renato, On Mon, December 8, 2008 3:36 pm, Renato Araujo wrote: > Maybe this can help you: > http://www.boost.org/doc/libs/1_36_0/libs/python/doc/v2/faq.html#xref > > I use: > python::object o(python::ptr(my_cpp_pointer)); > > then I got the python object. Unfortunately, I need the (addres

Re: [C++-sig] Getting address of wrapped instance?

2008-12-08 Thread Stefan Seefeld
[EMAIL PROTECTED] wrote: Is there are way to get the address of the C++ instance pointed to by a given Boost.Python wrapper object? I don't need a real pointer, the address alone suffices. You may try using type const &ref = extract(object); HTH, Stefan -- ...ich hab' noch ei

Re: [C++-sig] Getting address of wrapped instance?

2008-12-08 Thread Paul Melis
On Mon, December 8, 2008 4:12 pm, Stefan Seefeld wrote: > [EMAIL PROTECTED] wrote: >> Is there are way to get the address of the C++ instance pointed to by a >> given Boost.Python wrapper object? I don't need a real pointer, the >> address alone suffices. >> > > You may try using > > type const &re

Re: [C++-sig] Getting address of wrapped instance?

2008-12-08 Thread Hans Meine
On Monday 08 December 2008 16:23:49 Paul Melis wrote: > On Mon, December 8, 2008 4:12 pm, Stefan Seefeld wrote: > > You may try using > > > > type const &ref = extract(object); > > Hmmm, reading my own post I now see I wasn't completely clear. > > I need this *in Python*. So for a given Python inst

Re: [C++-sig] Getting address of wrapped instance?

2008-12-08 Thread Stefan Seefeld
Hans Meine wrote: How about adding an id() method (returning this) to the C++ class and exporting that? Well, this 'id' isn't really a property of the wrapped type / object, but the wrapper. So, I think there is little sense in adding such a tautological 'id' function to the class itself.

[C++-sig] ANN: PyBindGen 0.10 released

2008-12-08 Thread Gustavo Carneiro
PyBindGen is a Python module that is geared to generating C/C++ code that binds a C/C++ library for Python. It does so without extensive use of either C++ templates or C pre-processor macros. It has modular handling of C/C++ types, and can be easily extended with Python plugins. The generated code

Re: [C++-sig] Custom from-python converter (almost working)

2008-12-08 Thread Ralf W. Grosse-Kunstleve
> In SWIG it is possible to simply define an extra class method that takes a > PyObject* and perform any conversion you want in that method (although > this means having to add that extra method for all cases where the > non-const pointer is used). Would something similar work in Boost.Python, > e.

Re: [C++-sig] Pickle an enum from c++

2008-12-08 Thread Matthew Scouten (TT)
>From the lack of response I assume that no one has any clever ideas to make an enum pickleable. Thank you to anyone who put thought into this. If I come up anything that works, I will let the group know. From: Matthew Scouten (TT) Sent: Tuesday, December 02, 2008 2:24 PM To: Development of P

Re: [C++-sig] Getting address of wrapped instance?

2008-12-08 Thread Roman Yakovenko
On Mon, Dec 8, 2008 at 6:42 PM, Stefan Seefeld <[EMAIL PROTECTED]> wrote: > Hans Meine wrote: >> >> How about adding an id() method (returning this) to the C++ class and >> exporting that? >> > > Well, this 'id' isn't really a property of the wrapped type / object, but > the wrapper. So, I think th

Re: [C++-sig] Pickle an enum from c++

2008-12-08 Thread Roman Yakovenko
2008/12/8 Matthew Scouten (TT) <[EMAIL PROTECTED]>: > From the lack of response I assume that no one has any clever ideas to make > an enum pickleable. Thank you to anyone who put thought into this. :-). I thought about work around: you can define your enums in Python. May be youcan add this fun