expose to excel a function with vector of shared_ptr to objects as argument

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

expose to excel a function with vector of shared_ptr to objects as argument

ikku100
Good day,

The subject says it all: I would like to expose to Excel a function which has as argument a vector of shared_ptr's. The problem is that either I do not know how to write the xml or that the scripts which generate the cpp code from the xml do not know how to handle this combination.

Passing a shared_ptr works, passing a vector of objects works too. But as soon as I pass the combination, it no longer creates the object in the create_XXX.cpp file (so when the constructor is called, it has an unknown argument).

Could someone tell me how to do this?

Ps. below my piece of XML:

    <Constructor name='qlCurvesInterpolator'>
      <libraryFunction>CurvesInterpolator</libraryFunction>
      <SupportedPlatforms>
        <SupportedPlatform name='Excel'/>
        <SupportedPlatform name='Cpp'/>
      </SupportedPlatforms>
      <ParameterList>
        <Parameters>
          <Parameter name='CurveIds'>
            <type>QuantLib::YieldTermStructure</type>
            <tensorRank>vector</tensorRank>
            <description>curve object IDs.</description>
          </Parameter>
        </Parameters>
      </ParameterList>
    </Constructor>

and the error is:
error C2065: 'CurveIdsLibObjPtr' : undeclared identifier
Reply | Threaded
Open this post in threaded view
|

Re: expose to excel a function with vector of shared_ptr to objects as argument

Eric Ehlers-2
Hello,

On 2014-02-12 11:21, ikku100 wrote:

> Good day,
>
> The subject says it all: I would like to expose to Excel a function
> which
> has as argument a vector of shared_ptr's. The problem is that either I
> do
> not know how to write the xml or that the scripts which generate the
> cpp
> code from the xml do not know how to handle this combination.
>
> Passing a shared_ptr works, passing a vector of objects works too. But
> as
> soon as I pass the combination, it no longer creates the object in the
> create_XXX.cpp file (so when the constructor is called, it has an
> unknown
> argument).
>
> Could someone tell me how to do this?
>
> Ps. below my piece of XML:
>
>     <Constructor name='qlCurvesInterpolator'>
>       <libraryFunction>CurvesInterpolator</libraryFunction>
>       <SupportedPlatforms>
>         <SupportedPlatform name='Excel'/>
>         <SupportedPlatform name='Cpp'/>
>       </SupportedPlatforms>
>       <ParameterList>
>         <Parameters>
>           <Parameter name='CurveIds'>
>             <type>QuantLib::YieldTermStructure</type>
>             <tensorRank>vector</tensorRank>
>             <description>curve object IDs.</description>
>           </Parameter>
>         </Parameters>
>       </ParameterList>
>     </Constructor>
>
> and the error is:
> error C2065: 'CurveIdsLibObjPtr' : undeclared identifier

This should do it:

       <Constructor name='qlCurvesInterpolator'>
           <libraryFunction>CurvesInterpolator</libraryFunction>
           <SupportedPlatforms>
               <SupportedPlatform name='Excel'/>
               <SupportedPlatform name='Cpp'/>
           </SupportedPlatforms>
           <ParameterList>
               <Parameters>
                   <Parameter name='CurveIds'>
                       <type>QuantLib::YieldTermStructure</type>
                       <superType>libraryClass</superType>
                       <tensorRank>vector</tensorRank>
                       <description>curve object IDs.</description>
                   </Parameter>
               </Parameters>
           </ParameterList>
       </Constructor>

Kind Regards,
Eric
--
===================================================
Eric Ehlers
nazcatech sprl | Brussels | http://www.nazcatech.be
* Distributed computing for pricing analytics
* Use Microsoft Excel as a client to the Grid

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev