Re: Accessing the FixedRateCoupons and IborCoupons of a Swap from Java
Posted by
Henner Heck on
Nov 26, 2010; 4:30pm
URL: http://quantlib.414.s1.nabble.com/Accessing-the-FixedRateCoupons-and-IborCoupons-of-a-Swap-from-Java-tp6384p6385.html
FYI,
i solved the problem by adding a static function
which performs the cast to IborCoupon and FixedRateCoupon
and also the cashflows.i of the SWIG files. I also added all
the public functions from these classes and their parents
to the SWIG file to be able to use them from Java.
Is it possible and desired to add such changes to the official QuantLib?
Best regards,
Henner heck
>
> Hello all,
>
> after evaluating a VanillaSwap i have access to
> the contents of the legs in form of CashFlows.
> Actually the fixed leg consists of FixedRateCoupons
> and the floating leg consists of IborCoupons,
> which both inherit from CashFlow.
> I want to gain access to the functions available
> in addition to CashFlow.
> In C++ one would apply a
> "boost::dynamic_pointer_cast<FixedRateCoupon>"
> or
> "boost::dynamic_pointer_cast<IborCoupon>"
> to the CashFlows. Casting the Java object doesn't work,
> and trying to abuse the Swig pointer of the CashFlow to
> create e.g. an IborCoupon with
> "IborCoupon ic = new IborCoupon(CashFlow.getCPtr(cashflow), true);"
> actually works, but at some point the whole JVM crashes
> with a fatal error:
> "# The crash happened outside the Java Virtual Machine in native code."
> I suspect that my dual use of the pointer out of Java leads to problems
> when collecting the garbage.
>
> Could someone point me in the right direction?
>
>
> Best regards,
> Henner Heck
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users