WarpX
Typedefs | Enumerations | Functions
ArgParser Namespace Reference

Typedefs

using ArgVal = std::optional< std::variant< int, double, std::string > >
 
using Key = std::tuple< std::string, ArgType, std::string >
 
using ParsedArgs = std::unordered_map< std::string, ArgVal >
 

Enumerations

enum class  ArgType { NoArg , Integer , Double , String }
 

Functions

template<typename T >
GetVal (const ArgVal &arg_val)
 Gets the value out of an ArgVal (std::optional<std::variant<int, double, std::string>>) object. More...
 
ParsedArgs ParseArgs (const std::vector< Key > &keys, const int argc, char const *const *argv)
 Function to parse the command line arguments. More...
 
void PrintHelp (const std::vector< Key > &cmd_list)
 Prints the command line options. More...
 

Typedef Documentation

◆ ArgVal

using ArgParser::ArgVal = typedef std::optional<std::variant<int, double, std::string> >

◆ Key

using ArgParser::Key = typedef std::tuple<std::string, ArgType, std::string>

◆ ParsedArgs

using ArgParser::ParsedArgs = typedef std::unordered_map<std::string, ArgVal>

Enumeration Type Documentation

◆ ArgType

enum ArgParser::ArgType
strong
Enumerator
NoArg 
Integer 
Double 
String 

Function Documentation

◆ GetVal()

template<typename T >
T ArgParser::GetVal ( const ArgVal arg_val)

Gets the value out of an ArgVal (std::optional<std::variant<int, double, std::string>>) object.

Template Parameters
Tthe type to return (must be int, double, or std::string)
Parameters
[in]arg_valthe ArgVal object
Returns
the value in arg_val

◆ ParseArgs()

ParsedArgs ArgParser::ParseArgs ( const std::vector< Key > &  keys,
const int  argc,
char const *const *  argv 
)

Function to parse the command line arguments.

Parameters
[in]keysthe list of possible command line arguments
[in]argcthe number of command line arguments
[in]argvall the command line arguments
Returns
the parsed command line arguments

◆ PrintHelp()

void ArgParser::PrintHelp ( const std::vector< Key > &  cmd_list)

Prints the command line options.

Parameters
[in]cmd_listthe list of possible command line arguments