Changeset 7422 for trunk/ippTools/src/dettool.c
- Timestamp:
- Jun 7, 2006, 5:39:15 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/dettool.c (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r7421 r7422 27 27 static bool addresidexpMode(pxConfig *config); 28 28 static bool residexpMode(pxConfig *config); 29 static bool addmasterframeMode(pxConfig *config);29 static bool declaremasterframeMode(pxConfig *config); 30 30 static bool masterframeMode(pxConfig *config); 31 31 static bool masterMode(pxConfig *config); … … 62 62 MODECASE(DETTOOL_MODE_ADDRESIDEXP, addresidexpMode); 63 63 MODECASE(DETTOOL_MODE_RESIDEXP, residexpMode); 64 MODECASE(DETTOOL_MODE_ ADDMASTERFRAME, addmasterframeMode);64 MODECASE(DETTOOL_MODE_DECLAREMASTERFRAME, declaremasterframeMode); 65 65 MODECASE(DETTOOL_MODE_MASTERFRAME, masterframeMode); 66 66 MODECASE(DETTOOL_MODE_MASTER, masterMode); … … 83 83 84 84 // what type of detRun is this? 85 // det_type & iteration arerequired85 // det_type is required 86 86 psString det_type = psMetadataLookupStr(&status, config->args, "-det_type"); 87 87 if (!status) { … … 93 93 return false; 94 94 } 95 psS32 iteration = psMetadataLookupS32(&status, config->args, "-iteration");96 if (!status) {97 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -iteration");98 return false;99 }100 if (!iteration) {101 psError(PS_ERR_UNKNOWN, true, "-iteration is required");102 return false;103 }104 95 105 96 // start a transaction so we don't end up with orphaned det_ids … … 161 152 162 153 // check that the specified exp_ids actually exist 163 psArray * rawExps = rawDetrendExpSelectRowObjects(config->dbh, where, 0);154 psArray *detrendExps = rawDetrendExpSelectRowObjects(config->dbh, where, 0); 164 155 psFree(where); 165 if (! rawExps) {156 if (!detrendExps) { 166 157 psError(PS_ERR_UNKNOWN, false, "no rawDetrendExp rows found"); 167 158 // rollback … … 173 164 174 165 if (item->type == PS_DATA_METADATA_MULTI) { 175 // we should have one raw Exp row be exp_id specified176 if (psListLength(item->data.list) != psArrayLength( rawExps)) {166 // we should have one rawDetrendExp row be exp_id specified 167 if (psListLength(item->data.list) != psArrayLength(detrendExps)) { 177 168 // rollback 178 169 if (!psDBRollback(config->dbh)) { … … 180 171 } 181 172 psAbort(config->argv[0], 182 "an -exp_id matched more then one raw Exp (this should not happen");173 "an -exp_id matched more then one rawDetrendExp (this should not happen"); 183 174 184 175 } 185 176 } else { 186 177 // we should have matched only one exp_id 187 if (psArrayLength( rawExps) != 1) {178 if (psArrayLength(detrendExps) != 1) { 188 179 // rollback 189 180 if (!psDBRollback(config->dbh)) { … … 191 182 } 192 183 psAbort(config->argv[0], 193 " an -exp_id matched more then one rawExp (this should not happen");194 } 195 } 196 197 // create new detInputExp row(s) from the raw Exp row(s)198 psArray *inputExps = psArrayAlloc(psArrayLength( rawExps));199 for (long i = 0; i < psArrayLength( rawExps); i++) {184 "-exp_id matched more then one rawDetrendExp (this should not happen"); 185 } 186 } 187 188 // create new detInputExp row(s) from the rawDetrendExp row(s) 189 psArray *inputExps = psArrayAlloc(psArrayLength(detrendExps)); 190 for (long i = 0; i < psArrayLength(detrendExps); i++) { 200 191 detInputExpRow *inputExp = rawDetrenTodetInputExpRow( 201 rawExps->data[i],192 detrendExps->data[i], 202 193 det_id, 203 iteration194 0 // the first iteration is explicitly 0 204 195 ); 205 196 psArrayAdd(inputExps, 0, inputExp); … … 780 771 return false; 781 772 } 782 psS32 iteration = psMetadataLookupS32(&status, config->args, "-iteration");783 if (!status) {784 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -iteration");785 return false;786 }787 if (!iteration) {788 psError(PS_ERR_UNKNOWN, true, "-iteration is required");789 return false;790 }791 773 psString class_id = psMetadataLookupStr(&status, config->args, "-class_id"); 792 774 if (!status) { … … 823 805 if (!recipe) { 824 806 psError(PS_ERR_UNKNOWN, true, "-recipe is required"); 807 return false; 808 } 809 810 // iteration has a default value 811 psS32 iteration = psMetadataLookupS32(&status, config->args, "-iteration"); 812 if (!status) { 813 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -iteration"); 825 814 return false; 826 815 } … … 1081 1070 psMetadata *where = psMetadataAlloc(); 1082 1071 for (long i = 0; i < psArrayLength(inputExps); i++) { 1083 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", 1072 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 1073 PS_META_DUPLICATE_OK, "==", 1084 1074 ((detInputExpRow *)inputExps->data[i])->exp_id)) { 1085 1075 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); … … 1115 1105 return false; 1116 1106 } 1117 psS32 iteration = psMetadataLookupS32(&status, config->args, "-iteration");1118 if (!status) {1119 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -iteration");1120 return false;1121 }1122 if (!iteration) {1123 psError(PS_ERR_UNKNOWN, true, "-iteration is required");1124 return false;1125 }1126 1107 psString class_id = psMetadataLookupStr(&status, config->args, "-class_id"); 1127 1108 if (!status) { … … 1142 1123 return false; 1143 1124 } 1125 psString stats = psMetadataLookupStr(&status, config->args, "-stats"); 1126 if (!status) { 1127 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -stats"); 1128 return false; 1129 } 1130 if (!stats) { 1131 psError(PS_ERR_UNKNOWN, true, "-stats is required"); 1132 return false; 1133 } 1144 1134 psString recipe = psMetadataLookupStr(&status, config->args, "-recipe"); 1145 1135 if (!status) { … … 1151 1141 return false; 1152 1142 } 1153 psString stats = psMetadataLookupStr(&status, config->args, "-stats"); 1154 if (!status) { 1155 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -stats"); 1156 return false; 1157 } 1158 if (!stats) { 1159 psError(PS_ERR_UNKNOWN, true, "-stats is required"); 1143 1144 // iteration has a default value 1145 psS32 iteration = psMetadataLookupS32(&status, config->args, "-iteration"); 1146 if (!status) { 1147 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -iteration"); 1160 1148 return false; 1161 1149 } … … 1242 1230 psArray *residImfiles = detResidImfileAnalysisSelectRowObjects(config->dbh, 1243 1231 config->where, 0); 1244 if (!residImfiles) {1245 psError(PS_ERR_UNKNOWN, false, "no detResidImfileAnalysis rows found");1246 return false;1247 }1248 1249 1232 if (residImfiles) { 1250 1233 for (long i = 0; i < psArrayLength(normalizedImfiles); i++) { … … 1386 1369 return false; 1387 1370 } 1388 psS32 iteration = psMetadataLookupS32(&status, config->args, "-iteration");1389 if (!status) {1390 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -iteration");1391 return false;1392 }1393 if (!iteration) {1394 psError(PS_ERR_UNKNOWN, true, "-iteration is required");1395 return false;1396 }1397 1371 psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id"); 1398 1372 if (!status) { … … 1429 1403 if (!recipe) { 1430 1404 psError(PS_ERR_UNKNOWN, true, "-recipe is required"); 1405 return false; 1406 } 1407 1408 // iteration has a default value 1409 psS32 iteration = psMetadataLookupS32(&status, config->args, "-iteration"); 1410 if (!status) { 1411 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -iteration"); 1431 1412 return false; 1432 1413 } … … 1550 1531 return false; 1551 1532 } 1552 psS32 iteration = psMetadataLookupS32(&status, config->args, "-iteration");1553 if (!status) {1554 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -iteration");1555 return false;1556 }1557 if (!iteration) {1558 psError(PS_ERR_UNKNOWN, true, "-iteration is required");1559 return false;1560 }1561 1533 psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id"); 1562 1534 if (!status) { … … 1584 1556 if (!recipe) { 1585 1557 psError(PS_ERR_UNKNOWN, true, "-recipe is required"); 1558 return false; 1559 } 1560 1561 // iteration has a default value 1562 psS32 iteration = psMetadataLookupS32(&status, config->args, "-iteration"); 1563 if (!status) { 1564 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -iteration"); 1586 1565 return false; 1587 1566 } … … 1676 1655 } 1677 1656 1678 static bool addmasterframeMode(pxConfig *config)1657 static bool declaremasterframeMode(pxConfig *config) 1679 1658 { 1680 1659 PS_ASSERT_PTR_NON_NULL(config, false); … … 1691 1670 return false; 1692 1671 } 1693 psString iteration = psMetadataLookupStr(&status, config->args, "-iteration"); 1672 1673 // iteration has a default value 1674 psS32 iteration = psMetadataLookupS32(&status, config->args, "-iteration"); 1694 1675 if (!status) { 1695 1676 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -iteration"); 1696 return false;1697 }1698 if (!iteration) {1699 psError(PS_ERR_UNKNOWN, true, "-iteration is required");1700 1677 return false; 1701 1678 } … … 1710 1687 detMasterFrameRow *masterFrame = detMasterFrameRowAlloc( 1711 1688 (psS32)atol(det_id), 1712 (psS32)atol(iteration),1689 iteration, 1713 1690 comment // may be NULL 1714 1691 ); … … 1777 1754 psMetadata *output = psMetadataAlloc(); 1778 1755 for (long i = 0; i < psArrayLength(normalizedImfiles); i++) { 1779 psMetadata *md = det MasterFrameMetadataFromObject(1756 psMetadata *md = detNormalizedImfileMetadataFromObject( 1780 1757 normalizedImfiles->data[i]); 1781 1758 psMetadataAddMetadata(
Note:
See TracChangeset
for help on using the changeset viewer.
