Changeset 2843 in Sophya for trunk/SophyaExt/FitsIOServer/fitsinoutfile.cc
- Timestamp:
- Nov 18, 2005, 6:44:57 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/FitsIOServer/fitsinoutfile.cc
r2820 r2843 7 7 #include <iostream> 8 8 9 string FitsTypes::ImageTypeToTypeString(int ityp) 10 { 11 switch (ityp) { 12 case BYTE_IMG : 13 return "uint_1"; 14 break; 15 case SHORT_IMG : 16 return "int_2"; 17 break; 18 case LONG_IMG : 19 return "int_4"; 20 break; 21 case FLOAT_IMG : 22 return "r_4"; 23 break; 24 case DOUBLE_IMG : 25 return "r_8"; 26 break; 27 default: 28 return "???" ; 29 break; 30 } 31 return ""; 32 } 33 string FitsTypes::DataTypeToTypeString(int ityp) 34 { 35 switch (ityp) { 36 case TBYTE : 37 return "uint_1"; 38 break; 39 case TSHORT : 40 return "int_2"; 41 break; 42 case TUSHORT : 43 return "uint_2"; 44 break; 45 case TINT : 46 if (sizeof(int) == 4) return "int_4"; 47 else if (sizeof(int) == 8) return "int_8"; 48 else if (sizeof(int) == 2) return "int_2"; 49 break; 50 case TUINT : 51 if (sizeof(int) == 4) return "uint_4"; 52 else if (sizeof(int) == 8) return "uint_8"; 53 else if (sizeof(int) == 2) return "uint_2"; 54 break; 55 case TLONG : 56 if (sizeof(long) == 4) return "int_4"; 57 else if (sizeof(long) == 8) return "int_8"; 58 else if (sizeof(long) == 2) return "int_2"; 59 break; 60 case TULONG : 61 if (sizeof(long) == 4) return "uint_4"; 62 else if (sizeof(long) == 8) return "uint_8"; 63 else if (sizeof(long) == 2) return "uint_2"; 64 break; 65 #ifdef TLONGLONG 66 case TLONGLONG : 67 return "int_8"; 68 break; 69 #endif 70 case TFLOAT : 71 return "r_4"; 72 break; 73 case TDOUBLE : 74 return "r_8"; 75 break; 76 case TCOMPLEX : 77 return "complex< r_4 >"; 78 break; 79 case TDBLCOMPLEX : 80 return "complex< r_8 >"; 81 break; 82 case TSTRING : 83 return "string"; 84 break; 85 default: 86 return "???" ; 87 break; 88 } 89 return ""; 90 } 9 91 10 92 /*! … … 20 102 fptr_ = NULL; 21 103 SetDef_BinTable(); 104 SetDef_StrColWidth(); 22 105 } 23 106 … … 29 112 fptr_ = NULL; 30 113 SetDef_BinTable(); 114 SetDef_StrColWidth(); 31 115 Open(name.c_str(), mode); 32 116 } … … 39 123 fptr_ = NULL; 40 124 SetDef_BinTable(); 125 SetDef_StrColWidth(); 41 126 Open(name, mode); 42 127 } … … 106 191 fits_movabs_hdu(FitsPtr() , 1, &hdutyp, &status); 107 192 status = 0; 108 float sfv = 2.0;193 float sfv = Version(); 109 194 fits_write_key(FitsPtr(), TFLOAT, "SOPHYAFV", &sfv, 110 195 "SOPHYA FitsIOServer module version", &status); … … 376 461 377 462 /*-- Methode --*/ 378 string FitsInOutFile::KeyValue(string const & key) 379 { 463 /*! 464 Return the value associated to the keyword \b key in the header as a string. 465 If the keyword is not found in the fits header, an empty string is returned 466 and the \b nosk flag is set to true. 467 */ 468 string FitsInOutFile::KeyValue(string const & key, bool& nosk) 469 { 470 nosk = false; 380 471 int status = 0; 381 472 char value[FLEN_VALUE], comm[FLEN_COMMENT]; 382 473 fits_read_key(FitsPtr(), TSTRING, const_cast<char *>(key.c_str()), value, comm, &status); 474 if (status == KEY_NO_EXIST) { 475 nosk = true; 476 return ""; 477 } 383 478 FitsCheckStatus(status, "FitsInOutFile::KeyValue() Error: "); 384 479 return value;
Note:
See TracChangeset
for help on using the changeset viewer.