Examples/Support/Settings.cpp
/**
 * Parse the params from the commandline.
 * 
 * Also checks the params definition for correctness.
 *
 * Will exit locally if an error occured or help is displayed.
 * In other words, if it returns all is well.
 */
Parse the params from the commandline.

Also checks the params definition for correctness.

Will exit locally if an error occured or help is displayed.
In other words, if it returns all is well.
Parse the params from the commandline . Also checks the params definition for correctness . Will exit locally if an error occured or help is displayed . In other words if it returns all is well .
void Settings::check_params(CmdParameters &params, int argc, char const *argv[]) {
  if (params.has_errors()) {  
    std::cout << params.get_errors();
    exit(CmdParameters::EXIT_ERROR);
  }
  int ret = CmdParameters::EXIT_ERROR;
   This mask the call to handle_help() in handle_commandline()
   This skips the init() and reset() calls in handle_commandline();
   TODO check if this is OK
  if (params.has_help(argc, argv)) {
    assert(!params.scan_action(argc, argv));   No actions expected for V3DLib examples
    show_help();
    ret = CmdParameters::EXIT_NO_ERROR;
  } else {
    ret = params.handle_commandline(argc, argv, false);
    if (ret == CmdParameters::ALL_IS_WELL) {
      bool success = process() && init_params();
      if (!success) {
        ret = CmdParameters::EXIT_ERROR;
      }
    }
  }
  if (ret != CmdParameters::ALL_IS_WELL) exit(ret);
}
void Settings :: check_params ( CmdParameters & params , int argc , char const * argv [ ] ) { if ( params . has_errors ( ) ) { std :: cout << params . get_errors ( ) ; exit ( CmdParameters :: EXIT_ERROR ) ; } int ret = CmdParameters :: EXIT_ERROR ; if ( params . has_help ( argc , argv ) ) { assert ( ! params . scan_action ( argc , argv ) ) ; show_help ( ) ; ret = CmdParameters :: EXIT_NO_ERROR ; } else { ret = params . handle_commandline ( argc , argv , false ) ; if ( ret == CmdParameters :: ALL_IS_WELL ) { bool success = process ( ) && init_params ( ) ; if ( ! success ) { ret = CmdParameters :: EXIT_ERROR ; } } } if ( ret != CmdParameters :: ALL_IS_WELL ) exit ( ret ) ; }
Parse the params from the commandline.
Parse the params from the commandline .
// Prob not necessary. Keeping it in for now // // This mask the call to handle_help() in handle_commandline() // // This skips the init() and reset() calls in handle_commandline(); // TODO check if this is OK // // No actions expected for V3DLib examples