IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6300


Ignore:
Timestamp:
Feb 1, 2006, 7:43:36 PM (20 years ago)
Author:
jhoblitt
Message:

complete implementation of -update (will need to be changed to reflect new design)

File:
1 edited

Legend:

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

    r6286 r6300  
    66static bool updateMode(pxConfig *config);
    77static psArray *newFrameSearchPending(pxConfig *config);
     8static p1PendingExpRow *newToP1PendingExp(newExpRow *newExp);
     9static p2PendingExpRow *newToP2PendingExp(newExpRow *newExp);
    810
    911int main(int argc, char **argv)
     
    5557
    5658    psArray *new = newFrameSearchPending(config);
     59    if (!new) {
     60        psError(PS_ERR_UNKNOWN, false, "no newFrames found");
     61        return true;
     62    }
    5763
    5864    // insert 'new' rawScience & detrendframes
     
    7379                }
    7480            }
     81           
     82            // lookup camera name in p0CameraConfig
     83            psMetadata *where = psMetadataAlloc();
     84            //bool status = false;
     85            psMetadataAddStr(where, PS_LIST_TAIL, "camera", 0, NULL,
     86                newFrame->exposure->camera);
     87            psArray *configs = p0CameraConfigSelectRowObjects(config->database, where, MAX_ROWS);
     88            psFree(where);
     89            // if there is no match then we default to sending into into p2
     90            if (!configs) {
     91                // convert newFrame->exposure to p2PendingExp
     92                p2PendingExpRow *p2PendingExp = newToP2PendingExp(
     93                    newFrame->exposure
     94                );
     95                p2PendingExpInsertObject(config->database, p2PendingExp);
     96                psFree(p2PendingExp);
     97                continue;
     98            }
     99
     100            // only use the first match
     101            int pX = ((p0CameraConfigRow *)configs->data[0])->phase;
     102            switch (pX) {
     103                case 1:
     104                    // convert newFrame->exposure to p1PendingExp
     105                {
     106                    p1PendingExpRow *p1PendingExp = newToP1PendingExp(
     107                        newFrame->exposure
     108                    );
     109                    p1PendingExpInsertObject(config->database, p1PendingExp);
     110                    psFree(p1PendingExp);
     111                }
     112                    break;
     113                case 2:
     114                    // convert newFrame->exposure to p2PendingExp
     115                {
     116                    p2PendingExpRow *p2PendingExp = newToP2PendingExp(
     117                        newFrame->exposure
     118                    );
     119                    p2PendingExpInsertObject(config->database, p2PendingExp);
     120                    psFree(p2PendingExp);
     121                }
     122                    break;
     123                default:
     124                    // XXX add argv[0] to pxConfig
     125                    psAbort("foo", "invalid phase (this should not happen)");
     126            }
     127
     128            psFree(configs);
    75129        }
     130        psFree(new);
    76131    }
    77132
     
    141196    return new;
    142197}
     198
     199
     200static p1PendingExpRow *newToP1PendingExp(newExpRow *newExp)
     201{
     202    return p1PendingExpRowAlloc(
     203        newExp->exp_id,
     204        newExp->camera,
     205        newExp->exp_type,
     206        newExp->filter,
     207        newExp->class,
     208        newExp->nclass,
     209        newExp->stats,
     210        0 // XXX calc version number
     211    );
     212}
     213
     214static p2PendingExpRow *newToP2PendingExp(newExpRow *newExp)
     215{
     216    return p2PendingExpRowAlloc(
     217        newExp->exp_id,
     218        newExp->camera,
     219        newExp->exp_type,
     220        newExp->filter,
     221        newExp->class,
     222        newExp->nclass,
     223        newExp->stats,
     224        0, // XXX calc version number
     225        0 // XXX calc version number
     226    );
     227}
Note: See TracChangeset for help on using the changeset viewer.