#include "sopnamsp.h" #include "machdefs.h" #include #include #include #include "math.h" #include #include #include #include "timing.h" #include "histinit.h" #include "pexceptions.h" #include "ppfwrapstlv.h" /* Programme test du PPFWrapper pour les vecteurs de la STL */ /* SOPHYA - R. Ansari (LAL) - Avril 2005 */ int main(int narg, char* arg[]) { if ((narg > 1) && (strcmp(arg[1],"-h") == 0) ) { cout << " tstppfwrapstl : Test classes PPFWrapper \n" << " Usage: tstppfwrapstl [VectorSize=10] [prtlev=0,1] " << endl; return 0; } cout << " ---- Programme tstppfwrapstl.cc ---- \n" << " ::: Test classes PPFWrapper de std::vector ::: " << endl; int prtlev = 0; int SZV = 10; if (narg > 1) SZV = atoi(arg[1]); if (narg > 2) prtlev = atoi(arg[2]); cout << " ----- Test PPFWrapperSTLVector Size= " << SZV << " PrtLev= " << prtlev << endl; int rc = 0; try { SophyaInit(); InitTim(); vector vw(SZV); for(int k=0; k vf , vector vi , vector vs " << endl; vector vf(SZV); vector vs(SZV); vector vi(SZV); for(int k=0; k 0) { cout << " vector vf Size= " << vf.size() << " values: \n" ; int k; for(k=0; k vi Size= " << vi.size() << " values: \n" ; for(k=0; k vs Size= " << vs.size() << " values: \n" ; for(k=0; k") << vf; so << PPFNameTag("STLVec") << vs; so << PPFNameTag("STLVec") << vi; } vector vsr; vector vir; vector vfr; { cout << "3/ Relecture vfr vir vsr depuis fichier wrapstl.ppf " << endl; PInPersist si("wrapstl.ppf"); si >> PPFNameTag("STLVec") >> vsr >> vir; si >> PPFNameTag("STLVec") >> vfr; if (prtlev > 0) { cout << " vector vfr Size= " << vfr.size() << " values: \n" ; int k; for(k=0; k vir Size= " << vir.size() << " values: \n" ; for(k=0; k vsr Size= " << vsr.size() << " values: \n" ; for(k=0; kvf vir<>vr vsr<>vr " << endl; int k; if (vfr.size() != vf.size()) { cout << " ... Difference de taille vf et vfr " << endl; rc += 1; } else { int ndiff = 0; for(k=0; k vfr NDiff = " << ndiff << endl; rc += 2; } } if (vir.size() != vi.size()) { cout << " ... Difference de taille vi et vir " << endl; rc += 4; } else { int ndiff = 0; for(k=0; k vir NDiff = " << ndiff << endl; rc += 8; } } if (vsr.size() != vs.size()) { cout << " ... Difference de taille vi et vir " << endl; rc += 16; } else { int ndiff = 0; for(k=0; k vsr NDiff = " << ndiff << endl; rc += 32; } } if (rc == 0) cout << " .... Comparaison OK " << endl; } catch (PThrowable & exc) { cerr << " tstppfwrapstl.cc: Catched Exception (PThrowable)" << (string)typeid(exc).name() << " - Msg= " << exc.Msg() << endl; rc = 99; } catch (std::exception & e) { cerr << " tstppfwrapstl.cc: Catched std::xception " << " - what()= " << e.what() << endl; rc = 98; } catch (...) { cerr << " tstppfwrapstl.cc: some other exception (...) was caught ! " << endl; rc = 97; } PrtTim("End tstppfwrapstl " ); cout << " ---- Programme tstppfwrapstl.cc - FIN (Rc=" << rc << ") --- " << endl; return rc; }