| 1 | #include <stdio.h> | 
|---|
| 2 | #include <stdlib.h> | 
|---|
| 3 | #include <math.h> | 
|---|
| 4 | #include <iostream> | 
|---|
| 5 | #include <fstream> | 
|---|
| 6 |  | 
|---|
| 7 | #include "sopnamsp.h" | 
|---|
| 8 | #include "histinit.h" | 
|---|
| 9 | #include "dvlist.h" | 
|---|
| 10 | #include "ntuple.h" | 
|---|
| 11 | #include "datatable.h" | 
|---|
| 12 | #include "swppfdtable.h" | 
|---|
| 13 |  | 
|---|
| 14 | /*  Programme test des classes  DVList, NTuple,, XNTuple          */ | 
|---|
| 15 | /*  DataTable et les handlers PPF                                 */ | 
|---|
| 16 | /*  SOPHYA - R. Ansari (LAL)  -   2000 -  2005                    */ | 
|---|
| 17 |  | 
|---|
| 18 | void test_dvl(); | 
|---|
| 19 | void test_ntuple(); | 
|---|
| 20 | void test_DataTable() ; | 
|---|
| 21 | void test_SwPPFDataTable() ; | 
|---|
| 22 |  | 
|---|
| 23 | int main(int narg, char *arg[]) | 
|---|
| 24 | { | 
|---|
| 25 | SophyaInit(); | 
|---|
| 26 | if (narg < 2) { | 
|---|
| 27 | cout << " tnt/Erreur arg - Usage: tnt d/n/DT/SWDT \n" | 
|---|
| 28 | << " d:DVList n:NTuple DT,SWDT: SwPPF/DataTable test \n" << endl; | 
|---|
| 29 | exit(0); | 
|---|
| 30 | } | 
|---|
| 31 | int rc = 0; | 
|---|
| 32 | try { | 
|---|
| 33 | if (*arg[1] == 'd')  test_dvl(); | 
|---|
| 34 | else if (*arg[1] == 'n')  test_ntuple(); | 
|---|
| 35 | else if (strcmp(arg[1],"DT") == 0)  test_DataTable(); | 
|---|
| 36 | else if (strcmp(arg[1],"SWDT") == 0)  test_SwPPFDataTable(); | 
|---|
| 37 | } | 
|---|
| 38 | catch(PThrowable exc ) { | 
|---|
| 39 | cerr << "tnt-main() , Catched exception: \n" << exc.Msg() << endl; | 
|---|
| 40 | rc = 97; | 
|---|
| 41 | } | 
|---|
| 42 | catch(std::exception ex) { | 
|---|
| 43 | cerr << "tnt-main() , Catched exception ! " << (string)(ex.what()) << endl; | 
|---|
| 44 | rc = 98; | 
|---|
| 45 | } | 
|---|
| 46 | catch(...) { | 
|---|
| 47 | cerr << "tnt-main() , Catched ... ! " << endl; | 
|---|
| 48 | rc = 99; | 
|---|
| 49 | } | 
|---|
| 50 | return rc; | 
|---|
| 51 | } | 
|---|
| 52 |  | 
|---|
| 53 | /*  ***** Test de NTuple simple ***** */ | 
|---|
| 54 | void test_ntuple() | 
|---|
| 55 | { | 
|---|
| 56 | const char * names[3] = {"XPos", "YPos", "Val"}; | 
|---|
| 57 | int i,j, k; | 
|---|
| 58 | float xnt[3]; | 
|---|
| 59 |  | 
|---|
| 60 | cout << "======= test_ntuple:  Testing NTuple ======= " << endl; | 
|---|
| 61 |  | 
|---|
| 62 | cout << "Creation Ntuple avec X,Y,Val ... " << endl; | 
|---|
| 63 | NTuple  nt1(3, names, 20); | 
|---|
| 64 |  | 
|---|
| 65 | k = 0; | 
|---|
| 66 | for(j=0; j<8; j++) | 
|---|
| 67 | for(i=0; i<12; i++) | 
|---|
| 68 | { xnt[0] = i+0.5;  xnt[1] = j+0.5;  xnt[2] = k; | 
|---|
| 69 | nt1.Fill(xnt); k++; } | 
|---|
| 70 |  | 
|---|
| 71 | nt1.Info().Comment() = "NTuple de Test - Cree par tnt.cc"; | 
|---|
| 72 | nt1.Info()["Version"] = SophyaVersion(); | 
|---|
| 73 | nt1.Show(cout); | 
|---|
| 74 | nt1.Print(0, 5); | 
|---|
| 75 | nt1.Print(18, 5); | 
|---|
| 76 | nt1.Print(94, 5); | 
|---|
| 77 |  | 
|---|
| 78 | string fn = "nt.ppf"; | 
|---|
| 79 | { | 
|---|
| 80 | cout << "Ecriture NTuple ds nt.ppf ... \n" << endl; | 
|---|
| 81 | ObjFileIO<NTuple> fio(&nt1); | 
|---|
| 82 | fio.Write(fn); | 
|---|
| 83 | } | 
|---|
| 84 |  | 
|---|
| 85 | { | 
|---|
| 86 | cout << "Lecture NTuple (nt2) ds nt.ppf ... \n" << endl; | 
|---|
| 87 | PInPersist fsi(fn); | 
|---|
| 88 | NTuple nt2; | 
|---|
| 89 | fsi >> nt2; | 
|---|
| 90 | nt2.Show(cout); | 
|---|
| 91 | nt2.Print(0, 5); | 
|---|
| 92 | nt2.Print(18, 5); | 
|---|
| 93 | nt2.Print(94, 5); | 
|---|
| 94 | } | 
|---|
| 95 |  | 
|---|
| 96 |  | 
|---|
| 97 | } | 
|---|
| 98 |  | 
|---|
| 99 | /*  ***** Test de dvlist ***** */ | 
|---|
| 100 | void test_dvl() | 
|---|
| 101 | { | 
|---|
| 102 | DVList dvl; | 
|---|
| 103 |  | 
|---|
| 104 | cout << "\n ======= test_dvl:  Testing MuTyV ======= " << endl; | 
|---|
| 105 | MuTyV zvs = " ( 1.41 -2.71) "; | 
|---|
| 106 | MuTyV dvs = "434.898"; | 
|---|
| 107 | MuTyV fvu = 314.1596; | 
|---|
| 108 | MuTyV ivu = 7654321; | 
|---|
| 109 | cout << " float->string: fvu= " << fvu << " (string)fvu=" << (string)fvu << endl; | 
|---|
| 110 | cout << " int->string: ivu= " << ivu << " (string)ivu=" << (string)ivu << endl; | 
|---|
| 111 | complex<double> zzd = zvs; | 
|---|
| 112 | cout << "String->complex<double>: zvs = " << zvs | 
|---|
| 113 | << " (complex<double>)zvs= " << zzd << endl; | 
|---|
| 114 | cout << "String->double: dvs = " << dvs | 
|---|
| 115 | << " (double)dvs= " << (double)dvs << endl; | 
|---|
| 116 | TimeStamp ts; | 
|---|
| 117 | MuTyV tv = ts; | 
|---|
| 118 | cout << "MuTyV=TimeStamp->String: tv = " << tv | 
|---|
| 119 | << " ->double= " << (double)tv << " ->TimeStamp:" | 
|---|
| 120 | << TimeStamp((double)tv).ToString() << endl; | 
|---|
| 121 | tv = "1995-09-23T15:20:32"; | 
|---|
| 122 | string tts = (string)tv; | 
|---|
| 123 | cout << "MuTyV=TimeStamp tv=" << tv << " ->TimeStamp(tv)=" | 
|---|
| 124 | << TimeStamp(tts) << endl; | 
|---|
| 125 |  | 
|---|
| 126 | cout << "\n\n ======= test_dvl:  Testing DVList ======= " << endl; | 
|---|
| 127 | dvl.SetI("Var XXX", 12345); | 
|---|
| 128 | dvl.SetI("IV1-80", 80); | 
|---|
| 129 | dvl.SetI("IV2-330", 330); | 
|---|
| 130 |  | 
|---|
| 131 | dvl.SetD("DV1-0.2", 0.2); | 
|---|
| 132 | dvl.SetD("DV2-4.5", 4.5); | 
|---|
| 133 | dvl.SetZ("ZV", complex<r_8>(2.0,-1.44)); | 
|---|
| 134 |  | 
|---|
| 135 | dvl.SetI("IVV3-783", 783); | 
|---|
| 136 | dvl("IVV3-783-O") =  7783; | 
|---|
| 137 | // dvl["Avec[]"] =  "operateur [] !"; | 
|---|
| 138 | dvl.SetD("DVV3", 3.141592652141592652); | 
|---|
| 139 | dvl.SetComment("DVV3", "Comment for DVV3, r_8 type variable"); | 
|---|
| 140 | dvl("DVV3avec()") =  44.555e-8; | 
|---|
| 141 |  | 
|---|
| 142 | dvl.SetS("Blanc_White", "123.456Ma premiere chaine"); | 
|---|
| 143 | dvl.SetI("IntegerValue", 55777); | 
|---|
| 144 | dvl.SetComment("IntegerValue", "This variable has a comment"); | 
|---|
| 145 | dvl.Comment() = "This is a test DVL produced by the program tdvl.cc \n Using SOPHYA , Feb 2000"; | 
|---|
| 146 |  | 
|---|
| 147 | dvl["Sinf"] = "inf 0985"; | 
|---|
| 148 | dvl["ToDay"] = ts; | 
|---|
| 149 | dvl.Print(); | 
|---|
| 150 |  | 
|---|
| 151 |  | 
|---|
| 152 | double d = dvl("DV2-4.5"); | 
|---|
| 153 | float f = dvl("DVV3"); | 
|---|
| 154 | int i = dvl("IVV3-783"); | 
|---|
| 155 | complex<r_8> z = dvl("ZV"); | 
|---|
| 156 |  | 
|---|
| 157 | printf("\n \n Essai1 (IVV3 DVV3 DV2= ) %d  %.20g  %g \n", i, f, (float)d); | 
|---|
| 158 | printf("\n \n Essai ZV= (%.2g  %g I) \n", z.real(), z.imag()); | 
|---|
| 159 | cout << "Test Comment/IntegerValue: " << dvl.GetComment("IntegerValue") << endl; | 
|---|
| 160 | cout << "Test Comment/DVV3: " << dvl.GetComment("DVV3") << endl; | 
|---|
| 161 |  | 
|---|
| 162 | cout << "Test string recup  " << (string)(dvl["Blanc_White"]) << endl; | 
|---|
| 163 | cout << "Test string recup(int=80)  " << (string)(dvl["IV1-80"]) << endl; | 
|---|
| 164 | dvl("DVV3") = (double)3.141592652141592652; | 
|---|
| 165 | cout << "Test string recup(double=Pi..i)  " << (string)(dvl["DVV3"]) << endl; | 
|---|
| 166 |  | 
|---|
| 167 | { | 
|---|
| 168 | cout << " Writing DVList in file PPF dvl.ppf " << endl; | 
|---|
| 169 | POutPersist os("dvl.ppf"); | 
|---|
| 170 | os << dvl ; | 
|---|
| 171 | } | 
|---|
| 172 |  | 
|---|
| 173 | cout << "-------------------------- \n\n" | 
|---|
| 174 | << " reading DVList from file dvl.ppf ... \n" << endl; | 
|---|
| 175 |  | 
|---|
| 176 | DVList dvlr("dvl.ppf"); | 
|---|
| 177 | double df1 = (double)( dvlr["DVV3"] ); | 
|---|
| 178 | double df2 = (double)3.141592652141592652 - df1; | 
|---|
| 179 | cout << " Test Precision : Pi-Pi= " << df2  << "DVV3= " << df1 << endl; | 
|---|
| 180 |  | 
|---|
| 181 | cout << dvlr; | 
|---|
| 182 |  | 
|---|
| 183 | } | 
|---|
| 184 | void test_DataTable() | 
|---|
| 185 | { | 
|---|
| 186 | cout << "======= test_DataTable:  simple DataTable test ======= " << endl; | 
|---|
| 187 | DataTable dt(64); | 
|---|
| 188 | dt.AddIntegerColumn("line"); | 
|---|
| 189 | dt.AddStringColumn("sline"); | 
|---|
| 190 | dt.AddDoubleColumn("x"); | 
|---|
| 191 | dt.AddFloatColumn("f_sin"); | 
|---|
| 192 | dt.AddFloatColumn("f_cos"); | 
|---|
| 193 | dt.AddDoubleColumn("f_sinxcos"); | 
|---|
| 194 | dt.AddDoubleColumn("f_x2"); | 
|---|
| 195 | dt.AddComplexColumn("cmplx_cos_sin"); | 
|---|
| 196 | dt.AddDoubleComplexColumn("dcmplx_cos_sin"); | 
|---|
| 197 | dt.AddDateTimeColumn("datime"); | 
|---|
| 198 | MuTyV rec[10]; | 
|---|
| 199 | TimeStamp ts("01/3/2005","0:0:0"); | 
|---|
| 200 | TimeStamp ts2(0.); | 
|---|
| 201 |  | 
|---|
| 202 | cout << " 1/ First 1000 lines .... " << endl; | 
|---|
| 203 | for(int k = 0; k<1000; k++) { | 
|---|
| 204 | rec[0] = k; | 
|---|
| 205 | string sline = "L-"; | 
|---|
| 206 | sline += (string)rec[0]; | 
|---|
| 207 | rec[1] = sline; | 
|---|
| 208 | double x = M_PI*k/100.; | 
|---|
| 209 | double fx = sin(x)*cos(x); | 
|---|
| 210 | double sx = sin(x); | 
|---|
| 211 | double cx = cos(x); | 
|---|
| 212 | rec[2] = x; | 
|---|
| 213 | rec[3] = sx; | 
|---|
| 214 | rec[4] = cx; | 
|---|
| 215 | rec[5] = fx; | 
|---|
| 216 | rec[6] = x*x; | 
|---|
| 217 | rec[7] = complex<r_4>(cx, sx); | 
|---|
| 218 | rec[8] = complex<r_8>(cx, sx); | 
|---|
| 219 | ts2.Set(ts.ToDays()+(double)k/24.); | 
|---|
| 220 | rec[9] = ts2; | 
|---|
| 221 | dt.AddLine(rec); | 
|---|
| 222 | } | 
|---|
| 223 | cout << "1.b/ Use of = operator to make copy of dt " << endl; | 
|---|
| 224 | DataTable dtc1; | 
|---|
| 225 | dtc1 = dt; | 
|---|
| 226 |  | 
|---|
| 227 | dt.Show(); | 
|---|
| 228 | cout << " 2/ Lines 1000-2000  .... " << endl; | 
|---|
| 229 | for(int k = 1000; k<2000; k++) { | 
|---|
| 230 | rec[0] = k; | 
|---|
| 231 | string sline = "L-"; | 
|---|
| 232 | sline += (string)rec[0]; | 
|---|
| 233 | rec[1] = sline; | 
|---|
| 234 | double x = M_PI*k/100.; | 
|---|
| 235 | double fx = sin(x)*cos(x); | 
|---|
| 236 | double sx = sin(x); | 
|---|
| 237 | double cx = cos(x); | 
|---|
| 238 | rec[2] = x; | 
|---|
| 239 | rec[3] = sx; | 
|---|
| 240 | rec[4] = cx; | 
|---|
| 241 | rec[5] = fx; | 
|---|
| 242 | rec[6] = x*x; | 
|---|
| 243 | rec[7] = complex<r_4>(cx, sx); | 
|---|
| 244 | rec[8] = complex<r_8>(cx, sx); | 
|---|
| 245 | ts2.Set(ts.ToDays()+(double)k/24.); | 
|---|
| 246 | rec[9] = ts2; | 
|---|
| 247 | dt.AddLine(rec); | 
|---|
| 248 | } | 
|---|
| 249 | cout << "2.b/ dt.Show();  : " << endl; | 
|---|
| 250 | dt.Show(); | 
|---|
| 251 | cout << "2.c/ dtc1.Show();  : " << endl; | 
|---|
| 252 | dtc1.Show(); | 
|---|
| 253 | cout << "2.d/  dt.LineHeaderToString() dt.LineToString(k)   : " << endl; | 
|---|
| 254 | cout << dt.LineHeaderToString() << endl; | 
|---|
| 255 | for(int k = 0; k<1500; k+=75) | 
|---|
| 256 | cout << "Line[" << k << "] " << dt.LineToString(k) << endl ; | 
|---|
| 257 | { | 
|---|
| 258 | cout << "3/ Writing DataTable dt to PPF stream dtable.ppf " << endl; | 
|---|
| 259 | POutPersist po("dtable.ppf"); | 
|---|
| 260 | po << dt; | 
|---|
| 261 | } | 
|---|
| 262 | { | 
|---|
| 263 | cout << "4/ Reading DataTable dtr from PPF stream dtable.ppf " << endl; | 
|---|
| 264 | PInPersist pi("dtable.ppf"); | 
|---|
| 265 | DataTable dtr; | 
|---|
| 266 | pi >> dtr; | 
|---|
| 267 | cout << "4.b/ cout << dtr; " << endl; | 
|---|
| 268 | cout << dtr; | 
|---|
| 269 | cout << "4.c/  dtr.LineHeaderToString() dtr.LineToString(k)   : " << endl; | 
|---|
| 270 | cout << dtr.LineHeaderToString() << endl; | 
|---|
| 271 | for(int k = 0; k<1500; k+=75) | 
|---|
| 272 | cout << "Line[" << k << "] " << dtr.LineToString(k) << endl ; | 
|---|
| 273 |  | 
|---|
| 274 | } | 
|---|
| 275 | { | 
|---|
| 276 | cout << "5/ Reading DataTable dtr from text file dtable.txt " << endl; | 
|---|
| 277 | { | 
|---|
| 278 | cout << "5.a Writing lines to file dtable.txt " << endl; | 
|---|
| 279 | ofstream os("dtable.txt"); | 
|---|
| 280 | dt.Print(os,0,450); | 
|---|
| 281 | } | 
|---|
| 282 | cout << "5.b CopyStructure + FillFromASCIIFile from dtable.txt " << endl; | 
|---|
| 283 | ifstream is("dtable.txt"); | 
|---|
| 284 | DataTable dtr; | 
|---|
| 285 | dtr.CopyStructure(dt); | 
|---|
| 286 | dtr.FillFromASCIIFile(is); | 
|---|
| 287 | cout << dtr; | 
|---|
| 288 | cout << "5.c/  dtr.LineHeaderToString() dtr.LineToString(k)   : " << endl; | 
|---|
| 289 | cout << dtr.LineHeaderToString() << endl; | 
|---|
| 290 | for(int k = 0; k<10; k++) | 
|---|
| 291 | cout << "Line[" << k << "] " << dtr.LineToString(k) << endl ; | 
|---|
| 292 | for(int k = 50; k<300; k+=25) | 
|---|
| 293 | cout << "Line[" << k << "] " << dtr.LineToString(k) << endl ; | 
|---|
| 294 |  | 
|---|
| 295 | } | 
|---|
| 296 | cout << "6./Test with DataTableRow object " << endl; | 
|---|
| 297 | DataTable dtrow(64); | 
|---|
| 298 | dtrow.AddDoubleColumn("x"); | 
|---|
| 299 | dtrow.AddFloatColumn("f_cos"); | 
|---|
| 300 | dtrow.AddStringColumn("sline"); | 
|---|
| 301 | dtrow.AddIntegerColumn("line"); | 
|---|
| 302 | dtrow.AddDateTimeColumn("datime"); | 
|---|
| 303 |  | 
|---|
| 304 | DataTableRow row = dtrow.EmptyRow(); | 
|---|
| 305 | for(int k = 0; k<25; k++) { | 
|---|
| 306 | MuTyV mtk = k; | 
|---|
| 307 | string sline = "L-"; | 
|---|
| 308 | sline += (string)mtk; | 
|---|
| 309 | row["sline"] = sline; | 
|---|
| 310 | row["line"] = k; | 
|---|
| 311 | double x = M_PI*k/25.; | 
|---|
| 312 | double cx = cos(x); | 
|---|
| 313 | row[0] = x; | 
|---|
| 314 | row[1] = cx; | 
|---|
| 315 | ts2.Set(ts.ToDays()+(double)k); | 
|---|
| 316 | row["datime"] = ts2; | 
|---|
| 317 | dtrow.AddRow(row); | 
|---|
| 318 | } | 
|---|
| 319 | cout << dtrow << endl; | 
|---|
| 320 | cout << dtrow.LineHeaderToString() << endl; | 
|---|
| 321 | for(int k = 0; k<25; k+=3) { | 
|---|
| 322 | dtrow.GetRow(k, row); | 
|---|
| 323 | cout << "k=" << k << " GetRow():   " << row << endl; | 
|---|
| 324 | cout << " ...LineToString(): " << dtrow.LineToString(k) << endl; | 
|---|
| 325 | } | 
|---|
| 326 | cout << endl; | 
|---|
| 327 | cout << "============ FIN  test_DataTable ============== " << endl; | 
|---|
| 328 | } | 
|---|
| 329 |  | 
|---|
| 330 | void test_SwPPFDataTable() | 
|---|
| 331 | { | 
|---|
| 332 | cout << "======= test_SwPPFDataTable():  simple SwPPFDataTable test ======= " << endl; | 
|---|
| 333 | { | 
|---|
| 334 | POutPersist po("swdtable.ppf"); | 
|---|
| 335 | SwPPFDataTable dt(po, 64); | 
|---|
| 336 | dt.AddIntegerColumn("line"); | 
|---|
| 337 | dt.AddStringColumn("sline"); | 
|---|
| 338 | dt.AddDoubleColumn("x"); | 
|---|
| 339 | dt.AddFloatColumn("f_sin"); | 
|---|
| 340 | dt.AddFloatColumn("f_cos"); | 
|---|
| 341 | dt.AddDoubleColumn("f_sinxcos"); | 
|---|
| 342 | dt.AddDoubleColumn("f_x2"); | 
|---|
| 343 | dt.AddComplexColumn("cmplx_cos_sin"); | 
|---|
| 344 | dt.AddDoubleComplexColumn("dcmplx_cos_sin"); | 
|---|
| 345 | dt.AddDateTimeColumn("datime"); | 
|---|
| 346 | MuTyV rec[10]; | 
|---|
| 347 | TimeStamp ts("01/3/2005","0:0:0"); | 
|---|
| 348 | TimeStamp ts2(0.); | 
|---|
| 349 | cout << " 1/ First 1000 lines .... " << endl; | 
|---|
| 350 | for(int k = 0; k<1000; k++) { | 
|---|
| 351 | rec[0] = k; | 
|---|
| 352 | string sline = "L-"; | 
|---|
| 353 | sline += (string)rec[0]; | 
|---|
| 354 | rec[1] = sline; | 
|---|
| 355 | double x = M_PI*k/100.; | 
|---|
| 356 | double fx = sin(x)*cos(x); | 
|---|
| 357 | double sx = sin(x); | 
|---|
| 358 | double cx = cos(x); | 
|---|
| 359 | rec[2] = x; | 
|---|
| 360 | rec[3] = sx; | 
|---|
| 361 | rec[4] = cx; | 
|---|
| 362 | rec[5] = fx; | 
|---|
| 363 | rec[6] = x*x; | 
|---|
| 364 | rec[7] = complex<r_4>(cx, sx); | 
|---|
| 365 | rec[8] = complex<r_8>(cx, sx); | 
|---|
| 366 | ts2.Set(ts.ToDays()+(double)k/24.); | 
|---|
| 367 | rec[9] = ts2; | 
|---|
| 368 | dt.AddLine(rec); | 
|---|
| 369 | } | 
|---|
| 370 | cout << "1.b/ Use of = operator to make copy of dt " << endl; | 
|---|
| 371 | SwPPFDataTable dtc1; | 
|---|
| 372 | dtc1 = dt; | 
|---|
| 373 | dt.Show(); | 
|---|
| 374 | cout << " 2/ Lines 1000-2000  .... " << endl; | 
|---|
| 375 | for(int k = 1000; k<2000; k++) { | 
|---|
| 376 | rec[0] = k; | 
|---|
| 377 | string sline = "L-"; | 
|---|
| 378 | sline += (string)rec[0]; | 
|---|
| 379 | rec[1] = sline; | 
|---|
| 380 | double x = M_PI*k/100.; | 
|---|
| 381 | double fx = sin(x)*cos(x); | 
|---|
| 382 | double sx = sin(x); | 
|---|
| 383 | double cx = cos(x); | 
|---|
| 384 | rec[2] = x; | 
|---|
| 385 | rec[3] = sx; | 
|---|
| 386 | rec[4] = cx; | 
|---|
| 387 | rec[5] = fx; | 
|---|
| 388 | rec[6] = x*x; | 
|---|
| 389 | rec[7] = complex<r_4>(cx, sx); | 
|---|
| 390 | rec[8] = complex<r_8>(cx, sx); | 
|---|
| 391 | ts2.Set(ts.ToDays()+(double)k/24.); | 
|---|
| 392 | rec[9] = ts2; | 
|---|
| 393 | dt.AddLine(rec); | 
|---|
| 394 | } | 
|---|
| 395 | cout << "2.b/ dt.Show();  : " << endl; | 
|---|
| 396 | dt.Show(); | 
|---|
| 397 | cout << "2.c/ dtc1.Show();  : " << endl; | 
|---|
| 398 | dtc1.Show(); | 
|---|
| 399 | cout << "3/ Writing SwPPFDataTable dt to PPF stream swdtable.ppf " << endl; | 
|---|
| 400 | po << dt; | 
|---|
| 401 | } | 
|---|
| 402 | { | 
|---|
| 403 | cout << "4/ Reading SwPPFDataTable dtr from PPF stream swdtable.ppf " << endl; | 
|---|
| 404 | PInPersist pi("swdtable.ppf"); | 
|---|
| 405 | SwPPFDataTable dtr; | 
|---|
| 406 | pi >> dtr; | 
|---|
| 407 | cout << "4.b/ cout << dtr; " << endl; | 
|---|
| 408 | cout << dtr; | 
|---|
| 409 | cout << "4.c/  dtr.LineHeaderToString() dtr.LineToString(k)   : " << endl; | 
|---|
| 410 | cout << dtr.LineHeaderToString() << endl; | 
|---|
| 411 | for(int k = 0; k<1500; k+=75) | 
|---|
| 412 | cout << "Line[" << k << "] " << dtr.LineToString(k) << endl ; | 
|---|
| 413 | } | 
|---|
| 414 |  | 
|---|
| 415 | cout << "============ FIN  test_SwPPFDataTable() ======== ======= " << endl; | 
|---|
| 416 | } | 
|---|
| 417 |  | 
|---|
| 418 |  | 
|---|
| 419 |  | 
|---|
| 420 |  | 
|---|