Re: QuantLib-SWING: is it possible to use polymorphism?

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/QuantLib-SWING-is-it-possible-to-use-polymorphism-tp13142p13147.html

On Thu, 2009-10-29 at 17:59 +0000, Andrea wrote:
> > 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?

You're right, the shared_ptr would take ownership against SWIG.
I don't see any easy solution to this one...

Another possibility would be to write a C++ payoff that adapts a Java
payoff. Its constructor would take a Java instance and store it, and its
operator() would use the foreign interface to call the corresponding
method in the Java instance. Kind of a home-made director. I don't know
if it would be possible to hide the mechanism so that it seems that the
Java class inherits from Payoff, though...

Luigi


--

There's no sense in being precise when you don't even know what you're
talking about.
-- John von Neumann



------------------------------------------------------------------------------
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