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

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

long long gestion cfistio>2.4 (compat <2.4) cmv 8/8/2002

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