| 1 | // toiiter.h
 | 
|---|
| 2 | // Eric Aubourg         CEA/DAPNIA/SPP   septembre 1999
 | 
|---|
| 3 | 
 | 
|---|
| 4 | #ifndef TOIITER_H
 | 
|---|
| 5 | #define TOIITER_H
 | 
|---|
| 6 | 
 | 
|---|
| 7 | #include <vector>
 | 
|---|
| 8 | #include <list>
 | 
|---|
| 9 | #include <set>
 | 
|---|
| 10 | #include <map>
 | 
|---|
| 11 | #include <string>
 | 
|---|
| 12 | 
 | 
|---|
| 13 | #include "toiabsorber.h"
 | 
|---|
| 14 | #include "requesthandler.h"
 | 
|---|
| 15 | #include "archfileset.h"
 | 
|---|
| 16 | 
 | 
|---|
| 17 | class AuxGPS;
 | 
|---|
| 18 | 
 | 
|---|
| 19 | template <class T1, class T2, class T3>
 | 
|---|
| 20 | struct 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 | 
 | 
|---|
| 29 | class TOIIter : public TOIAbsorber /*, public RequestHandler*/ {
 | 
|---|
| 30 | public:
 | 
|---|
| 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);
 | 
|---|
| 46 |    
 | 
|---|
| 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();
 | 
|---|
| 58 |    
 | 
|---|
| 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 |       
 | 
|---|
| 72 | protected:   
 | 
|---|
| 73 |   ArchFileSet fset;
 | 
|---|
| 74 |   list<RequestHandler*> handlers;
 | 
|---|
| 75 |   enum {triggering = 1};
 | 
|---|
| 76 |   typedef ::triple<TOI,TOIProducer*,long> TOIInfo;
 | 
|---|
| 77 |   vector<TOIInfo> request; 
 | 
|---|
| 78 |    
 | 
|---|
| 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;
 | 
|---|
| 85 |    
 | 
|---|
| 86 |   int getColTOI(TOI const& toi);
 | 
|---|
| 87 |   bool next1();
 | 
|---|
| 88 | 
 | 
|---|
| 89 | private:
 | 
|---|
| 90 |   bool initDone;
 | 
|---|
| 91 |   bool incDone;
 | 
|---|
| 92 | };
 | 
|---|
| 93 | 
 | 
|---|
| 94 | #endif
 | 
|---|