Re: [C++-sig] Python-overridable method taking const ref?

2009-02-04 Thread Paul Melis
Roman Yakovenko wrote: > On Wed, Feb 4, 2009 at 9:26 PM, Paul Melis > wrote: > >> Hi Roman, >> > > Try this one, works for me: > // This file has been generated by Py++. > > // Copyright 2004-2008 Roman Yakovenko. > // Distributed under the Bo

Re: [C++-sig] Python-overridable method taking const ref?

2009-02-04 Thread Paul Melis
Hi Roman, Roman Yakovenko wrote: > On Wed, Feb 4, 2009 at 8:49 PM, Paul Melis > wrote: > >> Classes with protected destructors (as found when custom reference >> counting is used) seem to cause some trouble when using bp::wrapper<> >> containing a method

[C++-sig] Python-overridable method taking const ref?

2009-02-04 Thread Paul Melis
Hello, Classes with protected destructors (as found when custom reference counting is used) seem to cause some trouble when using bp::wrapper<> containing a method that takes a const reference to a refcounted class. Say I have: #include #include namespace bp = boost::python; class Thing { p

Re: [C++-sig] Custom smart pointer and bp::wrapper

2009-01-23 Thread Paul Melis
Paul Melis wrote: > Roman Yakovenko wrote: > >> 2009/1/17 Paul Melis : >> >> >>> But when trying to run >>> >>> import doh >>> >>> class MyCallback(doh.Callback): >>>def execute(self, t): >>

Re: [C++-sig] Custom smart pointer and bp::wrapper

2009-01-18 Thread Paul Melis
Roman Yakovenko wrote: > 2009/1/17 Paul Melis : > >> But when trying to run >> >> import doh >> >> class MyCallback(doh.Callback): >>def execute(self, t): >>print t >>return 1 >> >> m = MyCallback() >>

[C++-sig] Custom smart pointer and bp::wrapper

2009-01-17 Thread Paul Melis
Given two reference-counted classes Thing and Callback, and using a custom smart pointer ref_ptr, with all the needed pointee stuff added and using ref_ptr<..> as held type I'm getting into trouble when trying to use a boost::python::wrapper<> derived class. See the attached files for the complete

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

2008-12-09 Thread Paul Melis
Roman Yakovenko wrote: > 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

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

2008-12-09 Thread Paul Melis
Ralf W. Grosse-Kunstleve wrote: >> 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 somethin

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 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] Manage new object return policy (was Re: new to python; old to C++)

2008-11-12 Thread Paul Melis
David Abrahams wrote: > on Mon Nov 10 2008, Paul Melis wrote: > > >> The FAQ entry on this doesn't really help, so perhaps I'm not using the >> return policy >> correctly or missing something else. The full test code (which is actually >> quit

[C++-sig] Manage new object return policy (was Re: new to python; old to C++)

2008-11-10 Thread Paul Melis
David Abrahams wrote: > on Sat Nov 01 2008, Paul Melis wrote: > > >> Gustavo Carneiro wrote: >> >>> There's an interesting question about whether it's better to use >>> boost.python or SWIG. I've been using boost.python for y

Re: [C++-sig] new to python; old to C++

2008-11-01 Thread Paul Melis
Gustavo Carneiro wrote: > > There's an interesting question about whether it's better to use > boost.python or SWIG. I've been using boost.python for years, so I > have a lot invested in it, but if I were starting from scratch, I > might consider using SWIG because it gives you the