source: Sophya/trunk/SophyaExt/FitsIOServer/fitsntuple.h@ 3477

Last change on this file since 3477 was 3047, checked in by ansari, 19 years ago

Ajout FitsInOutFile::SkipEmptyFirstHDU() , positionnement sur HDU 2 si HDU 1 vide ds operateur >> lisant des tables + autres petites corrections , Reza 11/08/2006

File size: 2.3 KB
RevLine 
[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
12namespace SOPHYA {
13///////////////////////////////////////////////////////////////////
14// Classe pour la gestion de persistance sur fichiers fits
15// pout NTuple
16////////////////////////////////////////////////////////////////
[1136]17class FITS_NTuple : public FitsIOHandler
[860]18{
19
20public:
21
22FITS_NTuple();
[1174]23FITS_NTuple(char inputfile[],int hdunum=0);
[860]24FITS_NTuple(const NTuple & obj);
[1047]25 FITS_NTuple(NTuple* obj);
[860]26virtual ~FITS_NTuple();
[1136]27
28virtual AnyDataObj* DataObj() { return(dobj_); }
29virtual 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 }
[2897]37virtual int CheckHandling(AnyDataObj & o)
38 {
39 if (typeid(o) == typeid(NTuple)) return 2;
40 NTuple * po = dynamic_cast< NTuple * >(& o);
41 if (po == NULL) return 0;
42 else return 1;
43 }
[1136]44
[2897]45virtual int CheckReadability(FitsInOutFile& is);
[1136]46
[2897]47virtual FitsHandlerInterface* Clone()
48 { return new FITS_NTuple() ; }
49
[1047]50/*!
51fill the XNTuple only with lines from firstLine-th to (firstLine+numberOfLines-1)-th of the FITS-file inputfile.
52\param <firstLine> first line to be read (the first line of the file is numbered 0)
53\param <numberOfLines> number of lines to be read
54*/
[1174]55 void ReadLines(char inputfile[],int firstLine, int numberOfLines,int hdunum=0);
[1136]56
[860]57inline operator NTuple() { return(*dobj_); }
[1049]58inline NTuple * getObj() { return(dobj_); }
[860]59
60protected:
61
62 // implementation de FitsFile
[1136]63virtual void ReadFromFits(FitsInFile& is);
64virtual void WriteToFits(FitsOutFile& os) ;
[860]65
[1047]66 private :
67
[1136]68inline void InitNull() { fistLineToBeRead_= -1; numberOfLinesToBeRead_= -1;}
[1047]69
70
[860]71 // attributs de classe
72 NTuple* dobj_;
[1047]73 bool ownobj_;
74 int fistLineToBeRead_;
75 int numberOfLinesToBeRead_;
[860]76};
77//////////////////////////////////////////////////////////////////
78
[3035]79inline FitsInOutFile& operator << (FitsInOutFile& fios, NTuple & nt)
[1231]80 { FITS_NTuple fih(&nt); fih.Write(fios); return (fios); }
[860]81
[3035]82inline FitsInOutFile& operator >> (FitsInOutFile& fiis, NTuple & nt)
[3047]83 { FITS_NTuple fih(&nt); fiis.SkipEmptyFirstHDU();
84 fih.Read(fiis); fiis.MoveToNextHDU(); return (fiis); }
[1231]85
86
[860]87} // Fin du namespace
88
89#endif
Note: See TracBrowser for help on using the repository browser.