/* Interface Fits BINARY/ASCII Table Writer cmv 26/09/2001 */ #ifndef FABTWRITER_H_SEEN #define FABTWRITER_H_SEEN #include "machdefs.h" #include #include #include #include "anydataobj.h" #include "tvector.h" #include "FitsIO/fitsio.h" #include namespace SOPHYA { //! Class for writing a FITS ASCII or BINARY table class FitsABTWriter : public AnyDataObj { public: FitsABTWriter(string fname,int hdutype=BINARY_TBL,int lp=0); FitsABTWriter(const char* cfname,int hdutype=BINARY_TBL,int lp=0); virtual ~FitsABTWriter(); //! Add a new column to the FITS table and return its number (see addcol). inline int AddCol(string label,int datatype=TDOUBLE ,string tform=string(""),string tunit=string("")) {return addcol(label.c_str(),datatype,tform.c_str(),tunit.c_str());} //! Add a new column to the FITS table and return its number (see addcol). inline int AddCol(const char* label,int datatype=TDOUBLE ,const char* tform="",const char* tunit="") {return addcol(label,datatype,tform,tunit);} //! Set the FITS table extension name inline void SetExtName(string extname=string("")) {ExtName = extname;} //! Set the FITS table extension name inline void SetExtName(char* extname="") {ExtName = extname;} //! Set debug level inline void SetDebug(int lp=0) {DbgLevel = (uint_2) lp;} void Write(int col,long row,short val); void Write(int col,long row,long val); void Write(int col,long row,float val); void Write(int col,long row,double val); //! Return the number of overflows managed by cfitsio inline uint_4 GetNOverFlow(void) {return NOverFlow;} protected: void createfits(const char *cfname,int hdutype,int lp); int addcol(const char* label,int datatype ,const char* tform,const char* tunit); void createtbl(void); void printerrorwrite(char* type,int col,long row,int sta); void printerror(int sta) const; string FitsFN,ExtName; int HduType; uint_2 DbgLevel; fitsfile *FitsPtr; bool FirstTime; vector Label; vector DataType; vector TForm; vector TUnit; uint_4 NOverFlow; }; } // namespace SOPHYA #endif /* FABTWRITER_H_SEEN */