Re: [PATCH] Payoffs fully implemented in a foreign language via SWIG

Posted by andrea-110 on
URL: http://quantlib.414.s1.nabble.com/PATCH-Payoffs-fully-implemented-in-a-foreign-language-via-SWIG-tp13242p13243.html

On 17/01/10 21:31, Andrea wrote:

> I would like to post 2 patches (one for QuantLib, the other for QuantLib-SWIG) to allow users to
> implement a payoff entirely in a foreign language (e.g. Java).
> These patches apply on top of the other patch I have just sent.
>
> By enabling directors the user can implement the "value" function in Java like it was a standard
> subclass of a C++ class.
>
> The goal here is not speed :-) but ease of use, by writing a payoff in a language like Java or C#.
>
> There is also a simple example of an option that pays the running average on every fixing date.
>
> Everything works fine with the exception of the following issue. But I thought to post the code
> since I could not find a better solution that what I have currently implemented.

I've actually found a better solution, but it requires a global change in QuantLib-SWIG.

>
> I wish I had a shared_ptr<ExternalOption> but I only have a raw pointer or a reference.
>
> It is a problem similar to the original, but I found it is easier to manage. It is all down to the
> use of shared_ptr in SWIG.
>

In SWIG there is already support for boost::shared_ptr<> that removes distinction between raw
pointer, value, reference and smart pointer making it all easier.
The problem is that QuantLib-SWIG uses a custom definition of boost::shared_ptr<> (in common.i).

SWIG provides a "shared_ptr.i".
Does anybody know why it is not used?

Andrea

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev