Changeset 2658 in Sophya
- Timestamp:
- Apr 5, 2005, 5:38:56 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/PrgUtil/scanppf.cc
r2636 r2658 57 57 58 58 if ((narg < 2) || (strcmp(arg[1],"-h") == 0) ) { 59 cerr << " Usage: scanppf filename [s/n/a0/a1/a2/a3] \n" 60 << " s[=default} : Sequential reading of objects \n" 61 << " n : Object reading at NameTags \n" 62 << " a0...a3 : Tag List with PInPersist.AnalyseTags(0...3) \n" << endl; 63 exit(0); 59 cout << " Usage: scanppf [flags] filename \n" 60 << " flags = -s -n -a0 -a1 -a2 -a3 -lh -lho \n" 61 << " -s[=default} : Sequential reading of objects \n" 62 << " -n : Object reading at NameTags \n" 63 << " -a0...a3 : Tag List with PInPersist.AnalyseTags(0...3) \n" 64 << " -lh : List PPersist handler classes \n" 65 << " -lho : List PPersist handler and dataobj classes \n" << endl; 66 return(0); 64 67 } 65 68 66 69 try { 67 string flnm = arg[1];70 string flnm; 68 71 bool seq=true; 69 72 bool ana=false; 70 73 int analev = 0; 71 74 string opt = "s"; 72 if (narg > 2) opt = arg[2]; 73 74 if (opt == "n") seq = false; 75 else if (opt[0] == 'a') { ana = true; analev = opt[1]-'0'; } 75 if ((narg >= 2) && (*arg[1] == '-')) { 76 opt = arg[1]; 77 if (narg > 2) flnm = arg[2]; 78 } 79 else flnm = arg[1]; 76 80 77 if (ana) cout << " Analyse PInPersist( " << flnm << ") Level=" << analev << endl; 78 else { 79 if (!seq) cout << "PInPersist( " << flnm << ") Object Reading at NameTags " << endl; 80 else cout << "PInPersist( " << flnm << ") Sequential Object Reading " << endl; 81 if (opt == "-lh") { 82 cout << " --- scanppf : List of registered handler classes --- " << endl; 83 PIOPersist::ListPPHandlers(); 81 84 } 82 83 PPersist* op = NULL; 84 cout << " Opening PPF file " << flnm << endl; 85 PInPersist s(flnm); 86 87 if (ana) s.AnalyseTags(analev); // Analysing all tags in file 88 85 else if (opt == "-lho") { 86 cout << " --- scanppf : List of registered handler and DataObj classes --- " << endl; 87 PIOPersist::ListPPHandlers(); 88 PIOPersist::ListDataObjClasses(); 89 } 89 90 else { 90 cout << " Version= " << s.Version() << " CreationDate= " << s.CreationDateStr() << endl; 91 int nt = s.NbNameTags(); 92 cout << " Number of tags in file = " << nt << endl; 93 if ( seq || (nt < 1) ) { 94 while (1) { 91 if (opt == "-n") seq = false; 92 else if (opt[1] == 'a') { ana = true; analev = opt[1]-'0'; } 93 94 if (ana) cout << " Analyse PInPersist( " << flnm << ") Level=" << analev << endl; 95 else { 96 if (!seq) cout << "PInPersist( " << flnm << ") Object Reading at NameTags " << endl; 97 else cout << "PInPersist( " << flnm << ") Sequential Object Reading " << endl; 98 } 99 PPersist* op = NULL; 100 cout << " Opening PPF file " << flnm << endl; 101 PInPersist s(flnm); 102 103 if (ana) s.AnalyseTags(analev); // Analysing all tags in file 104 105 else { 106 cout << " Version= " << s.Version() << " CreationDate= " << s.CreationDateStr() << endl; 107 int nt = s.NbNameTags(); 108 cout << " Number of tags in file = " << nt << endl; 109 if ( seq || (nt < 1) ) { 110 while (1) { 111 op = s.ReadObject(); 112 cout << " Object Type " << typeid(*op).name() << endl; 113 if (op) delete op; 114 } 115 } 116 for(int i=0; i<nt; i++) { 117 cout << ">>> TagNum= " << i << " TagName= " << s.GetTagName(i) << endl; 118 s.GotoNameTagNum(i); 95 119 op = s.ReadObject(); 96 120 cout << " Object Type " << typeid(*op).name() << endl; 97 121 if (op) delete op; 98 122 } 99 }100 for(int i=0; i<nt; i++) {101 cout << ">>> TagNum= " << i << " TagName= " << s.GetTagName(i) << endl;102 s.GotoNameTagNum(i);103 op = s.ReadObject();104 cout << " Object Type " << typeid(*op).name() << endl;105 if (op) delete op;106 123 } 107 124 }
Note:
See TracChangeset
for help on using the changeset viewer.