IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7175


Ignore:
Timestamp:
May 22, 2006, 4:26:27 PM (20 years ago)
Author:
jhoblitt
Message:

complete masterframeMode()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/dettool.c

    r7174 r7175  
    504504        if (!valid) {
    505505            psError(PS_ERR_UNKNOWN, true,
    506         "class_id %s does not corespond to on contained in an detInputExp",
    507             ((detStackedImfileRow *)stackedImfiles->data[i])->class_id);
     506                "class_id %s does not corespond to a detInputExp",
     507                ((detStackedImfileRow *)stackedImfiles->data[i])->class_id);
    508508            psFree(stackedImfiles);
    509509            psFree(valid_class_ids);
     
    701701{
    702702    PS_ASSERT_PTR_NON_NULL(config, false);
     703   
     704    // det_id is required
     705    bool status = false;
     706    psString det_id = psMetadataLookupStr(&status, config->args, "-det_id");
     707    if (!status) {
     708        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -det_id");
     709        return false;
     710    }
    703711
    704712    // find all detMasterIImfile for det_id
     
    708716    if (!masterImfiles) {
    709717        psError(PS_ERR_UNKNOWN, false, "no detMasterImfile rows found");
    710         return NULL;
    711     }
    712 
    713     return true;
    714 }
     718        return false;
     719    }
     720
     721    // find all input class_ids
     722    psArray *valid_class_ids = validDetInputClassIds(config, det_id);
     723    if (!valid_class_ids) {
     724        psError(PS_ERR_UNKNOWN, false, "no detInputExp imfile class_ids found");
     725        return false;
     726    }
     727 
     728    // check class_ids for validity
     729    for (long i = 0; i < psArrayLength(masterImfiles); i++) {
     730        bool valid = false;
     731        for (long j = 0; j < psArrayLength(valid_class_ids); j++) {
     732            if (strcmp(((detMasterImfileRow *)masterImfiles->data[i])->class_id,
     733                   (char *)valid_class_ids->data[j]) == 0) {
     734                valid = true;
     735                if (!psArrayRemove(valid_class_ids, valid_class_ids->data[j])) {
     736                    psError(PS_ERR_UNKNOWN, false, "psArrayRemove() failed");
     737                    psFree(masterImfiles);
     738                    psFree(valid_class_ids);
     739                    return false;
     740                }
     741                j--; // must update loop index
     742            }
     743        }
     744        if (!valid) {
     745            psError(PS_ERR_UNKNOWN, true,
     746        "class_id %s does not corespond to a detInputExp",
     747            ((detMasterImfileRow *)masterImfiles->data[i])->class_id);
     748            psFree(masterImfiles);
     749            psFree(valid_class_ids);
     750            return false;
     751        }
     752    }
     753
     754    // if we nade it this far we must have a complete frame
     755
     756    // print detMasterImfiles
     757    psMetadata *output = psMetadataAlloc();
     758    for (long i = 0; i < psArrayLength(masterImfiles); i++) {
     759        psMetadata *md = detStackedImfileMetadataFromObject(
     760                masterImfiles->data[i]);
     761        psMetadataAddMetadata(
     762            output, PS_LIST_TAIL, "detMasterImfile", PS_META_DUPLICATE_OK,
     763            NULL, md
     764        );
     765    }
     766
     767    psString str = psMetadataConfigFormat(output);
     768    psFree(output);
     769    fprintf(stdout, "%s\n", str);
     770    psFree(str);
     771
     772    return true;
     773}
Note: See TracChangeset for help on using the changeset viewer.