From 2ead84a9d29629007c284deaa64d59061215d808 Mon Sep 17 00:00:00 2001 From: cmv <> Date: Fri, 9 Aug 2002 16:47:25 +0000 Subject: [PATCH] modifs cmv 9/8/02 --- FitsIOServer/fabtcolread.cc | 12 ++++++++---- FitsIOServer/fabtwriter.cc | 27 +++++++++++++++++++++++++-- FitsIOServer/fabtwriter.h | 2 ++ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/FitsIOServer/fabtcolread.cc b/FitsIOServer/fabtcolread.cc index 3c0bac3..34f1eeb 100644 --- a/FitsIOServer/fabtcolread.cc +++ b/FitsIOServer/fabtcolread.cc @@ -215,11 +215,14 @@ void FitsABTColRead::Init(const char* fname,const char* collabel,int colnum // Get column name back, tunit, tform char tunit[64], tform[64]; + long repeat=0; double tscale=1., tzero=0.; int rc=0; if(HduType==BINARY_TBL) { - fits_get_bcolparms(FitsPtr,ColNum+1,labelcol,tunit,tform,NULL,NULL,NULL,NULL,NULL,&sta); + fits_get_bcolparms(FitsPtr,ColNum+1,labelcol,tunit,tform + ,&repeat,&tscale,&tzero,NULL,NULL,&sta); } else { - fits_get_acolparms(FitsPtr,ColNum+1,labelcol,NULL,tunit,tform,NULL,NULL,NULL,NULL,&sta); + fits_get_acolparms(FitsPtr,ColNum+1,labelcol,&repeat,tunit,tform + ,&tscale,&tzero,NULL,NULL,&sta); } if(rc) { printerror(sta); Delete(); @@ -231,8 +234,9 @@ void FitsABTColRead::Init(const char* fname,const char* collabel,int colnum if(DbgLevel) cout<<"FitsABTColRead::Init Num="<<ColNum<<" Label="<<ColLabel - <<" TypeCode="<<ColTypeCode - <<" TUnit="<<ColTUnit<<" TForm="<<ColTForm<<endl; + <<" TypeCode="<<ColTypeCode<<" TUnit="<<ColTUnit<<" TForm="<<ColTForm<<endl; + if(DbgLevel>1) + cout<<" (repeat="<<repeat<<",tscale="<<tscale<<",tzero="<<tzero<<")"<<endl; } diff --git a/FitsIOServer/fabtwriter.cc b/FitsIOServer/fabtwriter.cc index 697c1be..be6c93c 100644 --- a/FitsIOServer/fabtwriter.cc +++ b/FitsIOServer/fabtwriter.cc @@ -287,7 +287,7 @@ void FitsABTWriter::createtbl(void) ////////////////////////////////////////////////////////////// /*! - Write a short data to FITS file. + Write a data to FITS file. \param col : column number [0,ncol[ \param row : row number [0,nrow[ \param val : value to be written @@ -305,6 +305,17 @@ void FitsABTWriter::createtbl(void) the cast is performed by the cfistio package. \endverbatim */ + +/*! Write signed char (1 Byte) data to FITS file (see below) */ +void FitsABTWriter::Write(int col,long row,int_1 val) +{ + if(FirstTime) createtbl(); + int sta=0; + if(fits_write_col(FitsPtr,TBYTE,col+1,row+1,1,1,&val,&sta)) + printerrorwrite("char",col,row,sta); +} + +/*! Write short (2 Bytes) data to FITS file (see below) */ void FitsABTWriter::Write(int col,long row,int_2 val) { if(FirstTime) createtbl(); @@ -333,6 +344,17 @@ void FitsABTWriter::Write(int col,long row,int_4 val) printerrorwrite("long",col,row,sta); } +/*! Write unsigned long (4 Bytes) data to FITS file (see below) */ +void FitsABTWriter::Write(int col,long row,uint_4 val) +{ + if(FirstTime) createtbl(); + int sta=0; + // Bug ou inconsistence cfitsio sur machine ou long=8Bytes ? + int T = (sizeof(unsigned long)==4) ? TULONG: TUINT; + if(fits_write_col(FitsPtr,T,col+1,row+1,1,1,&val,&sta)) + printerrorwrite("long",col,row,sta); +} + /*! Write long long (8 Bytes) data to FITS file (see below) */ void FitsABTWriter::Write(int col,long row,int_8 val) { @@ -366,13 +388,14 @@ void FitsABTWriter::Write(int col,long row,double val) ////////////////////////////////////////////////////////////// /*! - Write a vector of long data to FITS file. + Write a vector of data to FITS file. \param col : column number [0,ncol[ \param row : starting row number [0,nrow[ \param val : vector to be written \return "N" = number of the next row to be written, that is "N-1" is the number of the last row written. */ + /*! Write a vector of unsigned short (2 Bytes) data to FITS file (see below) */ long FitsABTWriter::Write(int col,long row,TVector<uint_2>& val) { diff --git a/FitsIOServer/fabtwriter.h b/FitsIOServer/fabtwriter.h index b955eda..5949358 100644 --- a/FitsIOServer/fabtwriter.h +++ b/FitsIOServer/fabtwriter.h @@ -45,9 +45,11 @@ public: //! Set debug level inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;} + void Write(int col,long row,int_1 val); void Write(int col,long row,int_2 val); void Write(int col,long row,uint_2 val); void Write(int col,long row,int_4 val); + void Write(int col,long row,uint_4 val); void Write(int col,long row,int_8 val); void Write(int col,long row,float val); void Write(int col,long row,double val); -- GitLab