#include <CommandLineArguments.hpp>
Public Member Functions | |
bool | OptionExists (std::string option) |
char * | GetValueCorrespondingToOption (std::string option) |
Static Public Member Functions | |
static CommandLineArguments * | Instance () |
Public Attributes | |
int * | p_argc |
char *** | p_argv |
Private Member Functions | |
CommandLineArguments () | |
CommandLineArguments (const CommandLineArguments &) | |
CommandLineArguments & | operator= (const CommandLineArguments &) |
int | GetIndexForArgument (std::string argument) |
Static Private Attributes | |
static CommandLineArguments * | mpInstance = NULL |
The cxxtest harness will fill in the member variables when a test is started. They can then be read by PETSc when it is initialised.
Definition at line 44 of file CommandLineArguments.hpp.
CommandLineArguments::CommandLineArguments | ( | ) | [private] |
Default constructor. Should never be called directly, call CommandLineArguments::Instance() instead.
Definition at line 34 of file CommandLineArguments.cpp.
References mpInstance.
CommandLineArguments::CommandLineArguments | ( | const CommandLineArguments & | ) | [private] |
Copy constructor.
CommandLineArguments * CommandLineArguments::Instance | ( | ) | [static] |
Get the single instance of this class.
Definition at line 42 of file CommandLineArguments.cpp.
References mpInstance.
Referenced by ExecutableSupport::InitializePetsc(), and PetscSetup::setUpWorld().
bool CommandLineArguments::OptionExists | ( | std::string | option | ) | [inline] |
Check whether a given option exists in the command line arguments.
option | The option as a string. This should start with "-", for example "-implicit_scheme" "-no_output" etc. |
Definition at line 62 of file CommandLineArguments.hpp.
References GetIndexForArgument().
char* CommandLineArguments::GetValueCorrespondingToOption | ( | std::string | option | ) | [inline] |
Get the value for a given option, ie the argument after the option name in the list of command line arguments. For example, if the following arguments were given ./heart/build/debug/TestMyClassRunner -timestep 0.04 Then calling CommandLineArguments::Instance()->GetValueCorrespondingToOption("-timestep"); will return 0.04 (as a char*). Use atoi or atof to convert the char* to an int or a double(float) respectively.
option | The option as a string. This should start with "-", for example "-my_param" "-timestep" etc. |
Definition at line 83 of file CommandLineArguments.hpp.
References EXCEPTION, GetIndexForArgument(), p_argc, and p_argv.
CommandLineArguments& CommandLineArguments::operator= | ( | const CommandLineArguments & | ) | [private] |
Overloaded assignment operator.
int CommandLineArguments::GetIndexForArgument | ( | std::string | argument | ) | [inline, private] |
Get the index for the given argument. Returns -1 if the argument is not found.
argument | The argument as a string. This should start with "-", for example "-my_arg" "-timestep" etc. |
Definition at line 118 of file CommandLineArguments.hpp.
References p_argc, and p_argv.
Referenced by GetValueCorrespondingToOption(), and OptionExists().
The number of command line arguments.
Definition at line 49 of file CommandLineArguments.hpp.
Referenced by GetIndexForArgument(), GetValueCorrespondingToOption(), ExecutableSupport::InitializePetsc(), and PetscSetup::setUpWorld().
char*** CommandLineArguments::p_argv |
The arguments themselves.
Definition at line 52 of file CommandLineArguments.hpp.
Referenced by GetIndexForArgument(), GetValueCorrespondingToOption(), ExecutableSupport::InitializePetsc(), and PetscSetup::setUpWorld().
CommandLineArguments * CommandLineArguments::mpInstance = NULL [static, private] |
The single instance of the class.
Definition at line 111 of file CommandLineArguments.hpp.
Referenced by CommandLineArguments(), and Instance().