Changeset 807 in Sophya for trunk/SophyaProg/Tests/scanppf.cc


Ignore:
Timestamp:
Apr 3, 2000, 7:44:06 PM (25 years ago)
Author:
ansari
Message:

Amelioration tests - Adaptation modifs TArray<T>,PPersist - Reza 03/04/2000

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaProg/Tests/scanppf.cc

    r742 r807  
    2222SambaInitiator smbinit;
    2323
    24 if (narg < 2) {
    25   cerr << " Usage: scanppf filename [s]\n " <<  endl;
     24if ((narg < 2) || (strcmp(arg[1],"-h") == 0) ) {
     25  cerr << " Usage: scanppf filename [s/n/a0/a1/a2/a3] \n"
     26       << "   s[=default} : Sequential reading of objects \n"
     27       << "   n : Object reading at NameTags \n"
     28       << "   a0...a3 : Tag List with PInPersist.AnalyseTags(0...3) \n" << endl;
    2629  exit(0);
    2730  }
     
    2932try {
    3033  string flnm = arg[1];
    31   bool seq=false;
    32   if (narg > 2) seq=true;
     34  bool seq=true;
     35  bool ana=false;
     36  int analev = 0;
     37  string opt = "s";
     38  if (narg > 2) opt = arg[2];
     39 
     40  if (opt == "n")  seq = false;
     41  else if (opt[0] == 'a') {  ana = true;  analev = opt[1]-'0'; }
     42
     43  if (ana)   cout << " Analyse PInPersist( " << flnm << ")  Level=" << analev << endl;
     44  else {
     45    if (!seq) cout << "PInPersist( " << flnm << ") Object Reading at NameTags " << endl;
     46    else  cout << "PInPersist( " << flnm << ") Sequential Object Reading " << endl;
     47  }
     48   
    3349  PPersist* op = NULL;
    3450  cout << " Opening PPF file " << flnm << endl;
    3551  PInPersist s(flnm);
    36   int nt = s.NbTags();
    37   cout << " Number of tags in file = " << nt << endl;
    38   if (nt < 1) {
    39     op = s.ReadObject();
    40     cout << " Object Type " << typeid(*op).name() << endl;
    41     if (op) delete op;
    42   }
    43   else if (!seq) {
     52
     53  if (ana) s.AnalyseTags(analev);   // Analysing all tags in file
     54
     55  else {
     56    cout << " Version= " << s.Version() << " CreationDate= " << s.CreationDateStr() << endl;
     57    int nt = s.NbTags();
     58    cout << " Number of tags in file = " << nt << endl;
     59    if ( seq || (nt < 1) ) {
     60      while (1) {
     61        op = s.ReadObject();
     62        cout << " Object Type " << typeid(*op).name() << endl;
     63        if (op) delete op;
     64      }
     65    }
    4466    for(int i=0; i<nt; i++) {
    4567      cout << ">>> TagNum= " << i << " TagName= " << s.GetTagName(i) << endl;
    4668      s.GotoTagNum(i);
    47       op = s.ReadObject();
    48       cout << " Object Type " << typeid(*op).name() << endl;
    49       if (op) delete op;
    50     }
    51   } else {
    52     while (1) {
    5369      op = s.ReadObject();
    5470      cout << " Object Type " << typeid(*op).name() << endl;
Note: See TracChangeset for help on using the changeset viewer.