IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 28, 2011, 4:12:43 PM (15 years ago)
Author:
rhenders
Message:

Added some new getter methods

File:
1 edited

Legend:

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

    r31033 r31070  
    6666}
    6767
    68 
    6968/**
    7069  Gets a value from the 'init' data
     
    108107}
    109108
    110 /*
     109/**
     110   Gets model fit ID from name
     111   */
     112static bool getModelFitId(InitData* this, const char* name, int8_t* id) {
     113
     114    char buffer[10];
     115    if (!getInitValue(this, "FitModel", "name", name, "fitModelID", buffer)) {
     116
     117        *id = -1;
     118        return false;
     119    }
     120
     121    *id = atoi(buffer);
     122    return true;
     123}
     124
     125/**
    111126   Gets survey ID from survey name
    112127   */
    113 static bool getSurveyId(InitData* this, const char* surveyType, int8_t* surveyId) {
     128static bool getSurveyId(InitData* this, const char* name, int8_t* id) {
    114129
    115130    char buffer[10];
    116     if (!getInitValue(this, "Survey", "name", surveyType, "surveyID", buffer)) {
    117 
    118         *surveyId = -1;
    119         return false;
    120     }
    121 
    122     *surveyId = atoi(buffer);
    123     return true;
    124 }
    125 
    126 /*
    127    Gets filter ID from filter type
    128    */
    129 static bool getFilterId(InitData* this, const char* filterType, int8_t* filterId) {
     131    if (!getInitValue(this, "Survey", "name", name, "surveyID", buffer)) {
     132
     133        *id = -1;
     134        return false;
     135    }
     136
     137    *id = atoi(buffer);
     138    return true;
     139}
     140
     141/**
     142   Gets stack type ID from stack type string
     143   */
     144static bool getStackTypeId(InitData* this, const char* type, int8_t* id) {
     145
     146    char buffer[20];
     147    if (!getInitValue(this, "StackType", "stackType", type, "stackTypeID", buffer)) {
     148
     149        *id = -1;
     150        return false;
     151    }
     152
     153    *id = atoi(buffer);
     154    return true;
     155}
     156
     157/**
     158   Gets filter ID from filter type string
     159   */
     160static bool getFilterId(InitData* this, const char* type, int8_t* id) {
    130161
    131162    char tmp[2];
    132     strncpy(tmp,filterType,1);
     163    strncpy(tmp, type,1);
    133164    tmp[1] = '\0';
    134165    char buffer[10];
    135166    if (!getInitValue(this, "Filter", "filterType", tmp, "filterID", buffer)) {
    136167
    137         *filterId = -1;
    138         return false;
    139     }
    140 
    141     *filterId = atoi(buffer);
     168        *id = -1;
     169        return false;
     170    }
     171
     172    *id = atoi(buffer);
    142173    return true;
    143174}
     
    186217    this->getFilterId = getFilterId;
    187218    this->getSurveyId = getSurveyId;
     219    this->getStackTypeId = getStackTypeId;
     220    this->getModelFitId = getModelFitId;
    188221    this->destroy = destroy;
    189222
Note: See TracChangeset for help on using the changeset viewer.