Re: Python: BlackIborCouponPricer; SwapRateHelper solved

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/Python-BlackIborCouponPricer-SwapRateHelper-solved-tp5560p5563.html

On Mon, 2009-11-09 at 21:13 +0100, LluĂ­s Pujol wrote:
> I am trying to create the shared_ptr<FloatingRateCouponPricer>
> interface, as suggested I followed the shared_ptr<CashFlow>, but I got
> lost with the private member and also the registerWith that cointains
> IborCouponPricer.

Sorry for the delay.

I meant something like this for the base class:

%ignore IborCouponPricer;
class IborCouponPricer {
  public:
    // export the public interface here, if needed
};

%template(IborCouponPricer) boost::shared_ptr<IborCouponPricer>;

After that,
1) you'll add the setPricer() method to IborCoupon taking a
boost::shared_ptr<IborCouponPricer>;
2) you'll export the constructors for the concrete pricers such as
BlackIborCouponPricer with something like:

%{
typedef boost::shared_ptr<IborCouponPricer> BlackIborCouponPricerPtr;
%}

%rename(BlackIborCouponPricer) BlackIborCouponPricerPtr;
class BlackIborCouponPricerPtr
: public boost::shared_ptr<IborCouponPricer> {
  public:
    %extend {
        BlackIborCouponPricerPtr(...) {
            return new BlackIborCouponPricerPtr(
                new BlackIborCouponPricer(...));
        }
    }
};


Luigi




--

Discontent is the first necessity of progress.
-- Thomas A. Edison



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users