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

Last change on this file since 1661 was 1659, checked in by cmv, 24 years ago
  • documentation updatee
  • des lecteurs de TVector double,float,int_4 dans FitsABTColRead
  • des methodes nouvelles dans le FitsABTColRead

cmv 28/9/01

File size: 3.8 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 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);
36
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
47 //! Set debug level
48 inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
49 //! Set null value to be return when reading null data (0=return the data)
50 inline void SetNulVal(double nulval=0.) {NulVal = nulval;}
51 //! Get the FITS file name
52 inline string GetFileName(void) {return FitsFN;}
53 //! Get the number of HDU in the FITS file
54 inline int GetNHDU(void) {return NHdu;}
55 //! Get the number of the HDU read
56 inline int GetHDU(void) {return IHdu;}
57 //! Get the HDU type
58 inline int GetHDUType(void) {return HduType;}
59 //! Get the number of rows in the FITS HDU to be read
60 inline long GetNbLine(void) {return NBline;}
61 //! Get the number of columns in the FITS HDU to be read
62 inline int GetNbCol(void) {return NBcol;}
63 //! Get the columns number that is read
64 inline int GetColNum(void) {return ColNum;}
65 //! Get the columns label that is read
66 inline string GetColLabel(void) {return ColLabel;}
67 //! Get the columns type code that is read
68 inline int GetColTypeCode(void) {return ColTypeCode;}
69 //! Get the columns fits tunit that is read
70 inline string GetColTUnit(void) {return ColTUnit;}
71 //! Get the columns fits tform that is read
72 inline string GetColTForm(void) {return ColTForm;}
73 //! Get the read requested buffer length
74 inline long GetBLen(void) {return BuffLen;}
75 //! Get the read buffer direction
76 inline long GetBSens(void) {return BuffSens;}
77 //! Print to os
78 virtual void Print(ostream& os,int lp=1) const;
79 //! Print to stdout
80 inline void Print(int lp=1) const {Print(cout,lp);}
81 //! Get the read effective buffer length
82 inline long GetNBuffer(void) {return NBuffer;}
83 //! Get the read bufferpointer
84 inline double* GetBuffer(void) {return Buffer;}
85
86protected:
87 void Init(const char *cfname,const char *collabel,int colnum
88 ,int ihdu,long blen,long bsens,int lp);
89 void Delete(void);
90 void printerror(int sta) const;
91
92 string FitsFN,ColLabel,ColTUnit,ColTForm;
93 int ColNum,ColTypeCode,IHdu,NHdu,HduType,NBcol;
94 long NBline;
95
96 double NulVal;
97 unsigned short DbgLevel;
98 long BuffLen, BuffSens;
99
100 unsigned long NFitsRead;
101 fitsfile *FitsPtr;
102 long LineDeb, LineFin;
103 double *Buffer;
104 long NBuffer;
105};
106
107} // namespace SOPHYA
108#endif /* FABTCOLREAD_H_SEEN */
Note: See TracBrowser for help on using the repository browser.