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