Wraps a vector of string CL arguments with some helpful functionality.
More...
#include <argument_parser.h>
|
| ArgumentNamespace (int n_args, char *argv[]) |
| Construct a new Argument Namespace object.
|
|
bool | have_flag (std::string const &flag) const |
| Searches the arguments for the flag provided.
|
|
bool | compressed_output () const |
| Return true if the user has requested the output file we written in compressed format.
|
|
bool | has_grid_filename () const |
| Have we been provided with a grid filename?
|
|
bool | have_correct_number_of_filenames () const |
| Check that the correct number of filename arguments are provided (either 2 or 3 non-flag arguments)
|
|
const char * | input_filename () |
| Gets the input filename.
|
|
const char * | output_filename () |
| Gets the output filename.
|
|
const char * | grid_filename () |
| Gets the grid filename.
|
|
std::vector< std::string > | input_filenames () |
| Get all input filenames.
|
|
void | check_files_can_be_accessed () |
| Check that all input and output files can be accessed with the correct privileges.
|
|
|
static bool | is_a_flag_argument (std::string arg) |
| Check whether an argument is a flag (starts '-')
|
|
|
std::vector< std::string > | arguments |
|
std::vector< std::string > | non_flag_arguments |
|
Wraps a vector of string CL arguments with some helpful functionality.
◆ ArgumentNamespace()
ArgumentNamespace::ArgumentNamespace |
( |
int |
n_args, |
|
|
char * |
argv[] |
|
) |
| |
|
explicit |
Construct a new Argument Namespace object.
- Parameters
-
n_args | the number of arguments (argc) |
argv | pointers to the arguments (argv) |
◆ compressed_output()
bool ArgumentNamespace::compressed_output |
( |
| ) |
const |
Return true if the user has requested the output file we written in compressed format.
Compressed output is toggled by the -m, –minimise-file-size options on the CLI.
This option is used when the outputs are being written, after the simulation has been performed.
◆ grid_filename()
const char * ArgumentNamespace::grid_filename |
( |
| ) |
|
Gets the grid filename.
- Returns
- const char* the grid filename
◆ has_grid_filename()
bool ArgumentNamespace::has_grid_filename |
( |
| ) |
const |
Have we been provided with a grid filename?
- Returns
- true if there are 3 non-flag arguments (therefore a grid filename)
-
false otherwise
◆ have_correct_number_of_filenames()
bool ArgumentNamespace::have_correct_number_of_filenames |
( |
| ) |
const |
Check that the correct number of filename arguments are provided (either 2 or 3 non-flag arguments)
- Returns
- true if correct
-
false otherwise
◆ have_flag()
bool ArgumentNamespace::have_flag |
( |
std::string const & |
flag | ) |
const |
Searches the arguments for the flag provided.
- Parameters
-
- Returns
- true if the flag is present
-
false otherwise
◆ input_filename()
const char * ArgumentNamespace::input_filename |
( |
| ) |
|
Gets the input filename.
- Returns
- const char* the input filename
◆ input_filenames()
vector< string > ArgumentNamespace::input_filenames |
( |
| ) |
|
Get all input filenames.
A vector containing the input filename and the grid filename (if provided)
- Returns
- std::vector<std::string> the input filenames
◆ is_a_flag_argument()
bool ArgumentNamespace::is_a_flag_argument |
( |
std::string |
arg | ) |
|
|
static |
Check whether an argument is a flag (starts '-')
- Parameters
-
- Returns
- true if arg is a flag
-
false otherwise
◆ output_filename()
const char * ArgumentNamespace::output_filename |
( |
| ) |
|
Gets the output filename.
The output filename is either the second or third positional argument depending on whether a grid filename is provided or not.
- Returns
- const char* the output filename
The documentation for this class was generated from the following files: