1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| TP_API void _stdcall PricerVba(VARIANT aleas, double multiplicateur, double maturite, double N, double garantie, double nav1, double r, VARIANT* res){
double* cheminAleas = variantToDouble(aleas);
double** pricer = PricerCpp(cheminAleas, multiplicateur, maturite, N, garantie, nav1, r);
CComSafeArray<double> array;
CComSafeArrayBound Bounds[2];
// la dimension correspondant aux lignes
Bounds[0].SetLowerBound(0);
Bounds[0].SetCount(N+1);
// la dimension correspondant aux colonnes
Bounds[1].SetLowerBound(0);
Bounds[1].SetCount(3);
array.Create(Bounds, 2);
for (int i = 0; i <= N; i++){
long nav_Idx[2] = { i, 0 };
long plancher_Idx[2] = { i, 1 };
long exposition_Idx[2] = { i, 2 };
array.MultiDimSetAt(nav_Idx, pricer[i][0]);
array.MultiDimSetAt(plancher_Idx, pricer[i][1]);
array.MultiDimSetAt(exposition_Idx, pricer[i][2]);
}
VariantInit(res);
res->vt = (VT_ARRAY | VT_R8);
array.CopyTo(&res->parray);
} |
Partager