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