| [860] | 1 | // Guy Le Meur 03/2000 | 
|---|
|  | 2 |  | 
|---|
|  | 3 |  | 
|---|
|  | 4 | #ifndef FITSXNTuple_SEEN | 
|---|
|  | 5 | #define FITSXNTuple_SEEN | 
|---|
| [1136] | 6 | #include "machdefs.h" | 
|---|
| [860] | 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 |  | 
|---|
| [1136] | 18 | class  FITS_XNTuple : public FitsIOHandler | 
|---|
| [860] | 19 | { | 
|---|
|  | 20 |  | 
|---|
|  | 21 | public: | 
|---|
|  | 22 | FITS_XNTuple(); | 
|---|
| [1174] | 23 | FITS_XNTuple(char inputfile[],int hdunum=0); | 
|---|
| [860] | 24 | FITS_XNTuple(const XNTuple & obj); | 
|---|
| [1047] | 25 | FITS_XNTuple(XNTuple* obj); | 
|---|
| [860] | 26 | ~FITS_XNTuple(); | 
|---|
| [1047] | 27 |  | 
|---|
| [1136] | 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 |  | 
|---|
| [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); | 
|---|
| [860] | 45 | inline operator XNTuple() { return(*dobj_); } | 
|---|
| [1049] | 46 | inline XNTuple * getObj() { return(dobj_); } | 
|---|
| [860] | 47 |  | 
|---|
|  | 48 | protected: | 
|---|
|  | 49 |  | 
|---|
|  | 50 | // implementation de FitsFile | 
|---|
| [1136] | 51 | virtual void  ReadFromFits(FitsInFile& is); | 
|---|
|  | 52 | virtual void    WriteToFits(FitsOutFile& os) ; | 
|---|
| [860] | 53 |  | 
|---|
| [1047] | 54 | private : | 
|---|
|  | 55 |  | 
|---|
|  | 56 |  | 
|---|
|  | 57 | inline void InitNull() | 
|---|
|  | 58 | { | 
|---|
|  | 59 | fistLineToBeRead_= -1; | 
|---|
|  | 60 | numberOfLinesToBeRead_= -1; | 
|---|
|  | 61 | } | 
|---|
|  | 62 |  | 
|---|
| [860] | 63 | // attributs de classe | 
|---|
|  | 64 | XNTuple* dobj_; | 
|---|
| [1047] | 65 | bool    ownobj_; | 
|---|
|  | 66 | int fistLineToBeRead_; | 
|---|
|  | 67 | int numberOfLinesToBeRead_; | 
|---|
| [860] | 68 | }; | 
|---|
|  | 69 | ////////////////////////////////////////////////////////////////// | 
|---|
|  | 70 |  | 
|---|
| [1231] | 71 | inline FitsOutFile& operator << (FitsOutFile& fios, XNTuple & nt) | 
|---|
|  | 72 | { FITS_XNTuple fih(&nt); fih.Write(fios); return (fios); } | 
|---|
| [860] | 73 |  | 
|---|
| [1231] | 74 | inline FitsInFile& operator >> (FitsInFile& fiis, XNTuple & nt) | 
|---|
|  | 75 | { FITS_XNTuple fih(&nt); fih.Read(fiis); return (fiis); } | 
|---|
|  | 76 |  | 
|---|
| [860] | 77 | } // Fin du namespace | 
|---|
|  | 78 |  | 
|---|
|  | 79 | #endif | 
|---|