Re: Return object in QLXL
Posted by
Ferdinando M. Ametrano-2 on
URL: http://quantlib.414.s1.nabble.com/Return-object-in-QLXL-tp8942p8945.html
Hi Peter
> What I do not manage is to export a member function in another object of
> type A which returns a shared_ptr to another type B.
here it is, namely a SwapRateHelper returning a shared_ptr<VanillaSwap> using its own SwapRateHelper::swap() method:
VanillaSwap::VanillaSwap(
const shared_ptr<ValueObject>& properties,
const shared_ptr<QuantLib::SwapRateHelper>& swapRH,
bool permanent)
: Swap(properties, permanent)
{
libraryObject_ = swapRH->swap();
}
and the wrapping code is auto-generated by the following xml:
<Constructor name='qlVanillaSwapFromSwapRateHelper'>
<libraryFunction>VanillaSwap</libraryFunction>
<SupportedPlatforms>
<SupportedPlatform name='Excel'/>
<SupportedPlatform name='Cpp'/>
</SupportedPlatforms>
<ParameterList>
<Parameters>
<Parameter name='SwapRateHelper'>
<type>QuantLib::SwapRateHelper</type>
<tensorRank>scalar</tensorRank>
<description>SwapRateHelper object ID.</description>
</Parameter>
</Parameters>
</ParameterList>
</Constructor>
The key point here is that even if in C++ swap() is just a method of SwapRateHelper returning shared_ptr<VanillaSwap>, in QLXL is used as "constructor" of a new Object wrapping the shared_ptr<VanillaSwap>
does this answer your question?
ciao -- Nando
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev