Stellarator-Tools
Loading...
Searching...
No Matches
commandline_parser::commandline_parser_class Type Reference

Base class containing a parsed commandline. More...

Public Member Functions

FINAL commandline_parser_destruct (this)
 Deconstruct a commandline_parser_class object.
 
procedure get_string (this, arg)
 Get the value of an argument as a string.
 
procedure get_integer (this, arg, default_value)
 Get the value of an argument as an integer.
 
procedure get_real (this, arg, default_value)
 Get the value of an argument as a Real.
 
procedure is_flag_set (this, arg)
 Check if a command line argument was set.
 

Public Attributes

character(len=max_length) command
 Command name of current process.
 
character(len=max_arg_length), dimension(:), pointer arg => null()
 Array of arguments. An argument is the form of -flag.
 
character(len=path_length), dimension(:), pointer value => null()
 Array of value corresponding to the flag. A value is everything after the '=' character. The value maybe blank indicating there was no value provided.
 

Detailed Description

Base class containing a parsed commandline.

Member Function/Subroutine Documentation

◆ commandline_parser_destruct()

FINAL commandline_parser::commandline_parser_class::commandline_parser_destruct ( type (commandline_parser_class), intent(inout)  this)
final

Deconstruct a commandline_parser_class object.

Deallocates memory and uninitializes a commandline_parser_class object.

Parameters
[in,out]thisA commandline_parser_class instance.

◆ get_integer()

procedure commandline_parser::commandline_parser_class::get_integer ( class (commandline_parser_class), intent(in)  this,
character (len=*), intent(in)  arg,
integer, intent(in)  default_value 
)

Get the value of an argument as an integer.

Searches the parsed command line flags for a matching command like argument. If no matching argument is found, no value was set or the value cannot be converted to an integer, the default value is returned. Command line arguments take the form of -flag.

Parameters
[in]thisA commandline_parser_class instance.
[in]argA argument string to search for.
[in]default_valueDefault value in case flag is not set.
Returns
The argument value.

◆ get_real()

procedure commandline_parser::commandline_parser_class::get_real ( class (commandline_parser_class), intent(in)  this,
character (len=*), intent(in)  arg,
real (rprec), intent(in)  default_value 
)

Get the value of an argument as a Real.

Searches the parsed command line flags for a matching command like argument. If no matching argument is found, no value was set or the value cannot be converted to an integer, the default value is returned. Command line arguments take the form of -flag.

Parameters
[in]thisA commandline_parser_class instance.
[in]argA argument string to search for.
[in]default_valueDefault value in case flag is not set.
Returns
The argument value.

◆ get_string()

procedure commandline_parser::commandline_parser_class::get_string ( class (commandline_parser_class), intent(in)  this,
character (len=*), intent(in)  arg 
)

Get the value of an argument as a string.

Searches the parsed command line flags for a matching command like argument. If no matching argument is found or no value was set, a blank string is returned. command line arguments take the form of -flag.

Parameters
[in]thisA commandline_parser_class instance.
[in]argA argument string to search for.
Returns
The argument value.

◆ is_flag_set()

procedure commandline_parser::commandline_parser_class::is_flag_set ( class (commandline_parser_class), intent(in)  this,
character (len=*), intent(in)  arg 
)

Check if a command line argument was set.

Searches the parsed command line flags for a matching command line argument. If no matching argument is found the flag was not set.

Parameters
[in]thisA commandline_parser_class instance.
[in]argA argument string to search for.
Returns
True if the argument was found, false if it was not found.

The documentation for this type was generated from the following file: