IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23354


Ignore:
Timestamp:
Mar 17, 2009, 12:31:09 PM (17 years ago)
Author:
Paul Price
Message:

Allow pmFPAfileDefineFromRun to bind to a file. Added new function, pmFPAfileDefineMultipleFromRun, to define multiple files (of the same file rule name, but differing filenames) from the RUN metadata. This is intended for ppStack; might also be useful for ppMerge if we want it to support update.

Location:
trunk/psModules/src/camera
Files:
2 edited

Legend:

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

    r23343 r23354  
    719719}
    720720
    721 pmFPAfile *pmFPAfileDefineFromRun(bool *success, pmConfig *config, const char *filename)
     721pmFPAfile *pmFPAfileDefineFromRun(bool *success, pmFPAfile *bind, pmConfig *config, const char *filename)
    722722{
    723723    PS_ASSERT_PTR_NON_NULL(config, NULL);
     
    732732    }
    733733
    734     pmFPAfile *file = fpaFileDefineFromArray(config, NULL, filename, filenames); // File of interest
     734    pmFPAfile *file = fpaFileDefineFromArray(config, bind, filename, filenames); // File of interest
    735735    psFree(filenames);
    736736
     
    742742}
    743743
     744psArray *pmFPAfileDefineMultipleFromRun(bool *success, psArray *bind, pmConfig *config, const char *filename)
     745{
     746    PS_ASSERT_PTR_NON_NULL(config, NULL);
     747    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
     748
     749    if (success) {
     750        *success = false;
     751    }
     752
     753    psArray *files = pmConfigRunFileGet(config, filename); // Filenames used, to return
     754    if (!files || files->n == 0) {
     755        if (success) {
     756            *success = true;
     757        }
     758        return NULL;
     759    }
     760    if (bind && files->n != bind->n) {
     761        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
     762                "Length of filenames (%ld) and bind files (%ld) does not match.",
     763                files->n, bind->n);
     764        psFree(files);
     765        return NULL;
     766    }
     767
     768    psArray *dummy = psArrayAlloc(1);   // Dummy array of single filename
     769    for (int i = 0; i < files->n; i++) {
     770        psFree(dummy->data[0]);
     771        dummy->data[0] = files->data[i];
     772        pmFPAfile *bindFile = bind ? bind->data[i] : NULL; // File to which to bind
     773        files->data[i] = psMemIncrRefCounter(fpaFileDefineFromArray(config, bindFile, filename, dummy));
     774        if (!files->data[i]) {
     775            psError(PS_ERR_UNKNOWN, false, "Unable to define file %s %d", filename, i);
     776            psFree(dummy);
     777            psFree(files);
     778            return NULL;
     779        }
     780    }
     781    psFree(dummy);
     782
     783    if (success) {
     784        *success = true;
     785    }
     786
     787    return files;
     788}
    744789
    745790// define the named pmFPAfile from the camera->config
  • trunk/psModules/src/camera/pmFPAfileDefine.h

    r23268 r23354  
    6767pmFPAfile *pmFPAfileDefineFromRun(
    6868    bool *found,                        ///< Found files?
     69    pmFPAfile *bind,                    ///< File to which to bind, or NULL
    6970    pmConfig *config,                   ///< Configuration
    7071    const char *filename                ///< Name of file
    7172    );
    7273
     74/// Define multiple files based on the filenames in the RUN metadata in the configuration
     75///
     76/// An array of the files defined is returned
     77psArray *pmFPAfileDefineMultipleFromRun(
     78    bool *found,                        ///< Found files?
     79    psArray *bind,                      ///< Files to which to bind, or NULL
     80    pmConfig *config,                   ///< Configuration
     81    const char *filename                ///< Name of file
     82    );
    7383
    7484// look for the given argname on the argument list.  find the give filename from the file rules
Note: See TracChangeset for help on using the changeset viewer.