Re: [C++-sig] Boost.Python & OpenSceneGraph

2009-09-09 Thread Jean-Sébastien Guay
Hi Randolph, I wish you and your work well, but I don't see how I can do this. NodeCallback and NodeVisitor are exactly where I ran into problems with osgswig--they are important, and hard to get right. Actually I don't know if you saw my messages from last night, but it works fine now. But

Re: [C++-sig] Quick question about wrapping methods that have multiple versions

2009-09-08 Thread Jean-Sébastien Guay
Hi Stefan, This is not a wrapper function, but an alias. You create a new variable 'B_getA1', and make this point to B::getA (the non-const version). This works, since by means of the variable type you disambiguate, so using that in the call to def() works unambiguously. Sorry, thanks for cor

[C++-sig] Quick question about wrapping methods that have multiple versions

2009-09-08 Thread Jean-Sébastien Guay
Hi all, This may be an FAQ, but if so I haven't seen it in the FAQs (on the wiki and in the docs). Say I have this: class A {}; class B { public: A* getA(); const A* getA() const; }; If I just add .def("getA", &B::getA, some_return_policy) to my class_ wrapper, on compile it will

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread Jean-Sébastien Guay
Hi Renato, You can use "boost::python::ptr(your_cpp_cpointer)" this avoid create unecessary copies. Thanks for the tip, boost::ref() for references and boost::python::ptr() for pointers, makes sense. J-S -- __ Jean-Sebastien Guayjean-s

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread Jean-Sébastien Guay
Hi all, I found an post from earlier this year to this list where David Abrahams said: If you want to pass an object by reference to a python function, you have to wrap it in boost::ref(). Otherwise, it will try to copy the object and the resulting copy will have to be de

Re: [C++-sig] Boost.Python & OpenSceneGraph

2009-09-08 Thread Jean-Sébastien Guay
Hi Randolph, I am working on an OpenSceneGraph/Python project and have had to abandon the OSG/SWIG tools--they are not developed enough for my purpose. So I am planning on writing special purpose code to that end. Does anyone have suggestions for someone starting out on this path? Heh, if

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread Jean-Sébastien Guay
Hi Troy, Competitive isn't an issue, as swig and boost.python bindings aren't really compatible (or is that 'sip' bindings that aren't compatible?). Personally I prefer a manual approach over automatically generated bindings; apparently for the same reasons that some compiler writers insist o

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread Jean-Sébastien Guay
Hi again Troy, I was thinking of setting up a googlecode project for this work, because there is at least one other person who might be interested in working with me on it (Paul Melis). I'll see if I can do that soon. It's done now, here: http://code.google.com/p/osgboostpython/ Note that I

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread Jean-Sébastien Guay
Hello Troy, I've been doing a bunch of work with osg recently. I like it and badly miss some boost.python bindings. I'd be very interested to have a look at the code here, maybe pitch in a bit. Is there a git archive I can clone, and a failing test I can run? I was thinking of setting up

[C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-07 Thread Jean-Sébastien Guay
Hi all, Thanks to previous help (a while ago) I was able to make considerable progress wrapping a pretty complex library (OpenSceneGraph) with boost.python. I've been working on this a bit more lately in my free time, and I've been able to wrap pretty much everything I wanted to. It's startin