IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 25, 2007, 4:51:48 PM (19 years ago)
Author:
magnier
Message:

changed these functions to return the success/failure value, not to expect an input value

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAfileDefine.c

    r13496 r13525  
    225225// save the pmFPAfile on config->files
    226226// return the pmFPAfile (a view to the one saved on config->files)
    227 pmFPAfile *pmFPAfileDefineFromArgs(bool *found, pmConfig *config, const char *filename, const char *argname)
     227pmFPAfile *pmFPAfileDefineFromArgs(bool *success, pmConfig *config, const char *filename, const char *argname)
    228228{
    229229    PS_ASSERT_PTR_NON_NULL(config, NULL);
     
    238238    psMetadata *format = NULL;
    239239
    240     if (found && *found)
    241         return NULL;
     240    // use success to identify valid exit conditions (as opposed to 'argument not supplied')
     241    if (success) *success = false;
    242242
    243243    // we search the argument data for the named fileset (argname)
    244244    psArray *infiles = psMetadataLookupPtr(&status, config->arguments, argname);
    245245    if (!status) {
     246        if (success) *success = true;
    246247        return NULL;
    247248    }
     
    383384    }
    384385    psFree (fpa);
    385     if (found)
    386         *found = true;
     386    if (success) *success = true;
     387
    387388    return file;
    388389}
     
    394395// save the pmFPAfile on config->files
    395396// return the pmFPAfile (a view to the one saved on config->files)
    396 pmFPAfile *pmFPAfileBindFromArgs (bool *found, pmFPAfile *input, const pmConfig *config, const char *filename, const char *argname)
     397pmFPAfile *pmFPAfileBindFromArgs (bool *success, pmFPAfile *input, const pmConfig *config, const char *filename, const char *argname)
    397398{
    398399    PS_ASSERT_PTR_NON_NULL(input, NULL);
     
    406407    psMetadata *phu = NULL;
    407408
    408     if (found && *found)
    409         return NULL;
     409    // use success to identify valid exit conditions (as opposed to 'argument not supplied')
     410    if (success) *success = false;
    410411
    411412    // we search the argument data for the named fileset (argname)
     
    413414    if (!status) {
    414415        // this is not an error: this just means no matching argument was supplied
     416        if (success) *success = true;
    415417        return NULL;
    416418    }
     
    428430        return NULL;
    429431    }
     432
     433// XXX this hack should now not be needed: the PSF is stored in a MEF fits table file
     434# if (0)
    430435    // XXX temporary hack : force PSF input onto filename
    431436    // XXX EAM : I need to define a PSF container which specifies the chip/cell element
     
    439444        return file;
    440445    }
     446# endif
    441447
    442448    // set derived values
     
    508514        psFree (phu);
    509515    }
    510     if (found)
    511         *found = true;
     516    if (success) *success = true;
    512517    return file;
    513518}
     
    519524// save the pmFPAfiles on config->files
    520525// return the pmFPAfiles (a view to the one saved on config->files)
    521 pmFPAfile *pmFPAfileDefineSingleFromArgs (bool *found, pmConfig *config, const char *filename,
     526pmFPAfile *pmFPAfileDefineSingleFromArgs (bool *success, pmConfig *config, const char *filename,
    522527        const char *argname, int entry)
    523528{
     
    533538    psMetadata *format = NULL;
    534539
    535     if (found && *found)
    536         return NULL;
     540    if (success) *success = false;
    537541
    538542    // we search the argument data for the named fileset (argname)
     
    540544    if (!status) {
    541545        psTrace("psModules.camera", 5, "Failed to find %s in argument list", argname);
     546        if (success) *success = true;
    542547        return NULL;
    543548    }
     
    625630    psFree(format);
    626631
    627     if (found)
    628         *found = true;
     632    if (success) *success = true;
    629633    return file;
    630634}
     
    632636// define the named pmFPAfile from the camera->config
    633637// only valid for pmFPAfile->mode = READ
    634 pmFPAfile *pmFPAfileDefineFromConf (bool *found, const pmConfig *config, const char *filename)
     638pmFPAfile *pmFPAfileDefineFromConf (bool *success, const pmConfig *config, const char *filename)
    635639{
    636640    PS_ASSERT_PTR_NON_NULL(config, false);
    637641    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
    638642
    639     if (found && *found)
    640         return NULL;
     643    if (success) *success = false;
    641644
    642645    // a camera config is needed (as source of file rule)
     
    675678        // don't free the file here: it is left on config->files
    676679        // to be used optionally by pmFPAfileDefineFromDetDB (or others)
     680        if (success) *success = true;
    677681        return NULL;
    678682    }
     
    684688    file->filerule = tmpName;
    685689
    686     if (found)
    687         *found = true;
     690    if (success) *success = true;
     691
    688692    return file;
    689693}
     
    694698// save the pmFPAfile on config->files
    695699// return the pmFPAfile (a view to the one saved on config->files)
    696 pmFPAfile *pmFPAfileDefineFromDetDB (bool *found, const pmConfig *config, const char *filename,
     700pmFPAfile *pmFPAfileDefineFromDetDB (bool *success, const pmConfig *config, const char *filename,
    697701                                     pmFPA *input, pmDetrendType type)
    698702{
     
    707711    pmFPAfile *file = NULL;
    708712
    709     if (found && *found)
    710         return NULL;
     713    if (success) *success = false;
    711714
    712715    // a camera config is needed (as source of file rule)
     
    843846    psFree (options);
    844847
    845     if (found) {
    846         *found = true;
    847     }
     848    if (success) *success = false;
    848849    return file;
    849850}
Note: See TracChangeset for help on using the changeset viewer.