Managed c++

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

Managed c++

Vitthal  Kulkarni

 
I am trying to convert the calendar class of Quatlib to managed c++.
I have added the calendar class and other support classes as generic c++ class codes.

I am able to instantiate the class properly. When i access the class methods such as addDays, addHours, it exposes the method parameters properly. At compile time i get error that method is not part of Calendar class

error C2039

i used following code for class instantiation

Calendars::London * LN=new Calendars::London();
LN->AddDays(System::DateTime::Today,1);

i would appreciate if anyone can guide me on the problem.

regards,

Vitthal



Reply | Threaded
Open this post in threaded view
|

Re: Managed c++

Luigi Ballabio-2
On 2004.05.14 12:47, Vitthal  Kulkarni wrote:

> I am trying to convert the calendar class of Quatlib to managed c++.
> I have added the calendar class and other support classes as generic
> c++ class codes.
>
> I am able to instantiate the class properly. When i access the class
> methods such as addDays, addHours, it exposes the method parameters
> properly. At compile time i get error that method is not part of
> Calendar class
>
> i used following code for class instantiation
>
> Calendars::London * LN=new Calendars::London();
> LN->AddDays(System::DateTime::Today,1);

Vitthal,
        what version of QuantLib are you using? The C++ Calendar class  
doesn't have an AddDays method (and as far as I recall, it never had  
one.)

Later,
        Luigi



Reply | Threaded
Open this post in threaded view
|

Re: Re: managed c++

Vitthal  Kulkarni
In reply to this post by Vitthal Kulkarni

 
Hi,

I have problem in capflatvolatilityvector class. I implementing it in .net and using C# 3.1 library by thiel.

I am getting InvalidCastException error : "Specified cast not vaid error"

I hav coded it in following form

*------------------------------------------------

int SettlementDays=2;

int swFixedLegFrequency = 1;
Thirty360US swFixedLegDayCounter = new Thirty360US();
     
London LN=new London();
DateTime todaysDate=System.DateTime.Today;
settlementDate= LN.Advance(todaysDate, SettlementDays, TimeUnit.Days);

ArrayList Periodstest=new ArrayList();
DoubleVector Periodsvol=new DoubleVector();

volperiod=new Period(1,TimeUnit.Years);
  Periodstest.Insert(0,volperiod.Length);
volperiod=new Period(2,TimeUnit.Years);
  Periodstest.Insert(1,volperiod.Length);
volperiod=new Period(3,TimeUnit.Years);
  Periodstest.Insert(2,volperiod.Length);
volperiod=new Period(4,TimeUnit.Years);
  Periodstest.Insert(3,volperiod.Length);

Periodsvol.Insert(0,20);
Periodsvol.Insert(1,30);
Periodsvol.Insert(2,40);
Periodsvol.Insert(3,50);

CapVol=new CapFlatVolatilityVector
     (todaysDate,LN,SettlementDays,Periodstest,
          Periodsvol,swFixedLegDayCounter);

I would appreciate your comments on the error above.

regards,

Vitthal