[C++-sig] Py++ - one header file including all project header files

2010-03-17 Thread Maciej Sitarz
Hello, I'm attempting to create python module for CREAM Client API (http://grid.pd.infn.it/cream/). After reading Py++ "best practices" I tried to include all needed headers into one and then add it to Py++. But then the resulting .cpp file doesn't have any wrappers inside, only for one func

Re: [C++-sig] Py++ - one header file including all project header files

2010-03-17 Thread Roman Yakovenko
On Wed, Mar 17, 2010 at 9:38 AM, Maciej Sitarz wrote: > Hello, > > I'm attempting to create python module for CREAM Client API > (http://grid.pd.infn.it/cream/). > > After reading Py++ "best practices" I tried to include all needed headers > into one and then add it to Py++. But then the resulting

Re: [C++-sig] Ownership of a C++ object extended in Python using wrapper

2010-03-17 Thread Neal Becker
Alexandre Hamez wrote: > > On 16 mars 2010, at 13:12, Neal Becker wrote: > >> Alexandre Hamez wrote: >> >>> Hi all, >>> >>> I have a C++ library that needs to store in a hash map user's code, that >>> is, Python-extended objects. To make the C++ interface available to >>> Python, I use boost::

Re: [C++-sig] Ownership of a C++ object extended in Python using wrapper

2010-03-17 Thread Alexandre Hamez
On 16 mars 2010, at 22:21, Jim Bosch wrote: > On Tue, 2010-03-16 at 20:56 +0100, Alexandre Hamez wrote: >> On 16 mars 2010, at 13:12, Neal Becker wrote: >> >>> Alexandre Hamez wrote: >>> Hi all, I have a C++ library that needs to store in a hash map user's code, that is, Py

Re: [C++-sig] Ownership of a C++ object extended in Python using wrapper

2010-03-17 Thread Neal Becker
One tradeoff, I believe, If you have, say: class A { A (boost::shared_ptr) boost::shared_ptr B_obj; }; Then each time you use B_obj, there is additional dereference overhead IIUC. If I used with_custodian_and_ward, there should not be this additional overhead.

[C++-sig] errors while setting arguments description for the method

2010-03-17 Thread Gennadiy Rozental
I've got specification like this: class_( "Foo", "Foo descr" ) .def( "__init__", bp::make_constructor( &make_foo ), bp::args( "self", "str" ), "Constructor based on string representation.\n" ) ... I am getting compilation error below from VC9.0. Error disappears i

Re: [C++-sig] errors while setting arguments description for the method

2010-03-17 Thread Jim Bosch
On Wed, 2010-03-17 at 22:21 +, Gennadiy Rozental wrote: > I've got specification like this: > > class_( "Foo", "Foo descr" ) > .def( "__init__", bp::make_constructor( &make_foo ), >bp::args( "self", "str" ), >"Constructor based on string representation.\n" )

Re: [C++-sig] Having problems with returned object.

2010-03-17 Thread Jim Bosch
On Mon, 2010-03-15 at 21:25 -0600, Fabzter wrote: > void export_jugada() > { > class_("MyClass") > .def("setPos", setPosicion_with_int(&MyClass::setPos) ) > .def("setPos", setPosicion_with_vect(&MyClass::setPos) ) > > .def("getPosicion", &MyClass::getPosicion, >

[C++-sig] passing pointers from python

2010-03-17 Thread hitesh dhiman
Hi all, i'm trying to wrap c++ functions that have pointer variables. The test example i'm using is shown below: int World::addition(int* a, int* b) { int z = *a + *b; return z; } Now, i defined it in my wrapper as : .def("addition", &World::addition) My code compiles, but when I try to execute i

[C++-sig] Overriding Virtual Functions

2010-03-17 Thread Nathan Stewart
I have a C++ class like so: namespace Foo { class TypeA {}; class TypeB {}; class Connection { template void Publish(const T&); virtual void OnEvent(const TypeA&) {} virtual void OnEvent(const TypeB&) {} }; } I've exported it like so: namespace { class Conn

[C++-sig] Executing scripts in other namespace than __main__

2010-03-17 Thread Fabzter
Hi everybody, it's my annoying again. I have a pure virtual class in C++ wich I have wrapped and exposed (call it BaseClass), and I let the users inherit from it to make their own class in their script. It's worth noting that I do not know the name of such class they are creating. When I load only