/* option_checker()'s role is ONLY check "short option" */
void option_checker(int argc, char ** argv)
{
    int opt;
    /* long option's define */
    static struct option loption[] = {
        {"help", no_argument, NULL, 'h'},
        {"time", required_argument, NULL, 't'},
        {"file", required_argument, NULL, 'f'}
    };

    /* check the number of argument */
    if(argc == 1) {
        error_procedure("number of argument");
    }

    /* set all modes to OFF */
    set_mode();

    /* check short options */
    while((opt = getopt_long(argc, argv, "mbv:plzt:f:h", loption, NULL)) != -1) {
        switch(opt) {
            case 'b':
                set_tabu2opt_mode();
                break;
            case 'm':
                set_parallel_mode();
                break;
            case 'v':
                set_visual_mode(atoi(optarg));
                break;
            case 'p':
                set_parallel_mode();
                break;
            case 'l':
                set_pole_mode();
                break;
            case 'z':
                set_tozaki_mode();
                break;
            case 't':
                set_time(INIT,atoi(optarg));
                break;
            case 'f':
                read_data_set(optarg);
                break;
            case 'h':
                if(argc == 2) {
                    help_document(argv);
                }
                break;
            case '?':
                error_procedure("comand-line option");
                break;
        }
    }
}
Example #2
0
Model::Model *Storage::Binary::read_model() {
  open_for_reading();
  
  // read the 3 model components
  Model::Model *model  = new Model::Model();
  model->data_set      = read_data_set();
  model->classifier    = read_classifier(model->data_set);
  model->text_pipeline = read_text_pipeline();
  
  file.close();
  return model;
}
Example #3
0
// ------------------------------------------
// public read & write methods
// ------------------------------------------
DataSet::DataSet *Storage::Binary::read() {
  open_for_reading();
  DataSet::DataSet *data_set = read_data_set();
  file.close();
  return data_set;
}