Classes | Functions | Variables
oomph::CommandLineArgs Namespace Reference

Namespace for command line arguments. More...

Classes

struct  ArgInfo
 Structure to store information on a command line argument. More...
 

Functions

void setup (int argc, char **argv)
 Set values. More...
 
void output ()
 Doc the command line arguments. More...
 
void specify_command_line_flag (const std::string &command_line_flag, const std::string &doc)
 Specify possible argument-free command line flag. More...
 
void specify_command_line_flag (const std::string &command_line_flag, double *arg_pt, const std::string &doc)
 Specify possible command line flag that specifies a double, accessed via pointer. More...
 
void specify_command_line_flag (const std::string &command_line_flag, int *arg_pt, const std::string &doc)
 Specify possible command line flag that specifies an int, accessed via pointer. More...
 
void specify_command_line_flag (const std::string &command_line_flag, unsigned *arg_pt, const std::string &doc)
 Specify possible command line flag that specifies an unsigned, accessed via pointer. More...
 
void specify_command_line_flag (const std::string &command_line_flag, std::string *arg_pt, const std::string &doc)
 Specify possible command line flag that specifies a string, accessed via pointer. More...
 
bool command_line_flag_has_been_set (const std::string &flag)
 Check if command line flag has been set (value will have been assigned directly). More...
 
void doc_all_flags (std::ostream &outstream)
 Document the values of all flags (specified or not). More...
 
void doc_specified_flags ()
 Document specified command line flags. More...
 
void doc_available_flags ()
 Document available command line flags. More...
 
void check_arg_index (const int &argc, const int &arg_index)
 Helper function to check if command line index is legal. More...
 
void parse_and_assign (int argc, char *argv[], const bool &throw_on_unrecognised_args)
 Parse command line, check for recognised flags and assign associated values. More...
 
void parse_and_assign (const bool &throw_on_unrecognised_args)
 Parse previously specified command line, check for recognised flags and assign associated values. More...
 

Variables

int Argc
 Number of arguments + 1. More...
 
char ** Argv
 Arguments themselves. More...
 
std::map< std::string, ArgInfo< bool > > Specified_command_line_flag
 Map to indicate an input flag as having been set. More...
 
std::map< std::string, ArgInfo< double > > Specified_command_line_double_pt
 Map to associate an input flag with a double – specified via pointer. More...
 
std::map< std::string, ArgInfo< int > > Specified_command_line_int_pt
 Map to associate an input flag with an int – specified via pointer. More...
 
std::map< std::string, ArgInfo< unsigned > > Specified_command_line_unsigned_pt
 Map to associate an input flag with an unsigned – specified via pointer. More...
 
std::map< std::string, ArgInfo< std::string > > Specified_command_line_string_pt
 Map to associate an input flag with a string – specified via pointer. More...
 

Detailed Description

Namespace for command line arguments.

Function Documentation

◆ check_arg_index()

void oomph::CommandLineArgs::check_arg_index ( const int &  argc,
const int &  arg_index 
)

Helper function to check if command line index is legal.

Definition at line 958 of file oomph_utilities.cc.

References doc_available_flags(), and oomph::output().

Referenced by parse_and_assign().

◆ command_line_flag_has_been_set()

bool oomph::CommandLineArgs::command_line_flag_has_been_set ( const std::string &  flag)

Check if command line flag has been set (value will have been assigned directly).

Check if specified flag has been set (the associated value will have been assigned directly)

Definition at line 729 of file oomph_utilities.cc.

References Specified_command_line_double_pt, Specified_command_line_int_pt, Specified_command_line_string_pt, Specified_command_line_unsigned_pt, and oomph::Global_string_for_annotation::string().

◆ doc_all_flags()

void oomph::CommandLineArgs::doc_all_flags ( std::ostream &  outstream)

Document the values of all flags (specified or not).

Document the values of all flags (specified or not)

Definition at line 785 of file oomph_utilities.cc.

References Specified_command_line_double_pt, Specified_command_line_int_pt, Specified_command_line_string_pt, Specified_command_line_unsigned_pt, and oomph::Global_string_for_annotation::string().

◆ doc_available_flags()

void oomph::CommandLineArgs::doc_available_flags ( )

◆ doc_specified_flags()

void oomph::CommandLineArgs::doc_specified_flags ( )

◆ output()

void oomph::CommandLineArgs::output ( )

Doc the command line arguments.

Definition at line 664 of file oomph_utilities.cc.

References Argc, Argv, i, and oomph::oomph_info.

◆ parse_and_assign() [1/2]

void oomph::CommandLineArgs::parse_and_assign ( int  argc,
char *  argv[],
const bool &  throw_on_unrecognised_args 
)

◆ parse_and_assign() [2/2]

