| 1 | // Guy Le Meur 03/2000
 | 
|---|
| 2 | 
 | 
|---|
| 3 | 
 | 
|---|
| 4 | #ifndef FITSXNTuple_SEEN
 | 
|---|
| 5 | #define FITSXNTuple_SEEN
 | 
|---|
| 6 | #include "machdefs.h"
 | 
|---|
| 7 | #include "xntuple.h"
 | 
|---|
| 8 | #include "anydataobj.h"
 | 
|---|
| 9 | #include "ppersist.h"
 | 
|---|
| 10 | #include "fitsfile.h"
 | 
|---|
| 11 | 
 | 
|---|
| 12 | namespace SOPHYA {
 | 
|---|
| 13 | ///////////////////////////////////////////////////////////
 | 
|---|
| 14 | //   Les objets delegues pour la gestion de persistance sur fichiers fits 
 | 
|---|
| 15 | //   pour XNTuple
 | 
|---|
| 16 | ///////////////////////////////////////////////////////////
 | 
|---|
| 17 | 
 | 
|---|
| 18 | class  FITS_XNTuple : public FitsIOHandler  
 | 
|---|
| 19 | {
 | 
|---|
| 20 | 
 | 
|---|
| 21 | public:
 | 
|---|
| 22 | FITS_XNTuple();
 | 
|---|
| 23 | FITS_XNTuple(char inputfile[],int hdunum=0);
 | 
|---|
| 24 | FITS_XNTuple(const XNTuple & obj);
 | 
|---|
| 25 | FITS_XNTuple(XNTuple* obj);
 | 
|---|
| 26 | ~FITS_XNTuple();
 | 
|---|
| 27 | 
 | 
|---|
| 28 | virtual   AnyDataObj* DataObj() { return(dobj_); }
 | 
|---|
| 29 | virtual   void        SetDataObj(AnyDataObj & o) 
 | 
|---|
| 30 |   {   
 | 
|---|
| 31 |     XNTuple* po = dynamic_cast<  XNTuple* >(& o); 
 | 
|---|
| 32 |     if (po == NULL) return;
 | 
|---|
| 33 |     if (ownobj_ && dobj_) delete dobj_;  
 | 
|---|
| 34 |     dobj_ = po; 
 | 
|---|
| 35 |     ownobj_ = false; 
 | 
|---|
| 36 |   }    
 | 
|---|
| 37 | 
 | 
|---|
| 38 | 
 | 
|---|
| 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 | */
 | 
|---|
| 44 | void ReadLines(char inputfile[],int firstLine, int numberOfLines,int hdunum=0);
 | 
|---|
| 45 | inline operator XNTuple() { return(*dobj_); }
 | 
|---|
| 46 | inline XNTuple * getObj() { return(dobj_); }
 | 
|---|
| 47 | 
 | 
|---|
| 48 | protected:
 | 
|---|
| 49 | 
 | 
|---|
| 50 |   // implementation de FitsFile
 | 
|---|
| 51 |  virtual void  ReadFromFits(FitsInFile& is);
 | 
|---|
| 52 | virtual void    WriteToFits(FitsOutFile& os) ;
 | 
|---|
| 53 | 
 | 
|---|
| 54 |  private :
 | 
|---|
| 55 | 
 | 
|---|
| 56 | 
 | 
|---|
| 57 | inline void InitNull()
 | 
|---|
| 58 |    {
 | 
|---|
| 59 |      fistLineToBeRead_= -1;
 | 
|---|
| 60 |      numberOfLinesToBeRead_= -1;
 | 
|---|
| 61 |    }
 | 
|---|
| 62 | 
 | 
|---|
| 63 |   // attributs de classe
 | 
|---|
| 64 |   XNTuple* dobj_;
 | 
|---|
| 65 |   bool    ownobj_;
 | 
|---|
| 66 |   int fistLineToBeRead_;
 | 
|---|
| 67 |   int numberOfLinesToBeRead_;
 | 
|---|
| 68 | };
 | 
|---|
| 69 | //////////////////////////////////////////////////////////////////
 | 
|---|
| 70 | 
 | 
|---|
| 71 | inline FitsOutFile& operator << (FitsOutFile& fios, XNTuple & nt)
 | 
|---|
| 72 |   { FITS_XNTuple fih(&nt); fih.Write(fios); return (fios); }
 | 
|---|
| 73 | 
 | 
|---|
| 74 | inline FitsInFile& operator >> (FitsInFile& fiis, XNTuple & nt)
 | 
|---|
| 75 |   { FITS_XNTuple fih(&nt); fih.Read(fiis); return (fiis); }
 | 
|---|
| 76 | 
 | 
|---|
| 77 | } // Fin du namespace
 | 
|---|
| 78 | 
 | 
|---|
| 79 | #endif
 | 
|---|