MolSim
Loading...
Searching...
No Matches
Functions
CLIParser Namespace Reference

Namespace defining functions for parsing command line arguments. More...

Functions

void checkArgc (int argc)
 Checks if there are enough arguments passed through the command line interface.
 
void checkHelpString (int argc, char **argv)
 Checks if the help option '-h' is passed anywhere.
 
void checkValidity (const Arguments &args)
 Checks the mathematical validity of the given arguments.
 
void setDefaults (Arguments &args)
 Sets default values for uninitialized Argument attributes based on the chosen Simulation type.
 
void parseArguments (int argc, char **argv, Arguments &args)
 Parses and store CLI arguments in an Arguments struct.
 

Detailed Description

Namespace defining functions for parsing command line arguments.

Function Documentation

◆ checkArgc()

void CLIParser::checkArgc ( int  argc)

Checks if there are enough arguments passed through the command line interface.

There must be at least one argument passed (i.e. the file name). Exits the program with an error message if argc is less than 2.

Parameters
argcArgument counter, typically passed directly via the main function.

◆ checkHelpString()

void CLIParser::checkHelpString ( int  argc,
char **  argv 
)

Checks if the help option '-h' is passed anywhere.

This is done before interpreting the last command line argument as an XML file to enable running the program while only passing the help string in order to print out a help message (i.e. ./MolSim -h should still be valid syntax, even if no file input is provided).

Parameters
argcArgument counter, typically passed directly via the main function.
argvArgument vector, typically passed directly via the main function.

◆ checkValidity()

void CLIParser::checkValidity ( const Arguments args)

Checks the mathematical validity of the given arguments.

Parameters
argsA reference to the Argument struct to be checked.

◆ parseArguments()

void CLIParser::parseArguments ( int  argc,
char **  argv,
Arguments args 
)

Parses and store CLI arguments in an Arguments struct.

Parameters
argcArgument counter, typically passed directly via the main function.
argvArgument vector, typically passed directly via the main function.
argsA reference to the argument struct in which to store the parsed arguments.

◆ setDefaults()

void CLIParser::setDefaults ( Arguments args)

Sets default values for uninitialized Argument attributes based on the chosen Simulation type.

Parameters
argsA reference to the Argument struct to be modified.