source: Sophya/trunk/SophyaProg/PrgUtil/scanppf.cc@ 2647

Last change on this file since 2647 was 2636, checked in by ansari, 21 years ago

Ajout HistInit ds scanppf.cc - Reza 19/11/2004

File size: 3.1 KB
Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <typeinfo>
4#include <iostream>
5#include <string>
6
7#include "sopnamsp.h"
8#include "ppersist.h"
9#include "anydataobj.h"
10#include "sambainit.h"
11#include "histinit.h"
12
13#ifdef __MWERKS__
14#include <console.h>
15#endif
16
17
18/*!
19 \defgroup PrgUtil PrgUtil module
20 This module contains simple programs to perform various utility tasks:
21 <UL>
22 <LI> scanppf : Check and scan PPF files (scanppf.cc)
23 <LI> scanfits : Check and scan FITS files (scanfits.cc)
24 <LI> runcxx : Compile and run simple C++ code using SOPHYA (runcxx.cc)
25 <LI> prjsmap : Molleweide and sinus projection of sky maps (prjsmap.cc)
26 <LI> map2cl : Computes power spectra (C(l)) on spherical maps (map2cl.cc)
27 <LI> cl2map : generates spherical maps from power spectra (C(l)) (cl2map.cc)
28 </UL>
29*/
30
31/*!
32 \ingroup PrgUtil
33 \file scanppf.cc
34 \brief \b scanppf: Check and scan PPF files
35
36 \verbatim
37
38 csh> scanppf -h
39 SOPHYA Version 1.1 Revision 0 (V_Fev2001) -- Mar 9 2001 15:45:31 cxx
40 Usage: scanppf filename [s/n/a0/a1/a2/a3]
41 s[=default} : Sequential reading of objects
42 n : Object reading at NameTags
43 a0...a3 : Tag List with PInPersist.AnalyseTags(0...3)
44
45 \endverbatim
46*/
47
48int main(int narg, char* arg[])
49{
50
51#ifdef __MWERKS__
52narg = ccommand(&arg);
53#endif
54
55SambaInitiator smbinit;
56HiStatsInitiator hisinit;
57
58if ((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);
64 }
65
66try {
67 string flnm = arg[1];
68 bool seq=true;
69 bool ana=false;
70 int analev = 0;
71 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'; }
76
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 }
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
89 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) {
95 op = s.ReadObject();
96 cout << " Object Type " << typeid(*op).name() << endl;
97 if (op) delete op;
98 }
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 }
107 }
108}
109catch (PThrowable & pex) {
110 cerr << " scanppf/Error - Exception catched " << (string)typeid(pex).name()
111 << " - Msg= " << pex.Msg() << endl;
112}
113
114cout << " ----------- End of scanppf ------------- " << endl;
115}
Note: See TracBrowser for help on using the repository browser.