source: Sophya/trunk/SophyaExt/FitsIOServer/fitsxntuple.h@ 2989

Last change on this file since 2989 was 1231, checked in by ansari, 25 years ago

Modifs cosmetiques + introduction des operateurs << et >> sur

FitsOut/InFile - Reza 12/10/2000

File size: 2.0 KB
Line 
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
12namespace SOPHYA {
13///////////////////////////////////////////////////////////
14// Les objets delegues pour la gestion de persistance sur fichiers fits
15// pour XNTuple
16///////////////////////////////////////////////////////////
17
18class FITS_XNTuple : public FitsIOHandler
19{
20
21public:
22FITS_XNTuple();
23FITS_XNTuple(char inputfile[],int hdunum=0);
24FITS_XNTuple(const XNTuple & obj);
25FITS_XNTuple(XNTuple* obj);
26~FITS_XNTuple();
27
28virtual AnyDataObj* DataObj() { return(dobj_); }
29virtual 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/*!
40fill 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*/
44void ReadLines(char inputfile[],int firstLine, int numberOfLines,int hdunum=0);
45inline operator XNTuple() { return(*dobj_); }
46inline XNTuple * getObj() { return(dobj_); }
47
48protected:
49
50 // implementation de FitsFile
51 virtual void ReadFromFits(FitsInFile& is);
52virtual void WriteToFits(FitsOutFile& os) ;
53
54 private :
55
56
57inline 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
71inline FitsOutFile& operator << (FitsOutFile& fios, XNTuple & nt)
72 { FITS_XNTuple fih(&nt); fih.Write(fios); return (fios); }
73
74inline FitsInFile& operator >> (FitsInFile& fiis, XNTuple & nt)
75 { FITS_XNTuple fih(&nt); fih.Read(fiis); return (fiis); }
76
77} // Fin du namespace
78
79#endif
Note: See TracBrowser for help on using the repository browser.