[1654] | 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
|
---|
[1659] | 20 | ,long blen=100,long bsens=1,int lp=0);
|
---|
[1654] | 21 | FitsABTColRead(string fname,int colnum,int ihdu=0
|
---|
[1659] | 22 | ,long blen=100,long bsens=1,int lp=0);
|
---|
[1654] | 23 | FitsABTColRead(const char *cfname,const char *collabel,int ihdu=0
|
---|
[1659] | 24 | ,long blen=100,long bsens=1,int lp=0);
|
---|
[1654] | 25 | FitsABTColRead(const char *cfname,int colnum,int ihdu=0
|
---|
[1659] | 26 | ,long blen=100,long bsens=1,int lp=0);
|
---|
[1654] | 27 | FitsABTColRead(FitsABTColRead& fbt);
|
---|
| 28 | virtual ~FitsABTColRead();
|
---|
| 29 |
|
---|
| 30 | void ChangeBuffer(long blen=100,long bsens=1);
|
---|
| 31 |
|
---|
[1659] | 32 | double Read(long n,bool usebuffer=true);
|
---|
| 33 | long Read(long n1,long n2,TVector<double>& data);
|
---|
| 34 | long Read(long n1,long n2,TVector<float>& data);
|
---|
| 35 | long Read(long n1,long n2,TVector<int_4>& data);
|
---|
[1654] | 36 |
|
---|
[1659] | 37 | //! return the value of the first row
|
---|
| 38 | double ReadFirstRow(bool usebuffer=false)
|
---|
| 39 | {return Read(0,usebuffer);}
|
---|
| 40 | //! return the value of the last row
|
---|
| 41 | double ReadLastRow(bool usebuffer=false)
|
---|
| 42 | {return Read(NBline-1,usebuffer);}
|
---|
| 43 |
|
---|
| 44 | long FirstRow(double val1,double val2,long rowstart=-1);
|
---|
| 45 | long LastRow(double val1,double val2,long rowstart=-1);
|
---|
| 46 |
|
---|
[1654] | 47 | //! Set debug level
|
---|
[1657] | 48 | inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
|
---|
[1654] | 49 | //! Set null value to be return when reading null data (0=return the data)
|
---|
[1657] | 50 | inline void SetNulVal(double nulval=0.) {NulVal = nulval;}
|
---|
[1654] | 51 | //! Get the FITS file name
|
---|
| 52 | inline string GetFileName(void) {return FitsFN;}
|
---|
[1673] | 53 | //! Get the FITS file pointer (cfistio pointer)
|
---|
| 54 | inline fitsfile* GetFitsPointer(void) {return FitsPtr;}
|
---|
[1654] | 55 | //! Get the number of HDU in the FITS file
|
---|
| 56 | inline int GetNHDU(void) {return NHdu;}
|
---|
| 57 | //! Get the number of the HDU read
|
---|
| 58 | inline int GetHDU(void) {return IHdu;}
|
---|
| 59 | //! Get the HDU type
|
---|
| 60 | inline int GetHDUType(void) {return HduType;}
|
---|
| 61 | //! Get the number of rows in the FITS HDU to be read
|
---|
| 62 | inline long GetNbLine(void) {return NBline;}
|
---|
| 63 | //! Get the number of columns in the FITS HDU to be read
|
---|
| 64 | inline int GetNbCol(void) {return NBcol;}
|
---|
| 65 | //! Get the columns number that is read
|
---|
| 66 | inline int GetColNum(void) {return ColNum;}
|
---|
| 67 | //! Get the columns label that is read
|
---|
| 68 | inline string GetColLabel(void) {return ColLabel;}
|
---|
| 69 | //! Get the columns type code that is read
|
---|
| 70 | inline int GetColTypeCode(void) {return ColTypeCode;}
|
---|
| 71 | //! Get the columns fits tunit that is read
|
---|
| 72 | inline string GetColTUnit(void) {return ColTUnit;}
|
---|
| 73 | //! Get the columns fits tform that is read
|
---|
| 74 | inline string GetColTForm(void) {return ColTForm;}
|
---|
[1657] | 75 | //! Get the read requested buffer length
|
---|
[1654] | 76 | inline long GetBLen(void) {return BuffLen;}
|
---|
| 77 | //! Get the read buffer direction
|
---|
| 78 | inline long GetBSens(void) {return BuffSens;}
|
---|
| 79 | //! Print to os
|
---|
| 80 | virtual void Print(ostream& os,int lp=1) const;
|
---|
| 81 | //! Print to stdout
|
---|
| 82 | inline void Print(int lp=1) const {Print(cout,lp);}
|
---|
[1657] | 83 | //! Get the read effective buffer length
|
---|
| 84 | inline long GetNBuffer(void) {return NBuffer;}
|
---|
[1654] | 85 | //! Get the read bufferpointer
|
---|
| 86 | inline double* GetBuffer(void) {return Buffer;}
|
---|
| 87 |
|
---|
| 88 | protected:
|
---|
| 89 | void Init(const char *cfname,const char *collabel,int colnum
|
---|
| 90 | ,int ihdu,long blen,long bsens,int lp);
|
---|
| 91 | void Delete(void);
|
---|
| 92 | void printerror(int sta) const;
|
---|
| 93 |
|
---|
| 94 | string FitsFN,ColLabel,ColTUnit,ColTForm;
|
---|
| 95 | int ColNum,ColTypeCode,IHdu,NHdu,HduType,NBcol;
|
---|
| 96 | long NBline;
|
---|
| 97 |
|
---|
[1657] | 98 | double NulVal;
|
---|
| 99 | unsigned short DbgLevel;
|
---|
[1654] | 100 | long BuffLen, BuffSens;
|
---|
| 101 |
|
---|
[1657] | 102 | unsigned long NFitsRead;
|
---|
[1654] | 103 | fitsfile *FitsPtr;
|
---|
| 104 | long LineDeb, LineFin;
|
---|
| 105 | double *Buffer;
|
---|
| 106 | long NBuffer;
|
---|
| 107 | };
|
---|
| 108 |
|
---|
| 109 | } // namespace SOPHYA
|
---|
| 110 | #endif /* FABTCOLREAD_H_SEEN */
|
---|