[C++-sig] to python conversion for derived facade
goldberg at coredp.com
Mon Apr 14 22:12:59 CEST 2008
In the end, I determined that I cannot autmoatically convert to a
derived class unless I expose it, which makes sense, I guess.
Roman Yakovenko wrote:
>On Thu, Apr 10, 2008 at 7:12 PM, Moe Goldberg <goldberg at coredp.com> wrote:
>> I don't have a lot of experience with boost, expecially not with
>> to_python_converters, and I've been getting some unexpected results. I
>> have spent a while looking around to see what I can find, but I can't
>> seem to solve my problem, hopefully someone here can give me a hand.
>> Here's the situation. I have a facade class, and a class derived from
>> it. The facade class is exposed to python but the derived class isn't
>> (there are reasons for this, so exposing the derived class to python
>> isn't an option). The derived class wraps a type (let's call it cpp_type
>> - and it is also a type that I do not want exposed to python) that the
>> base class does not.
>> I several functions that return a cpp_type_sptr (a smart pointer to
>> cpp_type). I would like to create a to python converter so that I don't
>> have to manually wrap each function that returns a cpp_type_sptr.
>I am not sure whether I understand what you are trying to do, but if
>you want to return something different from the function you can
>define custom call policy.
>Take a look on custom call policies I defined
>source code: http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/pyplusplus/code_repository/
>This solution also allows you not to expose cpp_type_sptr class.
More information about the Cplusplus-sig