source: Sophya/trunk/SophyaExt/FitsIOServer/fboloread.h@ 4012

Last change on this file since 4012 was 3493, checked in by ansari, 17 years ago

1/ Ajout methodes FitsArrayHandler<T>::ReadAtOffset() WriteAtOffset() pour lecture/ecriture de tableaux <> HDU IMAGE par morceaux
2/ Ajout entete commentaire avec copyright LAL+DAPNIA dans les fichiers .h

Reza 30/04/2008

File size: 8.4 KB
Line 
1/*
2 --- SOPHYA software - FitsIOServer module ---
3 C. Magneville, 2001
4 (C) UPS+LAL IN2P3/CNRS (C) DAPNIA-SPP/CEA
5*/
6/* Interface Fits pour bolometre cmv 29/09/2001 */
7#ifndef FBOLOREAD_H_SEEN
8#define FBOLOREAD_H_SEEN
9
10#include "machdefs.h"
11#include <iostream>
12#include <string.h>
13#include <string>
14
15#include "anydataobj.h"
16#include "tvector.h"
17#include "fabtcolread.h"
18
19#include <vector>
20
21namespace SOPHYA {
22
23//! Class for defining a bolometer by connecting columns out FITS files
24class FitsBoloRead : public AnyDataObj {
25public:
26 enum {ColSNum=0, ColBolo=1, ColFlag=2, ColAlpha=3, ColDelta=4};
27
28 FitsBoloRead(long blen=100,long bsens=1);
29 virtual ~FitsBoloRead();
30
31 //! Define the Alpha column connection (see addcol).
32 inline int SetAlpha(const char *label,const char* fname="",int ihdu=0)
33 {return addcol(ColAlpha,label,fname,ihdu);}
34 //! Define the Delta column connection (see addcol).
35 inline int SetDelta(const char *label,const char* fname="",int ihdu=0)
36 {return addcol(ColDelta,label,fname,ihdu);}
37 //! Define the Bolo column connection (see addcol).
38 inline int SetBolo(const char *label,const char* fname="",int ihdu=0)
39 {return addcol(ColBolo,label,fname,ihdu);}
40 //! Define the Flag column connection (see addcol).
41 inline int SetFlag(const char *label,const char* fname="",int ihdu=0)
42 {return addcol(ColFlag,label,fname,ihdu);}
43 //! Define the Sample Number column connection (see addcol).
44 inline int SetSNum(const char *label,const char* fname="",int ihdu=0)
45 {return addcol(ColSNum,label,fname,ihdu);}
46 //! Add a new column connection (see addcol).
47 inline int AddCol(const char *label,const char* fname,int ihdu=0)
48 {return addcol(-1,label,fname,ihdu);}
49
50 //! return Alpha value for row "n" into double
51 inline double GetAlpha(LONGLONG n,bool usebuffer=true)
52 {return GetCol(ColAlpha,n,usebuffer);}
53 //! return Delta value for row "n" into double
54 inline double GetDelta(LONGLONG n,bool usebuffer=true)
55 {return GetCol(ColDelta,n,usebuffer);}
56 //! return Bolo value for row "n" into double
57 inline double GetBolo(LONGLONG n,bool usebuffer=true)
58 {return GetCol(ColBolo,n,usebuffer);}
59 //! return Flag value for row "n" into double
60 inline double GetFlag(LONGLONG n,bool usebuffer=true)
61 {if(!IsFlag()) return 0.; return GetCol(ColFlag,n,usebuffer);}
62 //! return SNum value for row "n" into double
63 inline double GetSNum(LONGLONG n,bool usebuffer=true)
64 {return GetCol(ColSNum,n,usebuffer);}
65 //! return column "col" value for row "n" into double
66 inline double GetCol(int col,LONGLONG n,bool usebuffer=true) {
67 if(col<0 || col>=(int)mFABT.size())
68 throw ParmError("FitsBoloRead::GetCol: bad column number\n");
69 if(mFABT[col]==NULL)
70 throw NullPtrError("FitsBoloRead::GetCol: column not connected\n");
71 return mFABT[col]->Read(n,usebuffer);
72 }
73
74 //! return Alpha values for rows [n1,n2] into TVector
75 inline LONGLONG GetAlpha(LONGLONG n1,LONGLONG n2,TVector<double>& data)
76 {return GetCol(ColAlpha,n1,n2,data);}
77 inline LONGLONG GetAlpha(LONGLONG n1,LONGLONG n2,TVector<float>& data)
78 {return GetCol(ColAlpha,n1,n2,data);}
79 inline LONGLONG GetAlpha(LONGLONG n1,LONGLONG n2,TVector<int_4>& data)
80 {return GetCol(ColAlpha,n1,n2,data);}
81
82 //! return Delta values for rows [n1,n2] into TVector
83 inline LONGLONG GetDelta(LONGLONG n1,LONGLONG n2,TVector<double>& data)
84 {return GetCol(ColDelta,n1,n2,data);}
85 inline LONGLONG GetDelta(LONGLONG n1,LONGLONG n2,TVector<float>& data)
86 {return GetCol(ColDelta,n1,n2,data);}
87 inline LONGLONG GetDelta(LONGLONG n1,LONGLONG n2,TVector<int_4>& data)
88 {return GetCol(ColDelta,n1,n2,data);}
89
90 //! return Bolo values for rows [n1,n2] into TVector
91 inline LONGLONG GetBolo(LONGLONG n1,LONGLONG n2,TVector<double>& data)
92 {return GetCol(ColBolo,n1,n2,data);}
93 inline LONGLONG GetBolo(LONGLONG n1,LONGLONG n2,TVector<float>& data)
94 {return GetCol(ColBolo,n1,n2,data);}
95 inline LONGLONG GetBolo(LONGLONG n1,LONGLONG n2,TVector<int_4>& data)
96 {return GetCol(ColBolo,n1,n2,data);}
97
98 //! return Flag values for rows [n1,n2] into TVector
99 inline LONGLONG GetFlag(LONGLONG n1,LONGLONG n2,TVector<double>& data)
100 {if(!IsFlag()) return 0; return GetCol(ColFlag,n1,n2,data);}
101 inline LONGLONG GetFlag(LONGLONG n1,LONGLONG n2,TVector<float>& data)
102 {if(!IsFlag()) return 0; return GetCol(ColFlag,n1,n2,data);}
103 inline LONGLONG GetFlag(LONGLONG n1,LONGLONG n2,TVector<int_4>& data)
104 {if(!IsFlag()) return 0; return GetCol(ColFlag,n1,n2,data);}
105
106 //! return Sample Number values for rows [n1,n2] into TVector
107 inline LONGLONG GetSNum(LONGLONG n1,LONGLONG n2,TVector<double>& data)
108 {return GetCol(ColSNum,n1,n2,data);}
109 inline LONGLONG GetSNum(LONGLONG n1,LONGLONG n2,TVector<float>& data)
110 {return GetCol(ColSNum,n1,n2,data);}
111 inline LONGLONG GetSNum(LONGLONG n1,LONGLONG n2,TVector<int_4>& data)
112 {return GetCol(ColSNum,n1,n2,data);}
113
114 //! return column "col" values for rows [n1,n2] into TVector
115 inline LONGLONG GetCol(int col,LONGLONG n1,LONGLONG n2,TVector<double>& data) {
116 if(col<0 || col>=(int)mFABT.size()) return 0; if(mFABT[col]==NULL) return 0;
117 return mFABT[col]->Read(n1,n2,data);
118 }
119 inline LONGLONG GetCol(int col,LONGLONG n1,LONGLONG n2,TVector<float>& data) {
120 if(col<0 || col>=(int)mFABT.size()) return 0; if(mFABT[col]==NULL) return 0;
121 return mFABT[col]->Read(n1,n2,data);
122 }
123 inline LONGLONG GetCol(int col,LONGLONG n1,LONGLONG n2,TVector<int_4>& data) {
124 if(col<0 || col>=(int)mFABT.size()) return 0; if(mFABT[col]==NULL) return 0;
125 return mFABT[col]->Read(n1,n2,data);
126 }
127
128 //! return the value of the first sampleNum
129 inline double ReadFirstSNum(void) {return GetSNum(0,false);}
130 //! return the value of the last sampleNum
131 inline double ReadLastSNum(void) {return GetSNum(NBline-1,false);}
132
133 //! Is Alpha connected ?
134 inline bool IsAlpha(void) {return IsCol(ColAlpha);}
135 //! Is Delta connected ?
136 inline bool IsDelta(void) {return IsCol(ColDelta);}
137 //! Is Bolo connected ?
138 inline bool IsBolo(void) {return IsCol(ColBolo);}
139 //! Is Flag connected ?
140 inline bool IsFlag(void) {return IsCol(ColFlag);}
141 //! Is SNum connected ?
142 inline bool IsSNum(void) {return IsCol(ColSNum);}
143 //! Is column col connected ?
144 inline bool IsCol(int col) {if(mFABT[col]) return true; return false;}
145
146 //! Set debug level
147 inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
148 //! Set the number of rows for that class choosing column "col"
149 void SetNbLine(int col=-1);
150 //! Get the number of rows to be read
151 inline LONGLONG GetNbLine(void) const {return NBline;}
152 //! Get the number of columns in the FITS HDU to be read
153 inline int GetNbCol(void) const {return mFABT.size();}
154 //! Get the read requested buffer length
155 inline long GetBLen(void) const {return BuffLen;}
156 //! Get the read buffer direction
157 inline long GetBSens(void) const {return BuffSens;}
158 //! Print to os
159 virtual void Print(ostream& os,int lp=1) const;
160 //! Print to stdout
161 inline void Print(int lp=1) const {Print(cout,lp);}
162
163 //! Get the FitsABTColRead pointer for the Alpha
164 inline FitsABTColRead* GetAlphaReader(void) {return GetColReader(ColAlpha);}
165 //! Get the FitsABTColRead pointer for the Delta
166 inline FitsABTColRead* GetDeltaReader(void) {return GetColReader(ColDelta);}
167 //! Get the FitsABTColRead pointer for the Bolo
168 inline FitsABTColRead* GetBoloReader(void) {return GetColReader(ColBolo);}
169 //! Get the FitsABTColRead pointer for the Flag
170 inline FitsABTColRead* GetFlagReader(void) {return GetColReader(ColFlag);}
171 //! Get the FitsABTColRead pointer for the SNum
172 inline FitsABTColRead* GetSNumReader(void) {return GetColReader(ColSNum);}
173 //! Get the FitsABTColRead pointer for the column "col"
174 inline FitsABTColRead* GetColReader(int col)
175 {if(col<0 || col>=(int)mFABT.size()) return NULL; return mFABT[col];}
176
177protected:
178 //! Protected method. Do not use directly but read the doc.
179 int addcol(int col,const char *label,const char* fname,int ihdu);
180 void Gess_If_Not_Define(int col);
181
182 LONGLONG NBline;
183 unsigned short DbgLevel;
184 long BuffLen, BuffSens;
185
186 vector<string> mFName;
187 vector<string> mLabel;
188 vector<int> mHDU;
189 vector<FitsABTColRead *> mFABT;
190};
191
192} // namespace SOPHYA
193#endif /* FBOLOREAD_H_SEEN */
Note: See TracBrowser for help on using the repository browser.