IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31016 for trunk/ippToPsps/src


Ignore:
Timestamp:
Mar 23, 2011, 9:53:44 AM (15 years ago)
Author:
rhenders
Message:

Added non-class utility method to Fits class for getting FITS data type from string

Location:
trunk/ippToPsps/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/src/Config.c

    r31015 r31016  
    44 *
    55 *  @author IfA
    6  *  Copyright 2009 Institute for Astronomy, University of Hawaii
     6 *  Copyright 2011 Institute for Astronomy, University of Hawaii
    77 */
    88
     
    1313
    1414#include "Fits.h"
    15 
    16 /**
    17    Gets PS type from string TODO FITS types? should be in Fits class
    18    */
    19 static int ippToPsps_GetDataType(char *typename) {
    20 
    21     if (!strncmp(typename, "TBYTE", 5))  return TBYTE;
    22     if (!strncmp(typename, "TSHORT", 6)) return TSHORT;
    23     if (!strncmp(typename, "TLONGLONG", 9)) return TLONGLONG;
    24     if (!strncmp(typename, "TLONG", 5)) return TLONG;
    25     if (!strncmp(typename, "TFLOAT", 6)) return TFLOAT;
    26     if (!strncmp(typename, "TDOUBLE", 7)) return TDOUBLE;
    27     if (!strncmp(typename, "TSTRING", 7)) return TSTRING;
    28 
    29     psError(PS_ERR_IO, false, "Don't understand type '%s'", typename);
    30 
    31     return 0;
    32 }
    3315
    3416/**
     
    385367        // column type
    386368        getAttribute(node, "type", buffer);
    387         table->columns[columnNum].pspsType = ippToPsps_GetDataType(buffer);
     369        table->columns[columnNum].pspsType = Fits_getDataType(buffer);
    388370
    389371        // default value
     
    514496                // IPP type
    515497                getAttribute(node, "ippType", buffer);
    516                 column->ippType = ippToPsps_GetDataType(buffer);
     498                column->ippType = Fits_getDataType(buffer);
    517499
    518500                column->usingDefault = false;
  • trunk/ippToPsps/src/Config.h

    r31015 r31016  
    66 *
    77 *  @author IfA
    8  *  Copyright 2009 Institute for Astronomy, University of Hawaii
     8 *  Copyright 2011 Institute for Astronomy, University of Hawaii
    99 */
    1010
  • trunk/ippToPsps/src/Fits.c

    r31010 r31016  
    66 *
    77 *  @author IfA
    8  *  Copyright 2009 Institute for Astronomy, University of Hawaii
     8 *  Copyright 2011 Institute for Astronomy, University of Hawaii
    99 */
    1010
    1111#include "Fits.h"
     12
     13/**
     14  Non-class method
     15
     16  Gets cfitsio type from string
     17  */
     18int Fits_getDataType(char *typename) {
     19
     20    if (!strncmp(typename, "TBYTE", 5))  return TBYTE;
     21    if (!strncmp(typename, "TSHORT", 6)) return TSHORT;
     22    if (!strncmp(typename, "TLONGLONG", 9)) return TLONGLONG;
     23    if (!strncmp(typename, "TLONG", 5)) return TLONG;
     24    if (!strncmp(typename, "TFLOAT", 6)) return TFLOAT;
     25    if (!strncmp(typename, "TDOUBLE", 7)) return TDOUBLE;
     26    if (!strncmp(typename, "TSTRING", 7)) return TSTRING;
     27
     28    psError(PS_ERR_IO, false, "* Fits: Don't understand data type '%s'", typename);
     29
     30    return 0;
     31}
    1232
    1333/**
  • trunk/ippToPsps/src/Fits.h

    r31010 r31016  
    2727    // accessor methods
    2828    fitsfile* (*getFilePtr)();
     29    int (*getDataType)();
    2930    char* (*getPath)();
    3031    bool (*countRows)();
     
    5556Fits* new_Fits(char* path);
    5657
     58// non-class methods
     59int Fits_getDataType(char *typename);
     60
    5761# endif // IPPTOPSPS_FITS_H
Note: See TracChangeset for help on using the changeset viewer.