Re: [pygccxml-development] skipping base classes
Brought to you by:
mbaas,
roman_yakovenko
From: Ken M. <ke...@dn...> - 2008-09-17 14:26:55
|
Roman Yakovenko wrote: > On Wed, Sep 17, 2008 at 4:06 PM, Ken McGaugh <ke...@dn...> wrote: > >> Hello all, >> >> After reading through the archives, docs, and the source code I cannot >> find out a way to do the following. >> >> Say I have a class hierarchy like this: >> >> class A >> [...] >> >> class B : public A >> [...] >> >> class C : public B >> [...] >> >> I need to expose to python the classes A and C, but not B. When writing >> the boost::python code manually I do this: >> >> bp::class_<C, bp::bases<A> >("C") >> >> So that in python it thinks that C inherits directly from A and it all >> works. But now that I'm using Py++ I cannot figure out a way to achieve >> the same thing and I have to expose the intermediate classes, which for >> various reasons I really don't want to do. >> >> So is there a way to do what I want in Py++? >> > > I am not sure. I never tested such case. Try to exclude "B" and see > what happens. > When "B" is excluded then Py++ wraps the node with no bases listed whatsoever. > If it doesn't work I will have to tweak Py++ to support such case. It > should not be too difficult. > The way I imagine it working is that Py++ would list as the base class the first ancestor which has not been excluded. > One possible work around is to export class "B", but without any > members and to give it pretty ugly alias, starting with '__'. > Thanks, I'll give that a try. My main concern is getting the size of the module down, and I imaging a class with no members should be fairly light-weight. Thanks again. --Ken |