1 | /* Interface Fits BINARY/ASCII Table Column Reader cmv 26/09/2001 */
|
---|
2 | #ifndef FABTCOLREAD_H_SEEN
|
---|
3 | #define FABTCOLREAD_H_SEEN
|
---|
4 |
|
---|
5 | #include "machdefs.h"
|
---|
6 | #include <iostream.h>
|
---|
7 | #include <string.h>
|
---|
8 | #include <string>
|
---|
9 |
|
---|
10 | #include "anydataobj.h"
|
---|
11 | #include "tvector.h"
|
---|
12 | #include "FitsIO/fitsio.h"
|
---|
13 |
|
---|
14 | namespace SOPHYA {
|
---|
15 |
|
---|
16 | //! Class for reading a column in a FITS ASCII or BINARY table
|
---|
17 | class FitsABTColRead : public AnyDataObj {
|
---|
18 | public:
|
---|
19 | FitsABTColRead(string fname,string collabel,int ihdu=0
|
---|
20 | ,long blen=100,long bsens=1,int lp=0);
|
---|
21 | FitsABTColRead(string fname,int colnum,int ihdu=0
|
---|
22 | ,long blen=100,long bsens=1,int lp=0);
|
---|
23 | FitsABTColRead(const char *cfname,const char *collabel,int ihdu=0
|
---|
24 | ,long blen=100,long bsens=1,int lp=0);
|
---|
25 | FitsABTColRead(const char *cfname,int colnum,int ihdu=0
|
---|
26 | ,long blen=100,long bsens=1,int lp=0);
|
---|
27 | FitsABTColRead(FitsABTColRead& fbt);
|
---|
28 | virtual ~FitsABTColRead();
|
---|
29 |
|
---|
30 | void ChangeBuffer(long blen=100,long bsens=1);
|
---|
31 |
|
---|
32 | r_8 Read(long n);
|
---|
33 | void Read(long n1,long n2,TVector<r_8>& data);
|
---|
34 |
|
---|
35 | //! Set debug level
|
---|
36 | inline void SetDebug(int lp=0) {DbgLevel = (uint_2) lp;}
|
---|
37 | //! Set null value to be return when reading null data (0=return the data)
|
---|
38 | inline void SetNulVal(r_8 nulval=0.) {NulVal = nulval;}
|
---|
39 | //! Get the FITS file name
|
---|
40 | inline string GetFileName(void) {return FitsFN;}
|
---|
41 | //! Get the number of HDU in the FITS file
|
---|
42 | inline int GetNHDU(void) {return NHdu;}
|
---|
43 | //! Get the number of the HDU read
|
---|
44 | inline int GetHDU(void) {return IHdu;}
|
---|
45 | //! Get the HDU type
|
---|
46 | inline int GetHDUType(void) {return HduType;}
|
---|
47 | //! Get the number of rows in the FITS HDU to be read
|
---|
48 | inline long GetNbLine(void) {return NBline;}
|
---|
49 | //! Get the number of columns in the FITS HDU to be read
|
---|
50 | inline int GetNbCol(void) {return NBcol;}
|
---|
51 | //! Get the columns number that is read
|
---|
52 | inline int GetColNum(void) {return ColNum;}
|
---|
53 | //! Get the columns label that is read
|
---|
54 | inline string GetColLabel(void) {return ColLabel;}
|
---|
55 | //! Get the columns type code that is read
|
---|
56 | inline int GetColTypeCode(void) {return ColTypeCode;}
|
---|
57 | //! Get the columns fits tunit that is read
|
---|
58 | inline string GetColTUnit(void) {return ColTUnit;}
|
---|
59 | //! Get the columns fits tform that is read
|
---|
60 | inline string GetColTForm(void) {return ColTForm;}
|
---|
61 | //! Get the read buffer length
|
---|
62 | inline long GetBLen(void) {return BuffLen;}
|
---|
63 | //! Get the read buffer direction
|
---|
64 | inline long GetBSens(void) {return BuffSens;}
|
---|
65 | //! Print to os
|
---|
66 | virtual void Print(ostream& os,int lp=1) const;
|
---|
67 | //! Print to stdout
|
---|
68 | inline void Print(int lp=1) const {Print(cout,lp);}
|
---|
69 | //! Get the read buffer effective length
|
---|
70 | inline long GetBufferLen(void) {return NBuffer;}
|
---|
71 | //! Get the read bufferpointer
|
---|
72 | inline double* GetBuffer(void) {return Buffer;}
|
---|
73 |
|
---|
74 | protected:
|
---|
75 | void Init(const char *cfname,const char *collabel,int colnum
|
---|
76 | ,int ihdu,long blen,long bsens,int lp);
|
---|
77 | void Delete(void);
|
---|
78 | void printerror(int sta) const;
|
---|
79 |
|
---|
80 | string FitsFN,ColLabel,ColTUnit,ColTForm;
|
---|
81 | int ColNum,ColTypeCode,IHdu,NHdu,HduType,NBcol;
|
---|
82 | long NBline;
|
---|
83 |
|
---|
84 | r_8 NulVal;
|
---|
85 | uint_2 DbgLevel;
|
---|
86 | long BuffLen, BuffSens;
|
---|
87 |
|
---|
88 | uint_4 NFitsRead;
|
---|
89 | fitsfile *FitsPtr;
|
---|
90 | long LineDeb, LineFin;
|
---|
91 | double *Buffer;
|
---|
92 | long NBuffer;
|
---|
93 | };
|
---|
94 |
|
---|
95 | } // namespace SOPHYA
|
---|
96 | #endif /* FABTCOLREAD_H_SEEN */
|
---|