Changeset 3167 in Sophya


Ignore:
Timestamp:
Feb 2, 2007, 6:46:47 PM (19 years ago)
Author:
ansari
Message:

Passage a la version ll (LONGLONG) des routines fits , cmv+Reza 02/02/2007

Location:
trunk/SophyaExt/FitsIOServer
Files:
14 edited

Legend:

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

    r3166 r3167  
    167167     printerror(sta);
    168168   ColName.push_back(colname);
    169    if(fits_get_coltype(FitsPtr,icol+1,&typecode,NULL,NULL,&sta))
     169   if(fits_get_coltypell(FitsPtr,icol+1,&typecode,NULL,NULL,&sta))
    170170     printerror(sta);
    171171   if(typecode!=TSTRING && typecode!=TCOMPLEX &&  typecode!=TDBLCOMPLEX)
  • trunk/SophyaExt/FitsIOServer/fitsarrhand.h

    r2907 r3167  
    5050    if (is.CurrentHDUType() != IMAGE_HDU)  return 0;
    5151    T x = 0;
    52     long naxes[BASEARRAY_MAXNDIMS];
     52    LONGLONG naxes[BASEARRAY_MAXNDIMS];
    5353    int naxis=BASEARRAY_MAXNDIMS;
    5454    int imgtyp = is.GetImageHDUInfo(naxis, naxes);
     
    6868      if ( dobj == NULL)
    6969        throw NullPtrError("FitsArrayHandler<T>::Write() dobj=NULL ");
    70       long naxes[BASEARRAY_MAXNDIMS] = {0,0,0,0,0};
     70      LONGLONG naxes[BASEARRAY_MAXNDIMS] = {0,0,0,0,0};
    7171      for(int_4 id=0; id<dobj->NbDimensions(); id++)
    7272        naxes[id] = dobj->Size(id);
     
    8383  virtual void     Read(FitsInOutFile& is)
    8484    {
    85       long naxes[BASEARRAY_MAXNDIMS];
     85      LONGLONG naxes[BASEARRAY_MAXNDIMS];
    8686      int naxis=BASEARRAY_MAXNDIMS;
    8787      is.GetImageHDUInfo(naxis, naxes);
  • trunk/SophyaExt/FitsIOServer/fitsblkrw.h

    r2846 r3167  
    1717//! Write image HDU data to a fits file
    1818static void WriteImageData(FitsInOutFile& fios, const T * d, size_t sz,
    19                            long * fpixel=NULL)
     19                           LONGLONG * fpixel=NULL)
    2020{
    2121  int status = 0;
    22   long fpix[5] = {1,1,1,1,1};
     22  LONGLONG fpix[5] = {1,1,1,1,1};
    2323  if (fpixel == NULL) fpixel = fpix;
    2424  T * ncd = const_cast<T *>(d);
    25   fits_write_pix(fios.FitsPtr(), FitsTypes::DataType(d[0]), fpixel,
     25  fits_write_pixll(fios.FitsPtr(), FitsTypes::DataType(d[0]), fpixel,
    2626                 sz, ncd, &status);
    2727  if ( status ) {
     
    3737//! Read image HDU data from a fits file
    3838static void ReadImageData(FitsInOutFile& fios,  T * d, size_t sz,
    39                           long * fpixel=NULL)
     39                          LONGLONG * fpixel=NULL)
    4040{
    4141  int status = 0;
    42   long fpix[5] = {1,1,1,1,1};
     42  LONGLONG fpix[5] = {1,1,1,1,1};
    4343  if (fpixel == NULL) fpixel = fpix;
    4444  int anynul = 0;
    45   fits_read_pix(fios.FitsPtr(), FitsTypes::DataType(d[0]), fpixel,
     45  fits_read_pixll(fios.FitsPtr(), FitsTypes::DataType(d[0]), fpixel,
    4646                 sz, NULL, d, &anynul, &status);
    4747  if ( status ) {
     
    6666  \param sz : number of data elements to be written
    6767*/
    68 static void WriteColumnData(FitsInOutFile& fios, int colnum, long firstrow,
    69                             long firstelem, const T * d, size_t sz)
     68static void WriteColumnData(FitsInOutFile& fios, int colnum, LONGLONG firstrow,
     69                            LONGLONG firstelem, const T * d, size_t sz)
    7070{
    7171  int status = 0;
     
    9393  \param sz : number of data elements to be read
    9494*/
    95 static void ReadColumnData(FitsInOutFile& fios, int colnum, long firstrow,
    96                             long firstelem, T * d, size_t sz)
     95static void ReadColumnData(FitsInOutFile& fios, int colnum, LONGLONG firstrow,
     96                           LONGLONG firstelem, T * d, size_t sz)
    9797{
    9898  int status = 0;
     
    119119//! Write image HDU with string data type not supported (throws exception)
    120120static void WriteImageData(FitsInOutFile& fios, const std::string * d, size_t sz,
    121                            long * fpixel=NULL)
     121                           LONGLONG * fpixel=NULL)
    122122{
    123123  throw FitsIOException(
     
    126126//! Read image HDU with string data type not supported (throws exception)
    127127static void ReadImageData(FitsInOutFile& fios,  std::string * d, size_t sz,
    128                           long * fpixel=NULL)
     128                          LONGLONG * fpixel=NULL)
    129129{
    130130  throw FitsIOException(
     
    133133
    134134//! Write character string data to binary/ascii HDU data in a fits file.
    135 static void WriteColumnData(FitsInOutFile& fios, int colnum, long firstrow,
    136                             long firstelem, const std::string * d, size_t sz)
     135static void WriteColumnData(FitsInOutFile& fios, int colnum, LONGLONG firstrow,
     136                            LONGLONG firstelem, const std::string * d, size_t sz)
    137137{
    138138  int status = 0;
     
    163163
    164164//! Read character string data to binary/ascii HDU data in a fits file.
    165 static void ReadColumnData(FitsInOutFile& fios, int colnum, long firstrow,
    166                            long firstelem, std::string * d, size_t sz)
     165static void ReadColumnData(FitsInOutFile& fios, int colnum, LONGLONG firstrow,
     166                           LONGLONG firstelem, std::string * d, size_t sz)
    167167{
    168168  int status = 0;
  • trunk/SophyaExt/FitsIOServer/fitsgenedata.cc

    r3063 r3167  
    139139
    140140  //--- Nb de lignes et de colonnes
    141   vector<string> colnames; vector<int> coltypes; vector<long> repcnt, width;
     141  vector<string> colnames; vector<int> coltypes; vector<LONGLONG> repcnt, width;
    142142  is.GetColInfo(colnames,coltypes,repcnt,width);
    143143  long ncol = colnames.size();
    144144  if(ncol<=0)
    145145    throw FitsIOException("FitsHandler<GeneralFitData>::Read() bad number of table columns");
    146   long nbrows = is.GetNbRows();
     146  int_8 nbrows = is.GetNbRows();
    147147  if(nbrows<=0)
    148148    throw FitsIOException("FitsHandler<GeneralFitData>::Read() number of rows is zero, no reading");
  • trunk/SophyaExt/FitsIOServer/fitshdtable.cc

    r3069 r3167  
    200200  vector<string> colnames;
    201201  vector<int> coltypes;
    202   vector<long> repcnt, width;
    203   vector<long> colpos;
     202  vector<LONGLONG> repcnt, width;
     203  vector<sa_size_t> colpos;
    204204  is.GetColInfo(colnames, coltypes, repcnt, width);
    205   long nbrows = is.GetNbRows();
     205  int_8 nbrows = is.GetNbRows();
    206206
    207207  if (dobj == NULL) { // On cree la table si besoin
  • trunk/SophyaExt/FitsIOServer/fitshisterr.cc

    r3148 r3167  
    112112  vector<string> colnames;
    113113  vector<int> coltypes;
    114   vector<long> repcnt, width;
     114  vector<LONGLONG> repcnt, width;
    115115  is.GetColInfo(colnames,coltypes,repcnt,width);
    116116  long ncol = colnames.size();
     
    265265
    266266  //--- Nb de lignes et de colonnes
    267   vector<string> colnames; vector<int> coltypes; vector<long> repcnt, width;
     267  vector<string> colnames; vector<int> coltypes; vector<LONGLONG> repcnt, width;
    268268  is.GetColInfo(colnames,coltypes,repcnt,width);
    269269  long ncol = colnames.size();
  • trunk/SophyaExt/FitsIOServer/fitshistos.cc

    r3123 r3167  
    150150  vector<string> colnames;
    151151  vector<int> coltypes;
    152   vector<long> repcnt, width;
     152  vector<LONGLONG> repcnt, width;
    153153  is.GetColInfo(colnames,coltypes,repcnt,width);
    154154  long ncol = colnames.size();
     
    393393
    394394  //--- Nb de lignes et de colonnes
    395   vector<string> colnames; vector<int> coltypes; vector<long> repcnt, width;
     395  vector<string> colnames; vector<int> coltypes; vector<LONGLONG> repcnt, width;
    396396  is.GetColInfo(colnames,coltypes,repcnt,width);
    397397  long ncol = colnames.size();
  • trunk/SophyaExt/FitsIOServer/fitsinoutfile.cc

    r3069 r3167  
    337337  if (CurrentHDU() != 1) return false;
    338338  int naxis = 2;
    339   long naxes[2];
     339  LONGLONG naxes[2];
    340340  GetImageHDUInfo(naxis, naxes);
    341341  if ((naxis == 0) &&  (NbHDUs() > 1)) {
     
    347347
    348348/*-- Methode --*/
    349 void FitsInOutFile::CreateImageHDU(int bitpix, int naxis, long* naxes)
    350 {
    351   int status = 0;
    352   fits_create_img(fptr_, bitpix, naxis, naxes, &status);
     349void FitsInOutFile::CreateImageHDU(int bitpix, int naxis, LONGLONG* naxes)
     350{
     351  int status = 0;
     352  fits_create_imgll(fptr_, bitpix, naxis, naxes, &status);
    353353  FitsCheckStatus(status,"FitsInOutFile::CreateImageHDU() Error: ");
    354354  return;
     
    361361   Rc : return the image type (bitpix)
    362362 */
    363 int FitsInOutFile::GetImageHDUInfo(int& naxis, long* naxes) const
     363int FitsInOutFile::GetImageHDUInfo(int& naxis, LONGLONG* naxes) const
    364364{
    365365  int status = 0;
    366366  int maxdim = naxis;
    367367  int bitpix = 0;
    368   fits_get_img_param(fptr_, maxdim, &bitpix, &naxis, naxes, &status);
     368  fits_get_img_paramll(fptr_, maxdim, &bitpix, &naxis, naxes, &status);
    369369  FitsCheckStatus(status, "FitsInOutFile::GetImageHDUInfo() Error: ");
    370370  return bitpix;
     
    372372
    373373/*-- Methode --*/
    374 long FitsInOutFile::GetNbRows()  const
    375 {
    376   int status = 0;
    377   long nbrow = 0;
    378   fits_get_num_rows(FitsPtr() , &nbrow, &status);
     374LONGLONG FitsInOutFile::GetNbRows()  const
     375{
     376  int status = 0;
     377  LONGLONG nbrow = 0;
     378  fits_get_num_rowsll(FitsPtr() , &nbrow, &status);
    379379  FitsCheckStatus(status, "FitsInOutFile::GetNbRows() Error: " );
    380380  return nbrow;
     
    466466long FitsInOutFile::GetColInfo(vector<string> & colnames,
    467467                                 vector<int> & coltypes,
    468                                  vector<long> & repcnt,
    469                                  vector<long> & width)
     468                                 vector<LONGLONG> & repcnt,
     469                                 vector<LONGLONG> & width)
    470470{
    471471
     
    478478
    479479  int colnum, typecode;
    480   long repeat, colw;
     480  LONGLONG repeat, colw;   // $CHECK$ LONGLONG ???
    481481  int ncols = 0;
    482482  char colname[128];  // longueur max d'un nom de colonne
     
    493493    }
    494494    int sta2 = 0;
    495     fits_get_coltype(FitsPtr(), colnum, &typecode, &repeat, &colw, &sta2);
     495    fits_get_coltypell(FitsPtr(), colnum, &typecode, &repeat, &colw, &sta2); // $CHECK$ LONGLONG ???fits_get_coltypell
    496496    FitsCheckStatus(sta2, "FitsInOutFile::GetColInfo() Error(2): ");
    497497
     
    608608  CheckFitsPtr(FitsPtr());
    609609  char keyname[FLEN_KEYWORD], comm[FLEN_COMMENT], sval[FLEN_VALUE];
    610   long lval;
     610  LONGLONG lval;
    611611  double dval;
    612612  string s;
     
    621621  case MuTyV::MTVInteger :
    622622    lval = mtv.GetIntPart();
    623     fits_write_key(FitsPtr(), TLONG, keyname, &lval, comm, &status);
     623    fits_write_key(FitsPtr(), TLONGLONG, keyname, &lval, comm, &status);
    624624    break;
    625625  case MuTyV::MTVFloat :
  • trunk/SophyaExt/FitsIOServer/fitsinoutfile.h

    r3047 r3167  
    117117 //---- IMAGE_HDU manipulation methods
    118118 //! Creates a new HDU of type image (see fits_create_img)
    119  void              CreateImageHDU(int bitpix, int naxis, long* naxes);
     119 void              CreateImageHDU(int bitpix, int naxis, LONGLONG* naxes);
    120120 //! Get information about the current image HDU. - return the image type TBYTE,TINT ...
    121  int               GetImageHDUInfo(int& naxis, long* naxes) const;
     121 int               GetImageHDUInfo(int& naxis, LONGLONG* naxes) const;
    122122
    123123 //---- BINARY_TBL or ASCII_TBL
    124124 //! Return number of rows in a table HDU
    125  long              GetNbRows() const;
     125 LONGLONG          GetNbRows() const;
    126126 //! Return number of columns in a table HDU
    127127 int               GetNbCols() const;
     
    139139 long              GetColInfo(vector<string> & colnames,
    140140                              vector<int> & coltypes,
    141                               vector<long> & repcnt,
    142                               vector<long> & width);
     141                              vector<LONGLONG> & repcnt,
     142                              vector<LONGLONG> & width);
    143143
    144144 //! Defines the extension name for the next table creation
  • trunk/SophyaExt/FitsIOServer/fitslocalmap.cc

    r3047 r3167  
    8787  if (clsnm != "LocalMap") return 0;
    8888 
    89   long naxes[2];
     89  LONGLONG naxes[2];
    9090  int naxis=2;
    9191  int imgtyp = is.GetImageHDUInfo(naxis, naxes);
  • trunk/SophyaExt/FitsIOServer/fitsmanager.cc

    r2932 r3167  
    194194    int hdutyp = is.CurrentHDUType();
    195195    if (hdutyp == IMAGE_HDU) {
    196       long naxes[5] = {0,0,0,0,0};
     196      LONGLONG naxes[5] = {0,0,0,0,0};
    197197      int naxis=5;
    198198      int imgtyp = is.GetImageHDUInfo(naxis, naxes);
     
    207207      vector<string> colnames;
    208208      vector<int> coltypes;
    209       vector<long> repcnt;
    210       vector<long> width;
     209      vector<LONGLONG> repcnt, width;
    211210      int ncols = is.GetColInfo(colnames, coltypes, repcnt, width);
    212211      if (hdutyp == BINARY_TBL) os << ">> BINARY_TBL :  NRows= " << is.GetNbRows();
  • trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc

    r3047 r3167  
    9898  vector<string> colnames;
    9999  vector<int> coltypes;
    100   vector<long> repcnt;
    101   vector<long> width;
     100  vector<LONGLONG> repcnt, width;
    102101  long ncols = is.GetColInfo(colnames, coltypes, repcnt, width);
    103102  if (ncols < 1) return 0;
  • trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.cc

    r2974 r3167  
    9090  vector<string> colnames;
    9191  vector<int> coltypes;
    92   vector<long> repcnt;
    93   vector<long> width;
     92  vector<LONGLONG> repcnt, width;
    9493  long ncols = is.GetColInfo(colnames, coltypes, repcnt, width);
    9594  if (ncols < 1) return 0;
  • trunk/SophyaExt/FitsIOServer/fitsswapper.h

    r3069 r3167  
    6262  {
    6363    /* fios->MoveAbsToHDU(fhdu);  On suppose qu'on est sur le bon HDU - Reza 30/12/2005 */
    64     long row = rowos;
     64    LONGLONG row = rowos;
    6565    if (osw)  row = oswp;
    6666    if (dtp != NULL)
     
    7373  virtual void  ReadFromSwap(int_8 idx, int_8 swp, T* d, size_t sz)
    7474  {
    75     long nrows = fios.GetNbRows();
     75    int_8 nrows = fios.GetNbRows();
    7676    size_t szi = sz;
    7777    if ((swp+sz-1) > nrows) sz = nrows-swp+1; 
     
    9494  FitsInOutFile fios;
    9595  int fcol;
    96   long rowos;
     96  LONGLONG rowos;
    9797  BaseDataTable* dtp;
    9898};
Note: See TracChangeset for help on using the changeset viewer.