source: Sophya/trunk/Poubelle/DPC:FitsIOServer/Tests/scanppf.cc@ 658

Last change on this file since 658 was 658, checked in by ansari, 26 years ago

no message

File size: 1.2 KB
Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <typeinfo>
4#include <iostream.h>
5#include <string>
6
7#include "ppersist.h"
8#include "anydataobj.h"
9#include "sambainit.h"
10
11int main(int narg, char* arg[])
12{
13SambaInitiator smbinit;
14
15if (narg < 2) {
16 cerr << " Usage: scanppf filename [s]\n " << endl;
17 exit(0);
18 }
19
20try {
21 string flnm = arg[1];
22 bool seq=false;
23 if (narg > 2) seq=true;
24 PPersist* op = NULL;
25 cout << " Opening PPF file " << flnm << endl;
26 PInPersist s(flnm);
27 int nt = s.NbTags();
28 cout << " Number of tags in file = " << nt << endl;
29 if (nt < 1) {
30 op = s.ReadObject();
31 cout << " Object Type " << typeid(*op).name() << endl;
32 if (op) delete op;
33 }
34 else if (!seq) {
35 for(int i=0; i<nt; i++) {
36 cout << ">>> TagNum= " << i << " TagName= " << s.GetTagName(i) << endl;
37 s.GotoTagNum(i);
38 op = s.ReadObject();
39 cout << " Object Type " << typeid(*op).name() << endl;
40 if (op) delete op;
41 }
42 } else {
43 while (1) {
44 op = s.ReadObject();
45 cout << " Object Type " << typeid(*op).name() << endl;
46 if (op) delete op;
47 }
48 }
49}
50catch (PThrowable pex) {
51 cerr << " scanppf/Error - Exception catched " << pex.Msg() << endl;
52}
53
54cout << " ----------- End of scanppf ------------- " << endl;
55}
Note: See TracBrowser for help on using the repository browser.