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

Last change on this file since 4038 was 3572, checked in by cmv, 17 years ago

char* -> const char* pour regler les problemes de deprecated string const... + comparaison unsigned signed + suppression EVOL_PLANCK rz+cmv 07/02/2009

File size: 2.5 KB
Line 
1/*
2 --- SOPHYA software - FitsIOServer module ---
3 Guy Le Meur 03/2000 R. Ansari , 2006
4 (C) UPS+LAL IN2P3/CNRS (C) DAPNIA-SPP/CEA
5*/
6
7
8#ifndef FITSNTuple_SEEN
9#define FITSNTuple_SEEN
10#include "machdefs.h"
11#include "ntuple.h"
12#include "anydataobj.h"
13#include "ppersist.h"
14#include "fitsfile.h"
15
16namespace SOPHYA {
17///////////////////////////////////////////////////////////////////
18// Classe pour la gestion de persistance sur fichiers fits
19// pout NTuple
20////////////////////////////////////////////////////////////////
21class FITS_NTuple : public FitsIOHandler
22{
23
24public:
25
26FITS_NTuple();
27FITS_NTuple(char inputfile[],int hdunum=0);
28FITS_NTuple(const NTuple & obj);
29 FITS_NTuple(NTuple* obj);
30virtual ~FITS_NTuple();
31
32virtual AnyDataObj* DataObj() { return(dobj_); }
33virtual void SetDataObj(AnyDataObj & o)
34 {
35 NTuple* po = dynamic_cast< NTuple* >(& o);
36 if (po == NULL) return;
37 if (ownobj_ && dobj_) delete dobj_;
38 dobj_ = po;
39 ownobj_ = false;
40 }
41virtual int CheckHandling(AnyDataObj & o)
42 {
43 if (typeid(o) == typeid(NTuple)) return 2;
44 NTuple * po = dynamic_cast< NTuple * >(& o);
45 if (po == NULL) return 0;
46 else return 1;
47 }
48
49virtual int CheckReadability(FitsInOutFile& is);
50
51virtual FitsHandlerInterface* Clone()
52 { return new FITS_NTuple() ; }
53
54/*!
55fill the NTuple only with lines from firstLine-th to (firstLine+numberOfLines-1)-th of the FITS-file inputfile.
56\param <firstLine> first line to be read (the first line of the file is numbered 0)
57\param <numberOfLines> number of lines to be read
58*/
59 void ReadLines(char inputfile[],int firstLine, int numberOfLines,int hdunum=0);
60
61inline operator NTuple() { return(*dobj_); }
62inline NTuple * getObj() { return(dobj_); }
63
64protected:
65
66 // implementation de FitsFile
67virtual void ReadFromFits(FitsInFile& is);
68virtual void WriteToFits(FitsOutFile& os) ;
69
70 private :
71
72inline void InitNull() { fistLineToBeRead_= -1; numberOfLinesToBeRead_= -1;}
73
74
75 // attributs de classe
76 NTuple* dobj_;
77 bool ownobj_;
78 int fistLineToBeRead_;
79 int numberOfLinesToBeRead_;
80};
81//////////////////////////////////////////////////////////////////
82
83inline FitsInOutFile& operator << (FitsInOutFile& fios, NTuple & nt)
84 { FITS_NTuple fih(&nt); fih.Write(fios); return (fios); }
85
86inline FitsInOutFile& operator >> (FitsInOutFile& fiis, NTuple & nt)
87 { FITS_NTuple fih(&nt); fiis.SkipEmptyFirstHDU();
88 fih.Read(fiis); fiis.MoveToNextHDU(); return (fiis); }
89
90
91} // Fin du namespace
92
93#endif
Note: See TracBrowser for help on using the repository browser.