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

Last change on this file 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
RevLine 
[3493]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*/
[860]6
7
8#ifndef FITSNTuple_SEEN
9#define FITSNTuple_SEEN
[1136]10#include "machdefs.h"
[860]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////////////////////////////////////////////////////////////////
[1136]21class FITS_NTuple : public FitsIOHandler
[860]22{
23
24public:
25
26FITS_NTuple();
[1174]27FITS_NTuple(char inputfile[],int hdunum=0);
[860]28FITS_NTuple(const NTuple & obj);
[1047]29 FITS_NTuple(NTuple* obj);
[860]30virtual ~FITS_NTuple();
[1136]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 }
[2897]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 }
[1136]48
[2897]49virtual int CheckReadability(FitsInOutFile& is);
[1136]50
[2897]51virtual FitsHandlerInterface* Clone()
52 { return new FITS_NTuple() ; }
53
[1047]54/*!
[3572]55fill the NTuple only with lines from firstLine-th to (firstLine+numberOfLines-1)-th of the FITS-file inputfile.
[1047]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*/
[1174]59 void ReadLines(char inputfile[],int firstLine, int numberOfLines,int hdunum=0);
[1136]60
[860]61inline operator NTuple() { return(*dobj_); }
[1049]62inline NTuple * getObj() { return(dobj_); }
[860]63
64protected:
65
66 // implementation de FitsFile
[1136]67virtual void ReadFromFits(FitsInFile& is);
68virtual void WriteToFits(FitsOutFile& os) ;
[860]69
[1047]70 private :
71
[1136]72inline void InitNull() { fistLineToBeRead_= -1; numberOfLinesToBeRead_= -1;}
[1047]73
74
[860]75 // attributs de classe
76 NTuple* dobj_;
[1047]77 bool ownobj_;
78 int fistLineToBeRead_;
79 int numberOfLinesToBeRead_;
[860]80};
81//////////////////////////////////////////////////////////////////
82
[3035]83inline FitsInOutFile& operator << (FitsInOutFile& fios, NTuple & nt)
[1231]84 { FITS_NTuple fih(&nt); fih.Write(fios); return (fios); }
[860]85
[3035]86inline FitsInOutFile& operator >> (FitsInOutFile& fiis, NTuple & nt)
[3047]87 { FITS_NTuple fih(&nt); fiis.SkipEmptyFirstHDU();
88 fih.Read(fiis); fiis.MoveToNextHDU(); return (fiis); }
[1231]89
90
[860]91} // Fin du namespace
92
93#endif
Note: See TracBrowser for help on using the repository browser.