1 | // toiiter.h
|
---|
2 | // Eric Aubourg CEA/DAPNIA/SPP juillet 1999
|
---|
3 |
|
---|
4 | #ifndef TOIITER_H
|
---|
5 | #define TOIITER_H
|
---|
6 |
|
---|
7 |
|
---|
8 | #include <vector>
|
---|
9 | #include <set>
|
---|
10 | #include <map>
|
---|
11 | #include <string>
|
---|
12 | #include "archeopsfile.h"
|
---|
13 | #include "auxgps.h"
|
---|
14 | #include "tsid.h"
|
---|
15 |
|
---|
16 | enum TOIKind {
|
---|
17 | sampleNum, // Numero d''echantillon (timer interne transputer)
|
---|
18 | internalTime, // temps transputer depuis debut manip, en secondes.
|
---|
19 | mjd, // UTC (en jours, MJD = JD - 2450000). index=0 : premier bloc GPS. 1: + sioux.
|
---|
20 | boloTens, // tension en microVolts, filtree avec filtre carre indexe par bolometre
|
---|
21 | boloRaw, // tension brute, non filtree indexe par bolometre
|
---|
22 | boloTemp, // Kelvins
|
---|
23 | sstDiode, // signal brut SST, indice = diode, 0-45
|
---|
24 | sstChannel, // signal brut SST, indice = canal, 0-47
|
---|
25 | sstStarCnt, // nombre d'etoiles detectees durant ce sample
|
---|
26 | sstStarZ, // numero de diode d''une eventuelle etoile, i=etoile 0..n
|
---|
27 | sstStarF, // flux d''une eventuelle etoile, <0 si moins de i+1 etoiles
|
---|
28 | sstStarT, // temps d''une eventuelle etoile, <0 si moins de i+1 etoiles
|
---|
29 | gyroRaw, // valeur brute du gyro, index = 0,1,2
|
---|
30 | gpsTime, // temps fourni par GPS
|
---|
31 | longitude, // position ballon
|
---|
32 | latitude, // position ballon
|
---|
33 | altitude, // position ballon
|
---|
34 | tsid, // temps sideral en secondes
|
---|
35 | azimut, // a preciser, reconstruit SST, magneto, autres...
|
---|
36 | alphaAxis, //
|
---|
37 | deltaAxis, //
|
---|
38 | alphaSst, //
|
---|
39 | deltaSst, //
|
---|
40 | alphaBolo, // sur le ciel, indexe par bolometre
|
---|
41 | deltaBolo // sur le ciel, indexe par bolometre
|
---|
42 | };
|
---|
43 |
|
---|
44 | class TOIInterpolator;
|
---|
45 |
|
---|
46 | class TOIIter {
|
---|
47 | public:
|
---|
48 | TOIIter(TOIIter const&); // $CHECK$ prevoir operator = ?
|
---|
49 | ~TOIIter();
|
---|
50 | bool Next();
|
---|
51 |
|
---|
52 | bool canGetValue(int column); // data is available for that...
|
---|
53 | double getValue(int column);
|
---|
54 | bool newValue(int column); // a juste change ?
|
---|
55 | bool extendValue(int column); // une valeur plus ancienne, etendue ?
|
---|
56 | bool interpValue(int column); // une valeur interpolee avec valeur future ?
|
---|
57 | bool isTrig(int column);
|
---|
58 | TOIKind getKind(int column);
|
---|
59 | int getIndex(int column); // si plusieurs, exemple, tension bolo 2
|
---|
60 |
|
---|
61 | bool canGetTOI(TOIKind kind, int index=0);
|
---|
62 | double getTOI(TOIKind kind, int index=0);
|
---|
63 |
|
---|
64 |
|
---|
65 | int getBlockSampleIndex(); // numero d''echantillon dans dernier bloc bolo
|
---|
66 | int getSampleIndex(); // numero d''echantillon
|
---|
67 | double getMJD();
|
---|
68 |
|
---|
69 | block_type_param* lastParam();
|
---|
70 | block_type_journal* lastJournal();
|
---|
71 | block_type_reglage* lastReglage();
|
---|
72 | block_type_dilution* lastDilution();
|
---|
73 | block_type_gps* lastGPS();
|
---|
74 | block_type_une_periode* lastUnePeriode();
|
---|
75 | block_type_synchro_sol* lastSynchroSol();
|
---|
76 | block_type_pointage_sol* lastPointageSol();
|
---|
77 | block_type_bolo* lastBolo();
|
---|
78 | block_type_gyro* lastGyro();
|
---|
79 | block_type_sst* lastSST();
|
---|
80 | block_type_bolo_comprime* lastBoloComp();
|
---|
81 | block_type_gyro_comprime* lastGyroComp();
|
---|
82 | block_type_sst_comprime* lastSSTComp();
|
---|
83 |
|
---|
84 | ArcheopsFile* currentFile() {if (!initDone) Init(); return file;}
|
---|
85 |
|
---|
86 | protected:
|
---|
87 | TOIIter();
|
---|
88 | void Init(); // After setting the options, opens the first file.
|
---|
89 | void ScanFiles(); // Parcourt tous les fichiers, cherche le premier echantillon...
|
---|
90 |
|
---|
91 | bool NextSample(); // no test of trange
|
---|
92 | bool NextFile();
|
---|
93 |
|
---|
94 | ArcheopsFile* file;
|
---|
95 | string directory; // If directory scanning
|
---|
96 | set<string> files; // list of files to be read...
|
---|
97 | map<string, long> file1stSamp; // premier echantillon de chaque fichier
|
---|
98 | set<string>::iterator curFile;
|
---|
99 | bool isOnBoardRecorder;
|
---|
100 |
|
---|
101 | int imes;
|
---|
102 |
|
---|
103 | double tStart, tEnd;
|
---|
104 |
|
---|
105 | //double tBlock0; // MJD du bloc numero zero...
|
---|
106 | //double perEch; // periode d''echantillonage en secondes
|
---|
107 |
|
---|
108 | struct info {
|
---|
109 | TOIKind kind;
|
---|
110 | int index;
|
---|
111 | bool triggering;
|
---|
112 | bool interpolated;
|
---|
113 | };
|
---|
114 |
|
---|
115 | int getColTOI(TOIKind kind, int index=0);
|
---|
116 |
|
---|
117 | long trigMask;
|
---|
118 |
|
---|
119 | vector<info> infos;
|
---|
120 |
|
---|
121 | friend class TOISvr;
|
---|
122 |
|
---|
123 | // Gestion de l''interpolation, par delegation a un autre iterateur
|
---|
124 | TOIIter* rawIter; // iterateur sans interpolation, qui avance avec retard
|
---|
125 | // en bufferisant les valeurs. S'il existe, on lui delegue
|
---|
126 | // toutes les operations agissant sur le fichier.
|
---|
127 | TOIInterpolator* interp; // interpolateurs pour stocker les valeurs
|
---|
128 | long lastSample; // last interpolated sample
|
---|
129 | long maxLookAhead;
|
---|
130 | bool fetchAhead(); // avance d''une TOI en nourrissant les interpolateurs
|
---|
131 |
|
---|
132 | AuxGPS* auxGPS;
|
---|
133 | TSid tSid;
|
---|
134 |
|
---|
135 | private:
|
---|
136 | bool initDone;
|
---|
137 | };
|
---|
138 |
|
---|
139 | #endif
|
---|