void oomph::CommandLineArgs::parse_and_assign ( const bool &  throw_on_unrecognised_args)

Parse previously specified command line, check for recognised flags and assign associated values.

Definition at line 1156 of file oomph_utilities.cc.

◆ setup()

void oomph::CommandLineArgs::setup ( int  argc,
char **  argv 
)

Set values.

Definition at line 657 of file oomph_utilities.cc.

◆ specify_command_line_flag() [1/5]

void oomph::CommandLineArgs::specify_command_line_flag ( const std::string &  command_line_flag,
const std::string &  doc 
)

Specify possible argument-free command line flag.

Definition at line 679 of file oomph_utilities.cc.

References oomph::LeakCheckNames::doc().

◆ specify_command_line_flag() [2/5]

void oomph::CommandLineArgs::specify_command_line_flag ( const std::string &  command_line_flag,
double *  arg_pt,
const std::string &  doc 
)

Specify possible command line flag that specifies a double, accessed via pointer.

Definition at line 688 of file oomph_utilities.cc.

References oomph::LeakCheckNames::doc(), and Specified_command_line_double_pt.

◆ specify_command_line_flag() [3/5]

void oomph::CommandLineArgs::specify_command_line_flag ( const std::string &  command_line_flag,
int *  arg_pt,
const std::string &  doc 
)

Specify possible command line flag that specifies an int, accessed via pointer.

Definition at line 698 of file oomph_utilities.cc.

References oomph::LeakCheckNames::doc(), and Specified_command_line_int_pt.

◆ specify_command_line_flag() [4/5]

void oomph::CommandLineArgs::specify_command_line_flag ( const std::string &  command_line_flag,
unsigned *  arg_pt,
const std::string &  doc 
)

Specify possible command line flag that specifies an unsigned, accessed via pointer.

Definition at line 708 of file oomph_utilities.cc.

References oomph::LeakCheckNames::doc(), and Specified_command_line_unsigned_pt.

◆ specify_command_line_flag() [5/5]

void oomph::CommandLineArgs::specify_command_line_flag ( const std::string &  command_line_flag,
std::string *  arg_pt,
const std::string &  doc 
)

Specify possible command line flag that specifies a string, accessed via pointer.

Definition at line 718 of file oomph_utilities.cc.

References oomph::LeakCheckNames::doc(), and Specified_command_line_string_pt.

Variable Documentation

◆ Argc

int oomph::CommandLineArgs::Argc

Number of arguments + 1.

Definition at line 632 of file oomph_utilities.cc.

Referenced by output(), and print_stacktrace().

◆ Argv

char ** oomph::CommandLineArgs::Argv

Arguments themselves.

Definition at line 635 of file oomph_utilities.cc.

Referenced by output(), and print_stacktrace().

◆ Specified_command_line_double_pt

std::map< std::string, ArgInfo< double > > oomph::CommandLineArgs::Specified_command_line_double_pt

Map to associate an input flag with a double – specified via pointer.

Definition at line 642 of file oomph_utilities.cc.

Referenced by command_line_flag_has_been_set(), doc_all_flags(), doc_available_flags(), doc_specified_flags(), parse_and_assign(), and specify_command_line_flag().

◆ Specified_command_line_flag

std::map< std::string, ArgInfo< bool > > oomph::CommandLineArgs::Specified_command_line_flag

Map to indicate an input flag as having been set.

Definition at line 638 of file oomph_utilities.cc.

◆ Specified_command_line_int_pt

std::map< std::string, ArgInfo< int > > oomph::CommandLineArgs::Specified_command_line_int_pt

Map to associate an input flag with an int – specified via pointer.

Definition at line 646 of file oomph_utilities.cc.

Referenced by command_line_flag_has_been_set(), doc_all_flags(), doc_available_flags(), doc_specified_flags(), parse_and_assign(), and specify_command_line_flag().

◆ Specified_command_line_string_pt

std::map< std::string, ArgInfo< std::string > > oomph::CommandLineArgs::Specified_command_line_string_pt

Map to associate an input flag with a string – specified via pointer.

Definition at line 654 of file oomph_utilities.cc.

Referenced by command_line_flag_has_been_set(), doc_all_flags(), doc_available_flags(), doc_specified_flags(), parse_and_assign(), and specify_command_line_flag().

◆ Specified_command_line_unsigned_pt

std::map< std::string, ArgInfo< unsigned > > oomph::CommandLineArgs::Specified_command_line_unsigned_pt

Map to associate an input flag with an unsigned – specified via pointer.

Definition at line 650 of file oomph_utilities.cc.

Referenced by command_line_flag_has_been_set(), doc_all_flags(), doc_available_flags(), doc_specified_flags(), parse_and_assign(), and specify_command_line_flag().