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