Ignore:
Timestamp:
Nov 18, 2005, 6:44:57 PM (20 years ago)
Author:
ansari
Message:

debut modifs nouveau fits pour support I/O chaines de caracteres - Reza 18/11/2005

File:
1 edited

Legend:

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

    r2820 r2843  
    77#include <iostream>
    88
     9string 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}
     33string 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}
    991
    1092/*!
     
    20102  fptr_ = NULL;
    21103  SetDef_BinTable();
     104  SetDef_StrColWidth();
    22105}
    23106
     
    29112  fptr_ = NULL;
    30113  SetDef_BinTable();
     114  SetDef_StrColWidth();
    31115  Open(name.c_str(), mode);
    32116}
     
    39123  fptr_ = NULL;
    40124  SetDef_BinTable();
     125  SetDef_StrColWidth();
    41126  Open(name, mode);
    42127}
     
    106191    fits_movabs_hdu(FitsPtr() , 1, &hdutyp, &status);
    107192    status = 0;
    108     float sfv = 2.0;
     193    float sfv = Version();
    109194    fits_write_key(FitsPtr(), TFLOAT, "SOPHYAFV", &sfv,
    110195                   "SOPHYA FitsIOServer module version", &status);
     
    376461
    377462/*-- 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*/
     468string FitsInOutFile::KeyValue(string const & key, bool& nosk)
     469{
     470  nosk = false;
    380471  int status = 0;
    381472  char value[FLEN_VALUE], comm[FLEN_COMMENT];
    382473  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  }
    383478  FitsCheckStatus(status, "FitsInOutFile::KeyValue() Error: ");
    384479  return value;
Note: See TracChangeset for help on using the changeset viewer.