Changeset 807 in Sophya for trunk/SophyaProg/Tests/scanppf.cc
- Timestamp:
- Apr 3, 2000, 7:44:06 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/Tests/scanppf.cc
r742 r807 22 22 SambaInitiator smbinit; 23 23 24 if (narg < 2) { 25 cerr << " Usage: scanppf filename [s]\n " << endl; 24 if ((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; 26 29 exit(0); 27 30 } … … 29 32 try { 30 33 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 33 49 PPersist* op = NULL; 34 50 cout << " Opening PPF file " << flnm << endl; 35 51 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 } 44 66 for(int i=0; i<nt; i++) { 45 67 cout << ">>> TagNum= " << i << " TagName= " << s.GetTagName(i) << endl; 46 68 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) {53 69 op = s.ReadObject(); 54 70 cout << " Object Type " << typeid(*op).name() << endl;
Note:
See TracChangeset
for help on using the changeset viewer.