IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 3, 2006, 3:25:27 PM (20 years ago)
Author:
jhoblitt
Message:

fix dettoolConfig()'s name
stub out modes in dettool.c

File:
1 edited

Legend:

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

    r7048 r7058  
    66
    77#include "pxtools.h"
    8 #include "p1search.h"
     8#include "dettool.h"
    99
    10 static bool pendingMode(pxConfig *config);
    1110static bool defineMode(pxConfig *config);
    12 static p1PendingExpRow *rawScienceTop1PendingExp(pxConfig *config, rawScienceExpRow *raw);
     11static bool rawMode(pxConfig *config);
     12static bool addprocMode(pxConfig *config);
     13static bool procMode(pxConfig *config);
     14static bool addstacMode(pxConfig *config);
     15static bool stacMode(pxConfig *config);
    1316
    1417int main(int argc, char **argv)
    1518{
    16     pxConfig *config = p1searchConfig(NULL, argc, argv);
     19    pxConfig *config = dettoolConfig(NULL, argc, argv);
    1720
    1821    switch (config->mode) {
    19         case PX_MODE_PENDING:
    20             if (!pendingMode(config)) {
     22        case DETTOOL_MODE_DEFINE:
     23            if (!defineMode(config)) {
    2124                goto FAIL;
    2225            }
    2326            break;
    24         case PX_MODE_DEFINE:
    25             if (!defineMode(config)) {
     27        case DETTOOL_MODE_RAW:
     28            if (!rawMode(config)) {
     29                goto FAIL;
     30            }
     31            break;
     32        case DETTOOL_MODE_ADDPROCESSED:
     33            if (!addprocMode(config)) {
     34                goto FAIL;
     35            }
     36            break;
     37        case DETTOOL_MODE_PROCESSED:
     38            if (!procMode(config)) {
     39                goto FAIL;
     40            }
     41            break;
     42        case DETTOOL_MODE_ADDSTACKED:
     43            if (!addstacMode(config)) {
     44                goto FAIL;
     45            }
     46            break;
     47        case DETTOOL_MODE_STACKED:
     48            if (!stacMode(config)) {
    2649                goto FAIL;
    2750            }
     
    3861}
    3962
    40 static bool pendingMode(pxConfig *config)
     63static bool defineMode(pxConfig *config)
    4164{
    4265    PS_ASSERT_PTR_NON_NULL(config, false);
    43 
    44     // return all p1PendingExp rows unless there CLI search options
    45     psArray *p1PendingExp = p1PendingExpSelectRowObjects(
    46         config->dbh,
    47         config->where ? config->where : NULL,
    48         0
    49     );
    50     if (!p1PendingExp) {
    51         psError(PS_ERR_UNKNOWN, false, "no p1PendingExp found");
    52         return false;
    53     }
    54 
    55     psMetadata *output = psMetadataAlloc();
    56 
    57     for (long i = 0; i < psArrayLength(p1PendingExp); i++) {
    58         psMetadata *md = p1PendingExpMetadataFromObject(p1PendingExp->data[i]);
    59         psMetadataAddMetadata(output, PS_LIST_TAIL, "p1PendingExp",
    60             PS_META_DUPLICATE_OK, NULL, md);
    61         psFree(md);
    62     }
    63 
    64     psString str = psMetadataConfigFormat(output);
    65     psFree(output);
    66 
    67     fprintf(stdout, "%s\n", str);
    68     psFree(str);
    6966
    7067    return true;
    7168}
    7269
    73 static bool defineMode(pxConfig *config)
     70static bool rawMode(pxConfig *config)
    7471{
    7572    PS_ASSERT_PTR_NON_NULL(config, false);
    76    
    77     // return all rawScienceExp rows unless there CLI search options
    78     psArray *rawScienceExps = rawScienceExpSelectRowObjects(
    79         config->dbh,
    80         config->where ? config->where : NULL,
    81         0
    82     );
    83 
    84     if (!rawScienceExps) {
    85         psError(PS_ERR_UNKNOWN, false, "no rawScienceExp rows found");
    86         return true;
    87     }
    88 
    89     // insert the rawScienceExps into p1PendingExp
    90     // XXX for the being we're going to skip checking for duplicate entries
    91     // XXX this will have to implimented unless duplicate key insertion
    92     // XXX support is implimented in psDB
    93     for (long i = 0; i < psArrayLength(rawScienceExps); i++) {
    94         p1PendingExpRow * new = rawScienceTop1PendingExp(
    95                                             config, rawScienceExps->data[i]);
    96         if (!p1PendingExpInsertObject(config->dbh, new)) {
    97             psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    98             return false;
    99         }
    100         psFree(new);
    101     }
    10273
    10374    return true;
    10475}
    10576
    106 static p1PendingExpRow *rawScienceTop1PendingExp(pxConfig *config, rawScienceExpRow *raw)
     77static bool addprocMode(pxConfig *config)
    10778{
    108     return p1PendingExpRowAlloc(
    109         raw->exp_id,
    110         raw->camera,
    111         raw->telescope,
    112         raw->exp_type,
    113 //        newExp->class,
    114         raw->imfiles,
    115         raw->filter,
    116         raw->stats,
    117         "my recipe",                    //recipe
    118         0xff                            // XXX calc version number
    119     );
     79    PS_ASSERT_PTR_NON_NULL(config, false);
     80
     81    return true;
    12082}
     83
     84static bool procMode(pxConfig *config)
     85{
     86    PS_ASSERT_PTR_NON_NULL(config, false);
     87
     88    return true;
     89}
     90
     91static bool addstacMode(pxConfig *config)
     92{
     93    PS_ASSERT_PTR_NON_NULL(config, false);
     94
     95    return true;
     96}
     97
     98static bool stacMode(pxConfig *config)
     99{
     100    PS_ASSERT_PTR_NON_NULL(config, false);
     101
     102    return true;
     103}
Note: See TracChangeset for help on using the changeset viewer.