/* 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,string tform=string("") ,string tunit=string(""),int datatype=TDOUBLE) {return addcol(label.c_str(),tform.c_str(),tunit.c_str(),datatype);} //! Add a new column to the FITS table and return its number (see addcol). inline int AddCol(const char* label,const char* tform="" ,const char* tunit="",int datatype=TDOUBLE) {return addcol(label,tform,tunit,datatype);} //! 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 = (unsigned short) lp;} void Write(int col,long row,short val); void Write(int col,long row,int_4 val); void Write(int col,long row,float val); void Write(int col,long row,double val); long Write(int col,long row,TVector& val); long Write(int col,long row,TVector& val); long Write(int col,long row,TVector& val); //! Return the number of overflows managed by cfitsio inline unsigned long GetNOverFlow(void) {return NOverFlow;} protected: void createfits(const char *cfname,int hdutype,int lp); int addcol(const char* label,const char* tform ,const char* tunit,int datatype); void createtbl(void); void printerrorwrite(const char* type,int col,long row,int sta); void printerror(int sta) const; string FitsFN,ExtName; int HduType; unsigned short DbgLevel; fitsfile *FitsPtr; bool FirstTime; vector Label; vector TForm; vector TUnit; unsigned long NOverFlow; }; } // namespace SOPHYA #endif /* FABTWRITER_H_SEEN */