Changeset 7058 for trunk/ippTools/src/dettool.c
- Timestamp:
- May 3, 2006, 3:25:27 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/dettool.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r7048 r7058 6 6 7 7 #include "pxtools.h" 8 #include " p1search.h"8 #include "dettool.h" 9 9 10 static bool pendingMode(pxConfig *config);11 10 static bool defineMode(pxConfig *config); 12 static p1PendingExpRow *rawScienceTop1PendingExp(pxConfig *config, rawScienceExpRow *raw); 11 static bool rawMode(pxConfig *config); 12 static bool addprocMode(pxConfig *config); 13 static bool procMode(pxConfig *config); 14 static bool addstacMode(pxConfig *config); 15 static bool stacMode(pxConfig *config); 13 16 14 17 int main(int argc, char **argv) 15 18 { 16 pxConfig *config = p1searchConfig(NULL, argc, argv);19 pxConfig *config = dettoolConfig(NULL, argc, argv); 17 20 18 21 switch (config->mode) { 19 case PX_MODE_PENDING:20 if (! pendingMode(config)) {22 case DETTOOL_MODE_DEFINE: 23 if (!defineMode(config)) { 21 24 goto FAIL; 22 25 } 23 26 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)) { 26 49 goto FAIL; 27 50 } … … 38 61 } 39 62 40 static bool pendingMode(pxConfig *config)63 static bool defineMode(pxConfig *config) 41 64 { 42 65 PS_ASSERT_PTR_NON_NULL(config, false); 43 44 // return all p1PendingExp rows unless there CLI search options45 psArray *p1PendingExp = p1PendingExpSelectRowObjects(46 config->dbh,47 config->where ? config->where : NULL,48 049 );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);69 66 70 67 return true; 71 68 } 72 69 73 static bool defineMode(pxConfig *config)70 static bool rawMode(pxConfig *config) 74 71 { 75 72 PS_ASSERT_PTR_NON_NULL(config, false); 76 77 // return all rawScienceExp rows unless there CLI search options78 psArray *rawScienceExps = rawScienceExpSelectRowObjects(79 config->dbh,80 config->where ? config->where : NULL,81 082 );83 84 if (!rawScienceExps) {85 psError(PS_ERR_UNKNOWN, false, "no rawScienceExp rows found");86 return true;87 }88 89 // insert the rawScienceExps into p1PendingExp90 // XXX for the being we're going to skip checking for duplicate entries91 // XXX this will have to implimented unless duplicate key insertion92 // XXX support is implimented in psDB93 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 }102 73 103 74 return true; 104 75 } 105 76 106 static p1PendingExpRow *rawScienceTop1PendingExp(pxConfig *config, rawScienceExpRow *raw)77 static bool addprocMode(pxConfig *config) 107 78 { 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; 120 82 } 83 84 static bool procMode(pxConfig *config) 85 { 86 PS_ASSERT_PTR_NON_NULL(config, false); 87 88 return true; 89 } 90 91 static bool addstacMode(pxConfig *config) 92 { 93 PS_ASSERT_PTR_NON_NULL(config, false); 94 95 return true; 96 } 97 98 static 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.
