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