Changeset 2170 in Sophya for trunk/SophyaExt


Ignore:
Timestamp:
Aug 9, 2002, 3:03:41 PM (23 years ago)
Author:
cmv
Message:

long long et uint_2 cmv 9/8/02

Location:
trunk/SophyaExt/FitsIOServer
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaExt/FitsIOServer/fabtcolread.cc

    r2169 r2170  
    203203
    204204 // Get column type
    205  int ColTypeCode;
    206205 if(fits_get_coltype(FitsPtr,ColNum+1,&ColTypeCode,NULL,NULL,&sta)) {
    207206   printerror(sta); Delete();
     
    441440}
    442441
    443 /*! idem before but for TVector of int_4 */
    444 long FitsABTColRead::Read(long n1,long n2,TVector<int_4>& data)
     442/*! idem before but for TVector of unsigned short */
     443long FitsABTColRead::Read(long n1,long n2,TVector<uint_2>& data)
    445444{
    446445 if(n1<0 || n1>=NBline)
     
    454453 if(data.Size()<nread) data.SetSize(nread);
    455454
     455 int sta=0;
     456 fits_read_col(FitsPtr,TUSHORT,ColNum+1,n1+1,1,nread,NULL,data.Data(),NULL,&sta);
     457 if(sta) {
     458   printerror(sta);
     459   throw NotAvailableOperation("FitsABTColRead::Read_TVector<uint_2>: Error Reading Fits file\n");
     460 }
     461
     462 return nread;
     463}
     464
     465/*! idem before but for TVector of int_4 */
     466long FitsABTColRead::Read(long n1,long n2,TVector<int_4>& data)
     467{
     468 if(n1<0 || n1>=NBline)
     469   throw RangeCheckError("FitsABTColRead::Read TVector bad requested 1srt line \n");
     470 if(data.Size()<=0 && n2<n1)
     471   throw RangeCheckError("FitsABTColRead::Read TVector bad requested 2sd line \n");
     472 if(n2<0) n2 = n1 + data.Size()-1;
     473 if(n2>=NBline) n2 = NBline-1;
     474
     475 sa_size_t nread = n2-n1+1;
     476 if(data.Size()<nread) data.SetSize(nread);
     477
    456478 //for(long i=n1;i<=n2;i++) data(i-n1) = Read(i);
    457479 int sta=0;
     
    460482 if(sta) {
    461483   printerror(sta);
    462    throw NotAvailableOperation("FitsABTColRead::Read_TVector<float>: Error Reading Fits file\n");
     484   throw NotAvailableOperation("FitsABTColRead::Read_TVector<int_4>: Error Reading Fits file\n");
    463485 }
    464486
     
    484506 if(sta) {
    485507   printerror(sta);
    486    throw NotAvailableOperation("FitsABTColRead::Read_TVector<float>: Error Reading Fits file\n");
     508   throw NotAvailableOperation("FitsABTColRead::Read_TVector<int_8>: Error Reading Fits file\n");
    487509 }
    488510
  • trunk/SophyaExt/FitsIOServer/fabtcolread.h

    r2169 r2170  
    3333
    3434  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);
     35
     36  long   Read(long n1,long n2,TVector<uint_2>& data);
    3737  long   Read(long n1,long n2,TVector<int_4>& data);
    3838  long   Read(long n1,long n2,TVector<int_8>& data);
     39  long   Read(long n1,long n2,TVector<float>& data);
     40  long   Read(long n1,long n2,TVector<double>& data);
    3941
    4042  //! return the value of the first row
  • trunk/SophyaExt/FitsIOServer/fabtwriter.cc

    r2169 r2170  
    306306  \endverbatim
    307307*/
    308 void FitsABTWriter::Write(int col,long row,short val)
     308void FitsABTWriter::Write(int col,long row,int_2 val)
    309309{
    310310  if(FirstTime) createtbl();
     
    312312  if(fits_write_col(FitsPtr,TSHORT,col+1,row+1,1,1,&val,&sta))
    313313    printerrorwrite("short",col,row,sta);
     314}
     315
     316/*! Write unsigned short (2 Bytes) data to FITS file (see below) */
     317void FitsABTWriter::Write(int col,long row,uint_2 val)
     318{
     319  if(FirstTime) createtbl();
     320  int sta=0;
     321  if(fits_write_col(FitsPtr,TUSHORT,col+1,row+1,1,1,&val,&sta))
     322    printerrorwrite("unsigned short",col,row,sta);
    314323}
    315324
     
    365374      that is "N-1" is the number of the last row written.
    366375*/
     376/*! Write a vector of unsigned short (2 Bytes) data to FITS file (see below) */
     377long FitsABTWriter::Write(int col,long row,TVector<uint_2>& val)
     378{
     379  if(FirstTime) createtbl();
     380  long nel = val.Size();
     381  int sta=0;
     382  if(fits_write_col(FitsPtr,TUSHORT,col+1,row+1,1,nel,val.Data(),&sta))
     383    printerrorwrite("long",col,row,sta);
     384  return row+nel;
     385}
     386
    367387/*! Write a vector of long (4 Bytes) data to FITS file (see below) */
    368388long FitsABTWriter::Write(int col,long row,TVector<int_4>& val)
     
    389409  return row+nel;
    390410#else
    391   throw PException("FitsABTWriter::Write(..,TVector<int_8>&) Not in that cfitio version");
     411  throw PException("FitsABTWriter::Write(..,TVector<int_8>&) Not in that cfitsio version");
    392412#endif
    393413}
  • trunk/SophyaExt/FitsIOServer/fabtwriter.h

    r2169 r2170  
    4646  inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
    4747
    48   void Write(int col,long row,short val);
     48  void Write(int col,long row,int_2 val);
     49  void Write(int col,long row,uint_2 val);
    4950  void Write(int col,long row,int_4 val);
    5051  void Write(int col,long row,int_8 val);
    5152  void Write(int col,long row,float val);
    5253  void Write(int col,long row,double val);
     54  long Write(int col,long row,TVector<uint_2>& val);
    5355  long Write(int col,long row,TVector<int_4>& val);
    5456  long Write(int col,long row,TVector<int_8>& val);
Note: See TracChangeset for help on using the changeset viewer.