Changeset 1231 for cpp/frams/genetics/f4/f4_conv.cpp
- Timestamp:
- 05/02/23 01:36:15 (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/f4/f4_conv.cpp
r1227 r1231 27 27 SString GenoConv_f40::convert(SString &in, MultiMap *map, bool using_checkpoints) 28 28 { 29 int res;30 29 f4_Model *model = new f4_Model(); 31 res = model->buildFromF4(in, using_checkpoints);32 if ( GENOPER_OK != res)30 int res = model->buildFromF4(in, using_checkpoints); 31 if (res != GENOPER_OK) 33 32 { 34 33 delete model; … … 55 54 SString GenoConv_F41_TestOnly::convert(SString &in, MultiMap *map, bool using_checkpoints) 56 55 { 57 int res;58 56 f4_Model *model = new f4_Model(); 59 res = model->buildFromF4(in, using_checkpoints);60 if ( GENOPER_OK != res)57 int res = model->buildFromF4(in, using_checkpoints); 58 if (res != GENOPER_OK) 61 59 { 62 60 delete model; … … 82 80 int f4_Model::buildFromF4(SString &geno, bool using_checkpoints) 83 81 { 84 int i;85 86 82 error = GENOPER_OK; 87 83 errorpos = -1; 88 84 85 // transform geno from string to nodes 86 f4_Node f4rootnode; 87 int res = f4_process(geno.c_str(), &f4rootnode); 88 if (res || (f4rootnode.childCount() != 1)) //consider any error fatal, preventing building a model 89 { 90 error = GENOPER_OPFAIL; 91 errorpos = res; 92 return error; 93 } 94 89 95 // build cells, and simulate 90 96 if (cells) delete cells; 91 cells = new f4_Cells( geno, 0);92 if ( GENOPER_OK != cells->getErrorCode())97 cells = new f4_Cells(f4rootnode.child, false); 98 if (cells->getErrorCode() != GENOPER_OK) 93 99 { 94 100 error = cells->getErrorCode(); … … 99 105 100 106 cells->simulate(); 101 if ( GENOPER_OK != cells->getErrorCode())107 if (cells->getErrorCode() != GENOPER_OK) 102 108 { 103 109 error = cells->getErrorCode(); … … 107 113 108 114 // reset recursive traverse flags 109 for (i = 0; i < cells->cell_count; i++)115 for (int i = 0; i < cells->cell_count; i++) 110 116 cells->C[i]->recProcessedFlag = 0; 111 117 … … 113 119 114 120 // process every cell 115 int res; 116 for (i = 0; i < cells->cell_count; i++) 117 { 118 res = buildModelRec(cells->C[i]); 121 for (int i = 0; i < cells->cell_count; i++) 122 { 123 int res = buildModelRec(cells->C[i]); 119 124 if (res) 120 125 { 121 log Message("f4_Model", "buildFromF4", LOG_ERROR, "Error in building a Model");126 logPrintf("f4_Model", "buildFromF4", LOG_ERROR, "Error %d when building a Model", res); 122 127 error = res; 123 128 break; … … 125 130 } 126 131 127 res = close(); 128 if (0 == res) // invalid 132 int res_close = close(); 133 if (res_close == 0) // invalid 134 { 135 logPrintf("f4_Model", "buildFromF4", LOG_ERROR, "Error %d when closing a Model", res_close); 129 136 error = -10; 137 } 130 138 131 139 return error;
Note: See TracChangeset
for help on using the changeset viewer.