Posted by
Peter Caspers on
URL: http://quantlib.414.s1.nabble.com/Return-object-in-QLXL-tp8942p8944.html
Hi Nando,
thanks a lot. Sorry for my ignorance of QLXL first of all.
I have no problem exporting a constructor to excel which creates say an
object of type B.
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. As far as I understood
exporting member functions requires only an xml of the form
<Member name='qlMemberFunctionWhichReturnsB' type='QuantLib::A'>
...
<ReturnValue>
<type>QuantLib::B</type>
<superType>libraryClass</type>
<tensorRank>scalar</tensorRank>
</ReturnValue>
...
</Member>
but exactly this automatism does not work, because in the generated files
at some point "string" meets "shared_ptr" and compilation crashes.
I looked at the files recommended by you, but in qlo / vanillaswap.hpp I
only see constructors. Also I do not see that the underlyingSwap() method
of swapindex is exported to excel (at least not the way I want to do it).
My workaround is to export another constructor for type B which takes A as
an argument and mimics the member function I originally wanted to export.
Does this make sense? Can you help?
Or to put the question more simple: Is there any example in the xml files
where a member function is exported which returns a reference to a QuantLib
Object, which is not a native type or convertible to a native type?
Thanks a lot again, best
Peter
"Ferdinando M.
Ametrano"
<ferdinando@ametr An
ano.net> Peter Caspers
<
[hidden email]>
15.06.2010 12:32 Kopie
[hidden email]
Thema
Re: [Quantlib-dev] Return object
in QLXL
Hi Peter
On Fri, Jun 11, 2010 at 6:03 PM, Peter Caspers <
[hidden email]>
wrote:
> a member function which returns a shared_ptr<KerndelDensity>
> [...]
> I did not find an example in the existing code where an object
> (other than native types) is returned, so can someone explain
> to me, how to do this?
in QLXL if you have to return a shared_ptr<T> it's equivalent to
create a new Object in the repository, i.e. a new pointer to a new or
already existing object
Take a look at trunk\QuantLibAddin\qlo\vanillaswap.hpp for examples.
One can create a VanillaSwap in the classic way, or using helper
factories (MakeVanillaSwap, MakeIMMSwap), or can retrieve a new
pointer to an existing instance (SwapIndex->underlyingSwap(),
SwapRateHelper->swap()(
Let me know if you need more help
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------------------------------------------------------------------------------------------------------------------------------------------------------
WGZ BANK AG Westdeutsche Genossenschafts-Zentralbank
Sitz: Düsseldorf, Registergericht: Amtsgericht Düsseldorf, HRB 52363
Vorstand: Werner Böhnke (Vors.), Karl-Heinz Moll, Hans-Bernd Wolberg,
Uwe Berghaus (stellv.), Dr. Christian Brauckmann (stellv.), Michael Speth
(stellv.)
Vorsitzender des Aufsichtsrats: Dieter Philipp
Ueber das Internet versandte E-Mails koennen unter fremdem Namen erstellt
oder inhaltlich veraendert werden. Aus diesem Grund sind unsere als E-Mail
verschickten Nachrichten grundsaetzlich keine rechtsverbindlichen
Erklaerungen. Der Inhalt dieser E-Mail samt Anlagen ist vertraulich und u.
U. rechtlich geschuetzt. Der Inhalt ist ausschließlich an einen bestimmten
Empfaenger gerichtet. Eine Weitergabe, die Herstellung von Kopien oder der
sonstige Gebrauch durch Nichtadressaten ist nicht erlaubt.
Messages sent by e-mail can be manipulated by third parties. For this
reason our e-mail messages are generally not legally binding. This
electronic message (including any attachments) contains confidential
information and may be privileged or otherwise protected from disclosure.
The information is intended to be for the use of the intended addressee
only. Please be aware that any copy, distribution or use of the contents of
this message by any other person than the intended addressee is prohibited.
------------------------------------------------------------------------------
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