Changeset 3861


Ignore:
Timestamp:
05/20/10 08:31:25 (15 years ago)
Author:
seroussi
Message:

better error message

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/DataSet/Inputs.cpp

    r3857 r3861  
    4848        vector<Object*>::iterator object;
    4949        Input* input=NULL;
    50 
    51         /*Go through inputs and check whether any input with the same name is already in: */
    52         for ( object=objects.begin() ; object < objects.end(); object++ ){
    53 
    54                 input=(Input*)(*object);
    55                 if (input->EnumType()==enum_type)break;
    56         }
    57 
    58         if (!input){
    59                 /*we could not find an input with the correct enum type. No defaults values were provided,
    60                  * error out: */
    61                 ISSMERROR("%s%i"," could not find input with enum type ",enum_type);
     50        bool   found=false;
     51
     52        /*Go through inputs and check whether any input with the same name is already in: */
     53        for ( object=objects.begin() ; object < objects.end(); object++ ){
     54
     55                input=(Input*)(*object);
     56                if (input->EnumType()==enum_type){
     57                        found=true;
     58                        break;
     59                }
     60        }
     61
     62        if (!found){
     63                /*we could not find an input with the correct enum type. No defaults values were provided,
     64                 * error out: */
     65                ISSMERROR("could not find input with enum type %i (%s)",enum_type,EnumAsString(enum_type));
    6266        }
    6367
     
    7276        vector<Object*>::iterator object;
    7377        Input* input=NULL;
    74 
    75         /*Go through inputs and check whether any input with the same name is already in: */
    76         for ( object=objects.begin() ; object < objects.end(); object++ ){
    77 
    78                 input=(Input*)(*object);
    79                 if (input->EnumType()==enum_type)break;
    80         }
    81 
    82         if (!input){
     78        bool   found=false;
     79
     80        /*Go through inputs and check whether any input with the same name is already in: */
     81        for ( object=objects.begin() ; object < objects.end(); object++ ){
     82
     83                input=(Input*)(*object);
     84                if (input->EnumType()==enum_type){
     85                        found=true;
     86                        break;
     87                }
     88        }
     89
     90        if (!found){
    8391                /*we could not find an input with the correct enum type. Return the default value: */
    8492                *pvalue=defaultvalue;
     
    94102        vector<Object*>::iterator object;
    95103        Input* input=NULL;
    96 
    97         /*Go through inputs and check whether any input with the same name is already in: */
    98         for ( object=objects.begin() ; object < objects.end(); object++ ){
    99 
    100                 input=(Input*)(*object);
    101                 if (input->EnumType()==enum_type)break;
    102         }
    103 
    104         if (!input){
    105                 /*we could not find an input with the correct enum type. No defaults values were provided,
    106                  * error out: */
    107                 ISSMERROR("%s%i"," could not find input with enum type ",enum_type);
     104        bool   found=false;
     105
     106        /*Go through inputs and check whether any input with the same name is already in: */
     107        for ( object=objects.begin() ; object < objects.end(); object++ ){
     108
     109                input=(Input*)(*object);
     110                if (input->EnumType()==enum_type){
     111                        found=true;
     112                        break;
     113                }
     114        }
     115
     116        if (!found){
     117                /*we could not find an input with the correct enum type. No defaults values were provided,
     118                 * error out: */
     119                ISSMERROR("could not find input with enum type %i (%s)",enum_type,EnumAsString(enum_type));
    108120        }
    109121
     
    120132        vector<Object*>::iterator object;
    121133        Input* input=NULL;
    122 
    123         /*Go through inputs and check whether any input with the same name is already in: */
    124         for ( object=objects.begin() ; object < objects.end(); object++ ){
    125 
    126                 input=(Input*)(*object);
    127                 if (input->EnumType()==enum_type)break;
    128         }
    129 
    130         if (!input){
    131                 /*we could not find an input with the correct enum type. No defaults values were provided,
    132                  * error out: */
    133                 ISSMERROR("%s%i"," could not find input with enum type ",enum_type);
     134        bool   found=false;
     135
     136        /*Go through inputs and check whether any input with the same name is already in: */
     137        for ( object=objects.begin() ; object < objects.end(); object++ ){
     138
     139                input=(Input*)(*object);
     140                if (input->EnumType()==enum_type){
     141                        found=true;
     142                        break;
     143                }
     144        }
     145
     146        if (!found){
     147                /*we could not find an input with the correct enum type. No defaults values were provided,
     148                 * error out: */
     149                ISSMERROR("could not find input with enum type %i (%s)",enum_type,EnumAsString(enum_type));
    134150        }
    135151
     
    145161        vector<Object*>::iterator object;
    146162        Input* input=NULL;
    147 
    148         /*Go through inputs and check whether any input with the same name is already in: */
    149         for ( object=objects.begin() ; object < objects.end(); object++ ){
    150 
    151                 input=(Input*)(*object);
    152                 if (input->EnumType()==enum_type)break;
    153         }
    154 
    155         if (!input){
    156                 /*we could not find an input with the correct enum type. No defaults values were provided,
    157                  * error out: */
    158                 ISSMERROR("%s%i"," could not find input with enum type ",enum_type);
     163        bool   found=false;
     164
     165        /*Go through inputs and check whether any input with the same name is already in: */
     166        for ( object=objects.begin() ; object < objects.end(); object++ ){
     167
     168                input=(Input*)(*object);
     169                if (input->EnumType()==enum_type){
     170                        found=true;
     171                        break;
     172                }
     173        }
     174
     175        if (!found){
     176                /*we could not find an input with the correct enum type. No defaults values were provided,
     177                 * error out: */
     178                ISSMERROR("could not find input with enum type %i (%s)",enum_type,EnumAsString(enum_type));
    159179        }
    160180
     
    169189        vector<Object*>::iterator object;
    170190        Input* input=NULL;
    171 
    172         /*Go through inputs and check whether any input with the same name is already in: */
    173         for ( object=objects.begin() ; object < objects.end(); object++ ){
    174 
    175                 input=(Input*)(*object);
    176                 if (input->EnumType()==enum_type)break;
    177         }
    178 
    179         if (!input){
     191        bool   found=false;
     192
     193        /*Go through inputs and check whether any input with the same name is already in: */
     194        for ( object=objects.begin() ; object < objects.end(); object++ ){
     195
     196                input=(Input*)(*object);
     197                if (input->EnumType()==enum_type){
     198                        found=true;
     199                        break;
     200                }
     201        }
     202
     203        if (!found){
    180204                /*we could not find an input with the correct enum type. Return the default values: */
    181                 for(i=0;i<numgauss;i++)values[i]=defaultvalues[i];
     205                for(i=0;i<numgauss;i++) values[i]=defaultvalues[i];
    182206        }
    183207        else{
     
    192216        vector<Object*>::iterator object;
    193217        Input* input=NULL;
    194 
    195         /*Go through inputs and check whether any input with the same name is already in: */
    196         for ( object=objects.begin() ; object < objects.end(); object++ ){
    197 
    198                 input=(Input*)(*object);
    199                 if (input->EnumType()==enum_type)break;
    200         }
    201 
    202         if (!input){
    203                 /*we could not find an input with the correct enum type. No defaults values were provided,
    204                  * error out: */
    205                 ISSMERROR("%s%i"," could not find input with enum type ",enum_type);
     218        bool   found=false;
     219
     220        /*Go through inputs and check whether any input with the same name is already in: */
     221        for ( object=objects.begin() ; object < objects.end(); object++ ){
     222
     223                input=(Input*)(*object);
     224                if (input->EnumType()==enum_type){
     225                        found=true;
     226                        break;
     227                }
     228        }
     229
     230        if (!found){
     231                /*we could not find an input with the correct enum type. No defaults values were provided,
     232                 * error out: */
     233                ISSMERROR("could not find input with enum type %i (%s)",enum_type,EnumAsString(enum_type));
    206234        }
    207235
     
    216244        vector<Object*>::iterator object;
    217245        Input* input=NULL;
    218 
    219         /*Go through inputs and check whether any input with the same name is already in: */
    220         for ( object=objects.begin() ; object < objects.end(); object++ ){
    221 
    222                 input=(Input*)(*object);
    223                 if (input->EnumType()==enum_type)break;
    224         }
    225 
    226         if (!input){
    227                 /*we could not find an input with the correct enum type. No defaults values were provided,
    228                  * error out: */
    229                 ISSMERROR("%s%i"," could not find input with enum type ",enum_type);
     246        bool   found=false;
     247
     248        /*Go through inputs and check whether any input with the same name is already in: */
     249        for ( object=objects.begin() ; object < objects.end(); object++ ){
     250
     251                input=(Input*)(*object);
     252                if (input->EnumType()==enum_type){
     253                        found=true;
     254                        break;
     255                }
     256        }
     257
     258        if (!found){
     259                /*we could not find an input with the correct enum type. No defaults values were provided,
     260                 * error out: */
     261                ISSMERROR("could not find input with enum type %i (%s)",enum_type,EnumAsString(enum_type));
    230262        }
    231263
     
    240272        vector<Object*>::iterator object;
    241273        Input* input=NULL;
    242 
    243         /*Go through inputs and check whether any input with the same name is already in: */
    244         for ( object=objects.begin() ; object < objects.end(); object++ ){
    245 
    246                 input=(Input*)(*object);
    247                 if (input->EnumType()==enum_type)break;
    248         }
    249 
    250         if (!input){
    251                 /*we could not find an input with the correct enum type. No defaults values were provided,
    252                  * error out: */
    253                 ISSMERROR("%s%i"," could not find input with enum type ",enum_type);
     274        bool   found=false;
     275
     276        /*Go through inputs and check whether any input with the same name is already in: */
     277        for ( object=objects.begin() ; object < objects.end(); object++ ){
     278
     279                input=(Input*)(*object);
     280                if (input->EnumType()==enum_type){
     281                        found=true;
     282                        break;
     283                }
     284        }
     285
     286        if (!found){
     287                /*we could not find an input with the correct enum type. No defaults values were provided,
     288                 * error out: */
     289                ISSMERROR("could not find input with enum type %i (%s)",enum_type,EnumAsString(enum_type));
    254290        }
    255291
     
    264300        vector<Object*>::iterator object;
    265301        Input* input=NULL;
    266 
    267         /*Go through inputs and check whether any input with the same name is already in: */
    268         for ( object=objects.begin() ; object < objects.end(); object++ ){
    269 
    270                 input=(Input*)(*object);
    271                 if (input->EnumType()==enum_type)break;
    272         }
    273 
    274         if (!input){
    275                 /*we could not find an input with the correct enum type. No defaults values were provided,
    276                  * error out: */
    277                 ISSMERROR("%s%i"," could not find input with enum type ",enum_type);
     302        bool   found=false;
     303
     304        /*Go through inputs and check whether any input with the same name is already in: */
     305        for ( object=objects.begin() ; object < objects.end(); object++ ){
     306
     307                input=(Input*)(*object);
     308                if (input->EnumType()==enum_type){
     309                        found=true;
     310                        break;
     311                }
     312        }
     313
     314        if (!found){
     315                /*we could not find an input with the correct enum type. No defaults values were provided,
     316                 * error out: */
     317                ISSMERROR("could not find input with enum type %i (%s)",enum_type,EnumAsString(enum_type));
    278318        }
    279319
     
    288328        vector<Object*>::iterator object;
    289329        Input* input=NULL;
    290 
    291         /*Go through inputs and check whether any input with the same name is already in: */
    292         for ( object=objects.begin() ; object < objects.end(); object++ ){
    293 
    294                 input=(Input*)(*object);
    295                 if (input->EnumType()==enum_type)break;
    296         }
    297 
    298         if (!input){
    299                 /*we could not find an input with the correct enum type. No defaults values were provided,
    300                  * error out: */
    301                 ISSMERROR("%s%i"," could not find input with enum type ",enum_type);
     330        bool   found=false;
     331
     332        /*Go through inputs and check whether any input with the same name is already in: */
     333        for ( object=objects.begin() ; object < objects.end(); object++ ){
     334
     335                input=(Input*)(*object);
     336                if (input->EnumType()==enum_type){
     337                        found=true;
     338                        break;
     339                }
     340        }
     341
     342        if (!found){
     343                /*we could not find an input with the correct enum type. No defaults values were provided,
     344                 * error out: */
     345                ISSMERROR("could not find input with enum type %i (%s)",enum_type,EnumAsString(enum_type));
    302346        }
    303347
Note: See TracChangeset for help on using the changeset viewer.