source: Sophya/trunk/SophyaExt/FitsIOServer/fabtcolread.h@ 2170

Last change on this file since 2170 was 2170, checked in by cmv, 23 years ago

long long et uint_2 cmv 9/8/02

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