How to correctly Extend swig PiecewiseYieldCurve.i

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to correctly Extend swig PiecewiseYieldCurve.i

imachabeli
I tried to add thrd parameter Bootstrap type to  export_piecewise_curve like
this

%define export_piecewise_curve(Name,Base,Interpolator,Bootstrap)

and then
export_piecewise_curve(PiecewiseFlatForward,ForwardRate,BackwardFlat,IterativeBootstrap);

Code produced by swig looks like this

SWIGINTERN PiecewiseFlatForwardPtr *new_PiecewiseFlatForwardPtr__SWIG_0(Date
const &referenceDate,std::vector< boost::shared_ptr< RateHelper > > const
&instruments,DayCounter const &dayCounter,std::vector< Handle< Quote > >
const &jumps=std::vector< Handle< Quote > >(),std::vector< Date > const
&jumpDates=std::vector< Date >(),Real accuracy=1.0e-12,BackwardFlat const
&i=BackwardFlat()){
            return new PiecewiseFlatForwardPtr(
                new
PiecewiseYieldCurve<ForwardRate,BackwardFlat,IterativeBootstrap>(
                                                 referenceDate,instruments,
                                                 dayCounter, jumps,
jumpDates,
                                                 accuracy,i));
        }

And compiler curses

Error    7    error C3206: 'boost::dynamic_pointer_cast' : invalid template
argument for 'T', missing template argument list on class template
'QuantLib::PiecewiseYieldCurve'
C:\quantliball\QuantLib-SWIG\CSharp\cpp\quantlib_wrap.cpp    7634    1
NQuantLibc

Error    15    error C2065: 'IterativeBootstrap' : undeclared identifier
C:\quantliball\QuantLib-SWIG\CSharp\cpp\quantlib_wrap.cpp    7649    1
NQuantLibc


I understand that IterativeBootstrap itself is a template class and that’s
probably the reason, but in test suite similar code compiles fine
testCurveConsistency<ZeroYield,Cubic,IterativeBootstrap> ...


------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to correctly Extend swig PiecewiseYieldCurve.i

Luigi Ballabio
There's a bunch of "using" directives in the file that extract the
class names from the QuantLib namespace. You'll probably have to add

using QuantLib::IterativeBootstrap;

to the existing ones.

Luigi


On Fri, May 31, 2013 at 12:41 AM, Irakli Machabeli
<[hidden email]> wrote:

> I tried to add thrd parameter Bootstrap type to  export_piecewise_curve like
> this
>
> %define export_piecewise_curve(Name,Base,Interpolator,Bootstrap)
>
> and then
> export_piecewise_curve(PiecewiseFlatForward,ForwardRate,BackwardFlat,IterativeBootstrap);
>
> Code produced by swig looks like this
>
> SWIGINTERN PiecewiseFlatForwardPtr *new_PiecewiseFlatForwardPtr__SWIG_0(Date
> const &referenceDate,std::vector< boost::shared_ptr< RateHelper > > const
> &instruments,DayCounter const &dayCounter,std::vector< Handle< Quote > >
> const &jumps=std::vector< Handle< Quote > >(),std::vector< Date > const
> &jumpDates=std::vector< Date >(),Real accuracy=1.0e-12,BackwardFlat const
> &i=BackwardFlat()){
>             return new PiecewiseFlatForwardPtr(
>                 new
> PiecewiseYieldCurve<ForwardRate,BackwardFlat,IterativeBootstrap>(
>                                                  referenceDate,instruments,
>                                                  dayCounter, jumps,
> jumpDates,
>                                                  accuracy,i));
>         }
>
> And compiler curses
>
> Error    7    error C3206: 'boost::dynamic_pointer_cast' : invalid template
> argument for 'T', missing template argument list on class template
> 'QuantLib::PiecewiseYieldCurve'
> C:\quantliball\QuantLib-SWIG\CSharp\cpp\quantlib_wrap.cpp    7634    1
> NQuantLibc
>
> Error    15    error C2065: 'IterativeBootstrap' : undeclared identifier
> C:\quantliball\QuantLib-SWIG\CSharp\cpp\quantlib_wrap.cpp    7649    1
> NQuantLibc
>
>
> I understand that IterativeBootstrap itself is a template class and that’s
> probably the reason, but in test suite similar code compiles fine
> testCurveConsistency<ZeroYield,Cubic,IterativeBootstrap> ...
>
>
> ------------------------------------------------------------------------------
> Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
> Get 100% visibility into your production application - at no cost.
> Code-level diagnostics for performance bottlenecks with <2% overhead
> Download for free and get started troubleshooting in minutes.
> http://p.sf.net/sfu/appdyn_d2d_ap1
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev