Changeset 2170 in Sophya for trunk/SophyaExt
- Timestamp:
- Aug 9, 2002, 3:03:41 PM (23 years ago)
- Location:
- trunk/SophyaExt/FitsIOServer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/FitsIOServer/fabtcolread.cc
r2169 r2170 203 203 204 204 // Get column type 205 int ColTypeCode;206 205 if(fits_get_coltype(FitsPtr,ColNum+1,&ColTypeCode,NULL,NULL,&sta)) { 207 206 printerror(sta); Delete(); … … 441 440 } 442 441 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 */ 443 long FitsABTColRead::Read(long n1,long n2,TVector<uint_2>& data) 445 444 { 446 445 if(n1<0 || n1>=NBline) … … 454 453 if(data.Size()<nread) data.SetSize(nread); 455 454 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 */ 466 long 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 456 478 //for(long i=n1;i<=n2;i++) data(i-n1) = Read(i); 457 479 int sta=0; … … 460 482 if(sta) { 461 483 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"); 463 485 } 464 486 … … 484 506 if(sta) { 485 507 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"); 487 509 } 488 510 -
trunk/SophyaExt/FitsIOServer/fabtcolread.h
r2169 r2170 33 33 34 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);35 36 long Read(long n1,long n2,TVector<uint_2>& data); 37 37 long Read(long n1,long n2,TVector<int_4>& data); 38 38 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); 39 41 40 42 //! return the value of the first row -
trunk/SophyaExt/FitsIOServer/fabtwriter.cc
r2169 r2170 306 306 \endverbatim 307 307 */ 308 void FitsABTWriter::Write(int col,long row, shortval)308 void FitsABTWriter::Write(int col,long row,int_2 val) 309 309 { 310 310 if(FirstTime) createtbl(); … … 312 312 if(fits_write_col(FitsPtr,TSHORT,col+1,row+1,1,1,&val,&sta)) 313 313 printerrorwrite("short",col,row,sta); 314 } 315 316 /*! Write unsigned short (2 Bytes) data to FITS file (see below) */ 317 void 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); 314 323 } 315 324 … … 365 374 that is "N-1" is the number of the last row written. 366 375 */ 376 /*! Write a vector of unsigned short (2 Bytes) data to FITS file (see below) */ 377 long 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 367 387 /*! Write a vector of long (4 Bytes) data to FITS file (see below) */ 368 388 long FitsABTWriter::Write(int col,long row,TVector<int_4>& val) … … 389 409 return row+nel; 390 410 #else 391 throw PException("FitsABTWriter::Write(..,TVector<int_8>&) Not in that cfit io version");411 throw PException("FitsABTWriter::Write(..,TVector<int_8>&) Not in that cfitsio version"); 392 412 #endif 393 413 } -
trunk/SophyaExt/FitsIOServer/fabtwriter.h
r2169 r2170 46 46 inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;} 47 47 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); 49 50 void Write(int col,long row,int_4 val); 50 51 void Write(int col,long row,int_8 val); 51 52 void Write(int col,long row,float val); 52 53 void Write(int col,long row,double val); 54 long Write(int col,long row,TVector<uint_2>& val); 53 55 long Write(int col,long row,TVector<int_4>& val); 54 56 long Write(int col,long row,TVector<int_8>& val);
Note:
See TracChangeset
for help on using the changeset viewer.