commandlinearguments.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. ///////////////////////////////////////////////////////////////////////////////////////
  2. /// \file commandlinearguments.h
  3. /// \brief Takes care of the command line arguments to LPJ-GUESS
  4. ///
  5. /// $Date: 2018-02-02 18:01:35 +0100 (ven, 02 fév 2018) $
  6. ///
  7. ///////////////////////////////////////////////////////////////////////////////////////
  8. #ifndef LPJ_GUESS_COMMAND_LINE_ARGUMENTS_H
  9. #define LPJ_GUESS_COMMAND_LINE_ARGUMENTS_H
  10. #include <string>
  11. /// Parses and stores the user's command line arguments
  12. class CommandLineArguments {
  13. public:
  14. /// Send in the arguments from main() to this constructor
  15. /** If the arguments are malformed, this constructor will
  16. * print out usage information and exit the program.
  17. */
  18. CommandLineArguments(int argc, char** argv);
  19. /// Returns the instruction filename
  20. const char* get_instruction_file() const;
  21. /// Returns true if the user has specified the help option
  22. bool get_help() const;
  23. /// Returns true if the user has specified the parallel option
  24. bool get_parallel() const;
  25. /// Returns the chosen (or default) input module
  26. const char* get_input_module() const;
  27. /// Returns path to a GetClim-generated driver file if the 'getclim' input module was requested
  28. const char* get_driver_file() const;
  29. /// Returns true if the user has specified the islpjgspinup option
  30. bool get_islpjgspinup() const;
  31. private:
  32. /// Does the actual parsing of the arguments
  33. bool parse_arguments(int argc, char** argv);
  34. /// Prints out usage information and exits the program
  35. void print_usage(const char* command_name) const;
  36. /// Instruction filename specified on the command line
  37. std::string insfile;
  38. /// Whether the user wants help on how to run the LPJ-GUESS command
  39. bool help;
  40. /// Whether the user requested a parallel run
  41. bool parallel;
  42. /// The chosen (or default) input module
  43. std::string input_module;
  44. /// Driver file name for GetClim input module
  45. std::string driver_file;
  46. /// ecev3 - Whether to spin up LPJ-GUESS or not. False unless -islpjgspinup is in the command line
  47. bool islpjgspinup;
  48. };
  49. #endif // LPJ_GUESS_COMMAND_LINE_ARGUMENTS_H