| [860] | 1 | // Guy Le Meur 03/2000
 | 
|---|
 | 2 | 
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 | #ifndef FITSNTuple_SEEN
 | 
|---|
 | 5 | #define FITSNTuple_SEEN
 | 
|---|
| [1136] | 6 | #include "machdefs.h"
 | 
|---|
| [860] | 7 | #include "ntuple.h"
 | 
|---|
 | 8 | #include "anydataobj.h"
 | 
|---|
 | 9 | #include "ppersist.h"
 | 
|---|
 | 10 | #include "fitsfile.h"
 | 
|---|
 | 11 | 
 | 
|---|
 | 12 | namespace SOPHYA {
 | 
|---|
 | 13 | ///////////////////////////////////////////////////////////////////
 | 
|---|
 | 14 | // Classe pour la gestion de persistance sur fichiers fits
 | 
|---|
 | 15 | // pout NTuple 
 | 
|---|
 | 16 | ////////////////////////////////////////////////////////////////
 | 
|---|
| [1136] | 17 | class  FITS_NTuple : public FitsIOHandler  
 | 
|---|
| [860] | 18 | {
 | 
|---|
 | 19 | 
 | 
|---|
 | 20 | public:
 | 
|---|
 | 21 | 
 | 
|---|
 | 22 | FITS_NTuple();
 | 
|---|
| [1174] | 23 | FITS_NTuple(char inputfile[],int hdunum=0);
 | 
|---|
| [860] | 24 | FITS_NTuple(const NTuple & obj);
 | 
|---|
| [1047] | 25 |  FITS_NTuple(NTuple* obj); 
 | 
|---|
| [860] | 26 | virtual ~FITS_NTuple();
 | 
|---|
| [1136] | 27 | 
 | 
|---|
 | 28 | virtual   AnyDataObj* DataObj() { return(dobj_); }
 | 
|---|
 | 29 | virtual   void        SetDataObj(AnyDataObj & o) 
 | 
|---|
 | 30 |   {   
 | 
|---|
 | 31 |     NTuple* po = dynamic_cast<  NTuple* >(& o); 
 | 
|---|
 | 32 |     if (po == NULL) return;
 | 
|---|
 | 33 |     if (ownobj_ && dobj_) delete dobj_;  
 | 
|---|
 | 34 |     dobj_ = po; 
 | 
|---|
 | 35 |     ownobj_ = false; 
 | 
|---|
 | 36 |   }    
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | 
 | 
|---|
| [1047] | 39 | /*!
 | 
|---|
 | 40 | fill the XNTuple only with lines from firstLine-th to (firstLine+numberOfLines-1)-th of the FITS-file inputfile.
 | 
|---|
 | 41 | \param <firstLine>  first line  to be read (the first line of the file is numbered 0)
 | 
|---|
 | 42 | \param <numberOfLines>  number of lines to be read
 | 
|---|
 | 43 | */
 | 
|---|
| [1174] | 44 |  void ReadLines(char inputfile[],int firstLine, int numberOfLines,int hdunum=0);
 | 
|---|
| [1136] | 45 | 
 | 
|---|
| [860] | 46 | inline operator NTuple() { return(*dobj_); }
 | 
|---|
| [1049] | 47 | inline NTuple * getObj() { return(dobj_); }
 | 
|---|
| [860] | 48 | 
 | 
|---|
 | 49 | protected:
 | 
|---|
 | 50 | 
 | 
|---|
 | 51 |   // implementation de FitsFile
 | 
|---|
| [1136] | 52 | virtual void ReadFromFits(FitsInFile& is);
 | 
|---|
 | 53 | virtual void WriteToFits(FitsOutFile& os) ;
 | 
|---|
| [860] | 54 | 
 | 
|---|
| [1047] | 55 |  private : 
 | 
|---|
 | 56 | 
 | 
|---|
| [1136] | 57 | inline void InitNull() { fistLineToBeRead_= -1; numberOfLinesToBeRead_= -1;}
 | 
|---|
| [1047] | 58 | 
 | 
|---|
 | 59 | 
 | 
|---|
| [860] | 60 |   // attributs de classe
 | 
|---|
 | 61 |   NTuple* dobj_;
 | 
|---|
| [1047] | 62 |   bool ownobj_;
 | 
|---|
 | 63 |   int fistLineToBeRead_;
 | 
|---|
 | 64 |   int numberOfLinesToBeRead_;
 | 
|---|
| [860] | 65 | };
 | 
|---|
 | 66 | //////////////////////////////////////////////////////////////////
 | 
|---|
 | 67 | 
 | 
|---|
| [1231] | 68 | inline FitsOutFile& operator << (FitsOutFile& fios, NTuple & nt)
 | 
|---|
 | 69 |   { FITS_NTuple fih(&nt); fih.Write(fios); return (fios); }
 | 
|---|
| [860] | 70 | 
 | 
|---|
| [1231] | 71 | inline FitsInFile& operator >> (FitsInFile& fiis, NTuple & nt)
 | 
|---|
 | 72 |   { FITS_NTuple fih(&nt); fih.Read(fiis); return (fiis); }
 | 
|---|
 | 73 | 
 | 
|---|
 | 74 | 
 | 
|---|
| [860] | 75 | } // Fin du namespace
 | 
|---|
 | 76 | 
 | 
|---|
 | 77 | #endif
 | 
|---|