Collaboration diagram for GlobalParameterClass:
Public Member Functions | |
GlobalParameterClass () | |
Default constructor - initializes Parameter list and values. | |
~GlobalParameterClass () | |
Default destructor. | |
void | set (string gp, double gp_num) |
The function used to input information into the Parameter list. | |
void | set (string gp, string gp_val) |
The function used to input information into the Parameter list. | |
void | print () |
Function to print a table of parameters and values used in the translation. | |
string | read_command_line (int argc, char *argv[]) |
Function to parse command line arguments and update Parameter list. | |
void | read_file (string file) |
Function to read in a parameter file and update the Parameter list. | |
double | Value (string ParamName) |
Delivers the stored value of the requested parameter. | |
string | Flag (string ParamName) |
Delivers the string representation of the requested parameter. | |
Private Attributes | |
string | spar [50] |
Local string buffer. | |
ss_list | Parameters |
Parameters stored in name indexed link list. |
This class is based on a ss_link, has an x value which is a string that contains the name of a parameter and a y value which holds the parameter value as a string. The constructor generates the initial (default) parameter list and then attempts to read in the default parameter input file, b6::inp. The input file and the constructor are redundant, or at least they should be maintained that way. The input file file is supplied to make it clear to users what the complete list of parameters is without tearing through the code and also allows them to modify any or all of the parameters values simply by editing this file.
This class also parses command line arguments using the read_command_line() function. The parser is white-space insensitive, requires the parameter name to be prepended by a dash (UNIX-style flag) and then followed by the new or requested value. The command line requests have the highest precedence in the standard parameter value assignment procedure. The command line will accept any parameter name, whether it is in the official list or not. If the parameter exists in the global list, its value will be updated. If the requested parameter is not in the global list, it will be added to the list and assigned the requested value (this is a handy debugging feature). The command line is also used to request a private parameter file be read in. The flags -file
or -f
followed by the private parameter file name will activate this feature. Parameter files can have only one parameter request per line (without the dash in front of the parameter name), white-space is a delimiter and all characters following a #
sign are ignored up to the next linefeed. The private parameter file requests overwrite the default settings but have a lower precedence than command line requests.
Other modules of the translation code utilize the sY_list::at function to determine the existence of a particular parameter and extract the value at Value(string ParamName).
Definition at line 103 of file global_params.hpp.
|
Default constructor loads the default Parameter list, maintained in global_params::doc , and then reads in the default parameter file, b6::inp , extending the number of parameters if necessary and modifying defaults if requested. If a used supplied file containing Parameters and values is identified, it is parsed supercedes any previous settings. Finally, direct user input from the command line is parsed and takes highest precedence. Definition at line 83 of file global_params.cpp. References set(). |
|
Definition at line 127 of file global_params.cpp. |
|
Definition at line 339 of file global_params.cpp. References ss_list::at(), Parameters, and tolower(). |
|
Simple member function that prints out all the parameter names in memmory and the values they are set to. Definition at line 183 of file global_params.cpp. References Parameters, and ss_list::print(). Referenced by main(). |
|
-f or -file are used to direct the code to private parameter files. If the file exists, it is parsed by the read_file() member function, otherwise the code continues to execute after spilling an error message to the standard output about the missing file.
Definition at line 190 of file global_params.cpp. References center(), Parameters, ss_list::print(), read_file(), set(), and spar. Referenced by main(). |
|
# , is performed and if found, erases it and all characters that follow. Then, extraneous blanks are again removed. If the processed string is empty, the next line from the file is extracted and the process begins again. If the processed string is not empty, it is tested to insure that there is but a single interior blank, indicating that there are exactly two words left in the string. If this condition fails, the program halts after spewing error messages, otherwise, the two words are considered to be the parameter name and value which are then set into the parameter list. The parameter name and the value are stored as strings.
Definition at line 272 of file global_params.cpp. References remove_extra_blanks(), and set(). Referenced by read_command_line(). |
|
Definition at line 158 of file global_params.cpp. References ss_list::at(), ss_link::name(), Parameters, remove_extra_blanks(), and ss_link::value(). |
|
Definition at line 132 of file global_params.cpp. References ss_list::at(), ss_link::name(), Parameters, remove_extra_blanks(), tolower(), and ss_link::value(). Referenced by GlobalParameterClass(), read_command_line(), and read_file(). |
|
|
An ss_list containing all the parameters indexed by name. Referenced by Flag(), print(), read_command_line(), set(), and Value(). |
|
String used for storing command line arguments Referenced by read_command_line(). |