Changeset 534 in Sophya for trunk/Poubelle/archTOI.old/toiiter.h


Ignore:
Timestamp:
Nov 1, 1999, 10:59:29 AM (26 years ago)
Author:
ansari
Message:

V2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Poubelle/archTOI.old/toiiter.h

    r436 r534  
    11// toiiter.h
    2 // Eric Aubourg         CEA/DAPNIA/SPP   juillet 1999
     2// Eric Aubourg         CEA/DAPNIA/SPP   septembre 1999
    33
    44#ifndef TOIITER_H
    55#define TOIITER_H
    66
    7 
    87#include <vector>
     8#include <list>
    99#include <set>
    1010#include <map>
    1111#include <string>
    12 #include "archeopsfile.h"
    13 #include "auxgps.h"
    14 #include "tsid.h"
    1512
    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).
    20   mutc,          // UTC en heure, avec soustraction d'origine
    21   boloMuV,       // tension en microVolts, filtree avec filtre carre indexe par bolometre
    22   boloMuV2,      // tension en microVolts, avec soustraction offset filtre
    23   boloRawMuV,    // tension brute en microVolts, non filtree indexe par bolometre, sans chgt signe
    24   boloTemp,      // Kelvins, need R(T) -> N/A
    25   boloDACV,      // tension de reference du DAC (microVolts)
    26   boloDACI,      // courant (microAmps)
    27   boloRawMuVCN,  // compression noise on bolo (microVolts), no filter
    28   boloMuV2T,     // total, microVolts, avec consigne DAC
    29   boloRes,       // Resistance, ohms
    30   boloGainAmpli, //
    31   dilDAC,        // dilution DAC, index = 0-47
    32   dilSwitch,     // dilution, mot de 32 bits
    33   serviceTemp,   // service temperature, K
    34   sstDiode,      // signal brut SST, indice = diode, 0-45
    35   sstChannel,    // signal brut SST, indice = canal, 0-47
    36   sstDiodeCN,    // compression noise
    37   sstChannelCN,  // compression noise
    38   sstStarCnt,    // nombre d''etoiles detectees durant ce sample
    39   sstStarZ,      // numero de diode d''une eventuelle etoile,   i=etoile 0..n
    40   sstStarF,      // flux d''une eventuelle etoile,             <0 si moins de i+1 etoiles
    41   sstStarT,      // temps d''une eventuelle etoile,            <0 si moins de i+1 etoiles
    42   gyroRaw,       // valeur brute du gyro, index = 0,1,2
    43   gyroV,         // tension gyro, V, index = 0,1,2
    44   gyroSpeed,     // vitesse gyro, deg/s, index = 0,1,2, calibree...
    45   gpsTime,       // temps fourni par GPS
    46   longitude,     // position ballon, degrees  +=EST
    47   latitude,      // position ballon, degrees  +=NORD
    48   altitude,      // position ballon, m
    49   tsid,          // temps sideral en secondes
    50   azimuthBolo,   // azimut
    51   alphaRotAxis,  //
    52   deltaRotAxis,  //
    53   alphaZenith,   //
    54   deltaZenith,   //
    55   alphaSst,      //
    56   deltaSst,      //
    57   alphaFPAxis,   //
    58   deltaFPAxis,   //
    59   alphaBolo,     // sur le ciel, indexe par bolometre
    60   deltaBolo,     // sur le ciel, indexe par bolometre
    61   voyantEVO,
    62   voyantEVF,
    63   commandeEV0,
    64   commandeEVF,
    65   commandeEVB,
    66   commandeEVV,
    67   pressEnt3He,
    68   debit3He,
    69   pressSor3He,
    70   pressEnt4He,
    71   debit4He,
    72   pressSor4He,
    73   pressAirVanne,
    74   pressPompChar,
    75   pressMembrane,
    76   pressExterne,
    77   tensPile10T,
    78   tensPileP18D,
    79   tensPileM18D,
    80   tensPile10B,
    81   tensPileP18B,
    82   tensPileM18B,
    83   tensPileCh,
    84   swPile5,
    85   swPile15,
    86   tempCaissH1,
    87   tempCaissH2,
    88   tempCaissB1,
    89   tempCaissB2,
    90   tempCaissTHe,
    91   tempCaissPiles,
    92   tempCaissDrv,
    93   pressHeBain,
    94   pressPirani
    95 };
     13#include "toiabsorber.h"
     14#include "requesthandler.h"
     15#include "archfileset.h"
    9616
    97 class TOIInterpolator;
     17class AuxGPS;
    9818
    99 class TOIIter {
     19template <class T1, class T2, class T3>
     20struct triple {
     21    T1 first;
     22    T2 second;
     23    T3 third;
     24        triple() : first(T1()), second(T2()), third(T3()) {}
     25    triple (const T1& a, const T2& b, const T3& c) :
     26           first (a), second (b), third (c) {}
     27};
     28
     29class TOIIter : public TOIAbsorber /*, public RequestHandler*/ {
    10030public:
    101    TOIIter(TOIIter const&);   // $CHECK$ prevoir operator = ?
    102    ~TOIIter();
    103    bool Next();
     31  TOIIter();
     32  // ~TOIIter();
     33 
     34  void readReq(istream& s);
     35  void defaultInclude();
     36
     37  bool processRequest(string line);
     38  void registerReqHandler(RequestHandler*);
     39
     40  virtual bool processTOIReq(TOI& toi, string);
     41  virtual bool processOption(string keyw, string args);
     42
     43  void addDirectory(string);
     44  void addFile(string);
     45  //void useAuxGPS(AuxGPS* gps);
    10446   
    105    bool    canGetValue(int column);  // data is available for that...
    106    double  getValue(int column);
    107    bool    newValue(int column);     // a juste change ?
    108    bool    extendValue(int column);  // une valeur plus ancienne, etendue ?
    109    bool    interpValue(int column);  // une valeur interpolee avec valeur future ?
    110    bool    isTrig(int column); 
    111    TOIKind getKind(int column);
    112    int     getIndex(int column);     // si plusieurs, exemple, tension bolo 2
     47  void setMJDInterval(double tStart, double tEnd);
     48  void setUTCInterval(double tStart, double tEnd);
     49  void setSNInterval(long sStart, long sEnd);
     50  void setUnderSample(int n);
     51  int  getUnderSample();
     52
     53  void addTOI(TOI& toi, bool triggering=true);
     54
     55  void init();
     56 
     57  bool next();
    11358   
    114    bool    canGetTOI(TOIKind kind, int index=0);
    115    double  getTOI(TOIKind kind, int index=0);
     59  long    getSampleNum();
     60  bool    canGetValue(int column);  // data is available for that...
     61  double  getValue(int column);
     62  bool    canGetValue(TOI const& toi);  // data is available for that...
     63  double  getValue(TOI const& toi);
     64  bool    newValue(int column);     // a juste change ?
     65  bool    extendValue(int column);  // une valeur plus ancienne, etendue ?
     66  bool    interpValue(int column);  // une valeur interpolee avec valeur future ?
     67  bool    isTrig(int column); 
     68  TOI     getKind(int column);
     69 
     70  ArchFileSet& getFSet() {return fset;}
     71     
     72protected:   
     73  ArchFileSet fset;
     74  list<RequestHandler*> handlers;
     75  enum {triggering = 1};
     76  typedef ::triple<TOI,TOIProducer*,long> TOIInfo;
     77  vector<TOIInfo> request;
    11678   
     79  double mjdStart, mjdEnd;  // MJD
     80  double utcStart, utcEnd;  // UTC, will be converted towards tStart tEnd at init
     81  long   sStart, sEnd;      // samplenum
     82       
     83  int underSample;
     84  long curSample;
    11785   
    118    int    getBlockSampleIndex();        // numero d''echantillon dans dernier bloc bolo
    119    int    getSampleIndex();             // numero d''echantillon
    120    int    getUnderSampling();           
    121    double getMJD();           
     86  int getColTOI(TOI const& toi);
     87  bool next1();
    12288
    123    block_type_param*         lastParam(); 
    124    block_type_journal*       lastJournal();
    125    block_type_reglage*       lastReglage();
    126    block_type_dilution*      lastDilution();
    127    block_type_gps*           lastGPS();
    128    block_type_une_periode*   lastUnePeriode();
    129    block_type_synchro_sol*   lastSynchroSol();
    130    block_type_pointage_sol*  lastPointageSol();
    131    block_type_bolo*          lastBolo();   
    132    block_type_gyro*          lastGyro();
    133    block_type_sst*           lastSST();
    134    block_type_bolo_comprime* lastBoloComp();   
    135    block_type_gyro_comprime* lastGyroComp();
    136    block_type_sst_comprime*  lastSSTComp();
    137    
    138    ArcheopsFile* currentFile() {if (!initDone) Init(); return file;}
    139 
    140 protected:
    141    TOIIter();
    142    void Init(); // After setting the options, opens the first file.
    143    void ScanFiles(); // Parcourt tous les fichiers, cherche le premier echantillon...
    144    
    145    bool Next1();
    146    bool NextSample(); // no test of trange
    147    bool NextFile();
    148    
    149    ArcheopsFile* file;
    150    string directory;   // If directory scanning
    151    set<string> files;  // list of files to be read...
    152    map<string, long> file1stSamp; // premier echantillon de chaque fichier
    153    set<string>::iterator curFile;
    154    bool  isOnBoardRecorder;
    155    
    156    int imes;
    157    
    158    double tStart, tEnd;      // MJD
    159    double utcStart, utcEnd;  // UTC, will be converted towards tStart tEnd at init
    160    long   sStart, sEnd;      // samplenum
    161    
    162    //double tBlock0;  // MJD du bloc numero zero...
    163    //double perEch;   // periode d''echantillonage en secondes
    164    
    165    struct info {
    166      TOIKind kind;
    167      int index;
    168      bool triggering;
    169      bool interpolated;
    170    };
    171    
    172    int getColTOI(TOIKind kind, int index=0);
    173    
    174    long trigMask;
    175    
    176    vector<info>   infos;
    177    
    178    friend class TOISvr;
    179    
    180    // Gestion de l''interpolation, par delegation a un autre iterateur
    181    TOIIter* rawIter; // iterateur sans interpolation, qui avance avec retard
    182                      // en bufferisant les valeurs. S''il existe, on lui delegue
    183                      // toutes les operations agissant sur le fichier.
    184    TOIInterpolator* interp; // interpolateurs pour stocker les valeurs
    185    long lastSample;  // last interpolated sample
    186    long maxLookAhead;
    187    bool fetchAhead(); // avance d''une TOI en nourrissant les interpolateurs
    188    
    189    AuxGPS* auxGPS;
    190    TSid tSid;
    191    
    192    int underSample;
    193    
    194    private:
    195    bool initDone;
     89private:
     90  bool initDone;
     91  bool incDone;
    19692};
    19793
Note: See TracChangeset for help on using the changeset viewer.