Posted by
andrea-110 on
URL: http://quantlib.414.s1.nabble.com/QuantLib-SWING-is-it-possible-to-use-polymorphism-tp13142p13146.html
On 29/10/09 16:03, Luigi Ballabio wrote:
> On Wed, 2009-10-21 at 17:58 +0100, Andrea wrote:
>> On 21/10/09 15:55, Luigi Ballabio wrote:
>>> unfortunately, polymorphism doesn't currently work across
>> languages.
>>>
>> Indeed.
>> I've tried to use directors and it seems to work well if there are no
>> shared_ptr involved.
>>
>> My problem now is [...] I don't seem to be able to create a shared_ptr
>> in the target language.
>
> There would be quite a bit of work to do. You would have to:
> - add a constructor to boost::shared_ptr in common.i so that it takes a
> pointer;
I've got a big doubt here.
Is it safe to stick the raw pointer into a shared_ptr? Is it already owned by some other swig mechanism?
> - modify the exported payoff classes so that they no longer hide the
> shared_ptr (e.g., export the actual PlainVanillaPayoff, not
> PlainVanillaPayoffPtr) and enable directors;
> - export the shared_ptr<Payoff> as a separate class;
> - fix the other interfaces so that they work with the new classes.
>
> Let me know if you get stuck in any of the steps.
>
> Luigi
>
>
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev