Chombo + EB + MF  3.2
Public Member Functions | Friends | List of all members
ParmParse Class Reference

Parse Parameters From Command Line and Input Files. More...

#include <ParmParse.H>

Public Member Functions

 ParmParse (int argc, char **argv, const char *prefix=0, const char *parfile=0)
 
void define (int argc, char **argv, const char *prefix=0, const char *parfile=0)
 Initialize after calling the default constructor. More...
 
 ParmParse (const char *prefix=0)
 
 ParmParse (const std::string &a_string)
 got sick of typing c_str() More...
 
 ~ParmParse ()
 
bool contains (const char *name) const
 
bool contains (const std::string &name) const
 
bool looseContains (const char *name) const
 
bool looseContains (const std::string &name) const
 
int countval (const char *name, int n=-1) const
 
int countname (const char *name) const
 
int countname (const std::string &name) const
 
void addEntries (const std::string &strEntry)
 
template<typename TYPE >
void setVal (const std::string &varName, TYPE varVal)
 
void setStr (const std::string &varName, std::string varVal)
 
void dumpTable (std::ostream &os) const
 
void get (const char *name, int &ref, int ival=0) const
 access single object More...
 
int query (const char *name, int &ref, int ival=0) const
 
void get (const char *name, unsigned long &ref, int ival=0) const
 access single object More...
 
int query (const char *name, unsigned long &ref, int ival=0) const
 
void get (const char *name, float &ref, int ival=0) const
 
int query (const char *name, float &ref, int ival=0) const
 
void get (const char *name, double &ref, int ival=0) const
 
int query (const char *name, double &ref, int ival=0) const
 
void get (const char *name, std::string &ref, int ival=0) const
 Get the ival'th value of last occurrence of the requested name. More...
 
int query (const char *name, std::string &ref, int ival=0) const
 Get the ival'th value of last occurrence of the requested name. More...
 
void get (const char *name, bool &ref, int ival=0) const
 Get the ival'th value of last occurrence of the requested name. More...
 
int query (const char *name, bool &ref, int ival=0) const
 Get the ival'th value of last occurrence of the requested name. More...
 
void getarr (const char *name, Vector< int > &ref, int start_ix, int num_val) const
 access an array of objects More...
 
void getarr (const char *name, std::vector< int > &ref, int start_ix, int num_val) const
 access an array of objects More...
 
int queryarr (const char *name, Vector< int > &ref, int start_ix, int num_val) const
 access an array of objects More...
 
int queryarr (const char *name, std::vector< int > &ref, int start_ix, int num_val) const
 access an array of objects More...
 
void getarr (const char *name, Vector< unsigned long > &ref, int start_ix, int num_val) const
 access an array of objects More...
 
void getarr (const char *name, std::vector< unsigned long > &ref, int start_ix, int num_val) const
 access an array of objects More...
 
int queryarr (const char *name, Vector< unsigned long > &ref, int start_ix, int num_val) const
 access an array of objects More...
 
int queryarr (const char *name, std::vector< unsigned long > &ref, int start_ix, int num_val) const
 access an array of objects More...
 
void getarr (const char *name, Vector< float > &ref, int start_ix, int num_val) const
 access an array More...
 
void getarr (const char *name, std::vector< float > &ref, int start_ix, int num_val) const
 access an array More...
 
int queryarr (const char *name, Vector< float > &ref, int start_ix, int num_val) const
 
int queryarr (const char *name, std::vector< float > &ref, int start_ix, int num_val) const
 
void getarr (const char *name, Vector< double > &ref, int start_ix, int num_val) const
 
void getarr (const char *name, std::vector< double > &ref, int start_ix, int num_val) const
 
int queryarr (const char *name, Vector< double > &ref, int start_ix, int num_val) const
 
int queryarr (const char *name, std::vector< double > &ref, int start_ix, int num_val) const
 
void getarr (const char *name, Vector< std::string > &ref, int start_ix, int num_val) const
 
void getarr (const char *name, std::vector< std::string > &ref, int start_ix, int num_val) const
 
int queryarr (const char *name, Vector< std::string > &ref, int start_ix, int num_val) const
 
int queryarr (const char *name, std::vector< std::string > &ref, int start_ix, int num_val) const
 
void getarr (const char *name, Vector< bool > &ref, int start_ix, int num_val) const
 
void getarr (const char *name, std::vector< bool > &ref, int start_ix, int num_val) const
 
int queryarr (const char *name, Vector< bool > &ref, int start_ix, int num_val) const
 
int queryarr (const char *name, std::vector< bool > &ref, int start_ix, int num_val) const
 
const char * prefix () const
 return prefix More...
 

Friends

class PP_entry
 

Detailed Description

Parse Parameters From Command Line and Input Files.

The ParmParse class is used to interpret parameters passed in to a program from the command line and an arbitrary collection of input files. The parameters are stored in static table that can be queried by any object of type ParmParse. A parameter can be either an "option" (usually specified on the command line) or a "definition". An option is of the form "-<name>" and is stored in the table without the hyphen. A definition is of the form "<name> = <value><value>...<value>". It is stored in the table as a name, value-list pair.

In the following example, verbose and no_opt are stored in the table as options. niter is a definition with the single integer value 10; name is a definition with the string value "big code" and dx is a definition with the two floating point values 0.5 and 0.75.

prog -verbose -no_opt niter = 10 name = "big code" dx = 0.5 0.75

The ParmParse class has two constructors. The first is responsible for building the table and is usually called by the main routine of an application. It has arguments for the command line argc and argv parameters, as well as an optional filename argument for reading definitions from an input file. The table is built by reading the input file first (if it exists) with the command line arguments added to the end of the table. The order of a definition in the table is significant, so command line parameters can be used to override definitions in the input file. A definition of the explicit form: FILE=<filename> is not added to the table but is a directive to include the named file at that point in the table.

The second constructor is generally used by other classes in the code. It permits access to the table via a large collection of query functions. Both constructors have an optional prefix argument that narrows the search to entries in the table with the same prefix. For example, let PlanR be a ParmParse object with code prefix "ope". PlanR.get("val",v) will look for an entry in the parameter list of the form: ope.val==

, and will reject all entries not starting with the correct code prefix.

The query functions search the table for definition names that match a given string (and prefix) and return values from the corresponding value list. The values can be returned as ints, Array<int>s, floats, std::vector<float>s, doubles, std::vector<double>s, std::strings, or std::vector<std::sring>s. All values in the table are stored as PP_String objects, but if an int, float, or double is requested, the translation is done automatically. In the previous example, the value of niter could be returned as either an std::string, an int, a double, or a float. The values of dx can be returned as std::strings, floats, or doubles, but the value of name can be returned only as an std::string.

Comments in an input file include all text from a `#' character to the end of the line. Here is a sample input file:

-no_garbage

niter = 100

title = "Double Wammy"

cell_size = 0.5 0.75

plot.var = Density 1 10

plot.var = Energy 5 12

bigarray = 1 2 3 4 5 6 7 8

9 10 11 12

test = apple "boy blue" 10 20 30 40

FILE = prob_file

Constructor & Destructor Documentation

◆ ParmParse() [1/3]

ParmParse::ParmParse ( int  argc,
char **  argv,
const char *  prefix = 0,
const char *  parfile = 0 
)

Construct an initial ParmParse object from the argc and argv passed in to main(). An error will be signalled if another ParmParse object currently exists. If parfile is specified, read the parameters in from that file first and then append those derived from argv to the table. If prefix is specified, load this string as the code prefix for this particular ParmParse object.

◆ ParmParse() [2/3]

ParmParse::ParmParse ( const char *  prefix = 0)

Construct an additional ParmParse object sharing the same internal table as any other such objects in existence. If prefix is specified, load this string as the code prefix for this particular ParmParse object. If there are no other existing objects, this doesn't do anything, and define() must be called before the object can be used.

◆ ParmParse() [3/3]

ParmParse::ParmParse ( const std::string &  a_string)

got sick of typing c_str()

◆ ~ParmParse()

ParmParse::~ParmParse ( )

The destructor. The internal static table will only be deleted if there are no other ParmParse objects in existence.

Member Function Documentation

◆ define()

void ParmParse::define ( int  argc,
char **  argv,
const char *  prefix = 0,
const char *  parfile = 0 
)

Initialize after calling the default constructor.

Same as the constructor with the same args.

◆ contains() [1/2]

bool ParmParse::contains ( const char *  name) const

Returns true if name is in table.

◆ contains() [2/2]

bool ParmParse::contains ( const std::string &  name) const

Returns true if name is in table.

◆ looseContains() [1/2]

bool ParmParse::looseContains ( const char *  name) const

Returns true if name is part of an entry in table. (i.e. returns true if name = "name.this" and there is a "name.this.list")

◆ looseContains() [2/2]

bool ParmParse::looseContains ( const std::string &  name) const

Returns true if name is in table.

◆ countval()

int ParmParse::countval ( const char *  name,
int  n = -1 
) const
inline

Returns the number of values associated with nth occurence of name (prepended with the prefix) in the table. n == -1 implies the last occurence.

References PP_entry.

◆ countname() [1/2]

int ParmParse::countname ( const char *  name) const

Returns the number of times the given name (prepended with prefix) appears in the table.

Referenced by countname().

◆ countname() [2/2]

int ParmParse::countname ( const std::string &  name) const
inline

Returns the number of times the given name (prepended with prefix) appears in the table.

References countname().

◆ addEntries()

void ParmParse::addEntries ( const std::string &  strEntry)
inline

Accessor for private method that adds parameters to the global table (SWS-Tech-X Research) e.g. parmParseObj.addEntries("tst_value = 2")

◆ setVal()

template<typename TYPE >
void ParmParse::setVal ( const std::string &  varName,
TYPE  varVal 
)
inline

Append input parameter pairs to ParmParse

  1. convert value to string
  2. construct string line syntax for ParmParse
  3. use special public method in ParmParse.H
Parameters
varNameparameter string name
varValnumerical value type

◆ setStr()

void ParmParse::setStr ( const std::string &  varName,
std::string  varVal 
)
inline

Append input parameter pairs to ParmParse

  1. convert value to string
  2. construct string line syntax for ParmParse
  3. use special public method in ParmParse.H
Parameters
varNameparameter string name
varValstring value type

References name().

◆ dumpTable()

void ParmParse::dumpTable ( std::ostream &  os) const

Write the contents of the table in ASCII to the ostream.

Referenced by getarr().

◆ get() [1/6]

void ParmParse::get ( const char *  name,
int &  ref,
int  ival = 0 
) const
inline

access single object

Get the ival'th value of last occurrence of the requested name. If successful, the value is converted to an int and stored in reference ref. If the name does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to an int, an error message is output and the program halts. Note that ival == 0 is the first value in the list.

◆ query() [1/6]

int ParmParse::query ( const char *  name,
int &  ref,
int  ival = 0 
) const
inline

Get the ival'th value of last occurrence of the requested name. If successful, the value is converted to an int and stored in reference ref. Returns 1 if successful. Returns 0 if the name does not exist. If ival'th value does not exist, or if the printed representation of the value cannot be converted to an int, an error message is output and the program halts. Note that ival == 0 is the first value in the list.

◆ get() [2/6]

void ParmParse::get ( const char *  name,
unsigned long &  ref,
int  ival = 0 
) const
inline

access single object

Get the ival'th value of last occurrence of the requested name. If successful, the value is converted to a n unsigned long and stored in reference ref. If the name does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to an int, an error message is output and the program halts. Note that ival == 0 is the first value in the list.

◆ query() [2/6]

int ParmParse::query ( const char *  name,
unsigned long &  ref,
int  ival = 0 
) const
inline

Get the ival'th value of last occurrence of the requested name. If successful, the value is converted to an unsigned long and stored in reference ref. Returns 1 if successful. Returns 0 if the name does not exist. If ival'th value does not exist, or if the printed representation of the value cannot be converted to an int, an error message is output and the program halts. Note that ival == 0 is the first value in the list.

◆ get() [3/6]

void ParmParse::get ( const char *  name,
float &  ref,
int  ival = 0 
) const
inline

Get the ival'th value of last occurrence of the requested name. If successful, the value is converted to a float and stored in reference ref. If the name does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to a float, an error message is output and the program halts. Note that ival == 0 is the first value in the list.

◆ query() [3/6]

int ParmParse::query ( const char *  name,
float &  ref,
int  ival = 0 
) const
inline

Get the ival'th value of last occurrence of the requested name. If successful, the value is converted to a float and stored in reference ref. Returns 1 if successful. Returns 0 if the name does not exist. If ival'th value does not exist, or if the printed representation of the value cannot be converted to a float, an error message is output and the program halts. Note that ival == 0 is the first value in the list.

◆ get() [4/6]

void ParmParse::get ( const char *  name,
double &  ref,
int  ival = 0 
) const
inline

Get the ival'th value of last occurrence of the requested name. If successful, the value is converted to a double and stored in reference ref. If the name does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to a double, an error message is output and the program halts. Note that ival == 0 is the first value in the list.

◆ query() [4/6]

int ParmParse::query ( const char *  name,
double &  ref,
int  ival = 0 
) const
inline

Get the ival'th value of last occurrence of the requested name. If successful, the value is converted to a double and stored in reference ref. Returns 1 if successful. Returns 0 if the name does not exist. If ival'th value does not exist, or if the printed representation of the value cannot be converted to a double, an error message is output and the program halts. Note that ival == 0 is the first value in the list.

◆ get() [5/6]

void ParmParse::get ( const char *  name,
std::string &  ref,
int  ival = 0 
) const
inline

Get the ival'th value of last occurrence of the requested name.

Get the ival'th value of last occurrence of the requested name. If successful, the value is converted to a string and stored in reference ref. If the name does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to a string, an error message is output and the program halts. Note that ival == 0 is the first value in the list.

◆ query() [5/6]

int ParmParse::query ( const char *  name,
std::string &  ref,
int  ival = 0 
) const
inline

Get the ival'th value of last occurrence of the requested name.

Get the ival'th value of last occurrence of the requested name. If successful, the value is converted to a string and stored in reference ref. Returns 1 if successful. Returns 0 if the name does not exist. If ival'th value does not exist, or if the printed representation of the value cannot be converted to a string, an error message is output and the program halts. Note that ival == 0 is the first value in the list.

◆ get() [6/6]

void ParmParse::get ( const char *  name,
bool &  ref,
int  ival = 0 
) const
inline

Get the ival'th value of last occurrence of the requested name.

Get the ival'th value of last occurrence of the requested name. If successful, the value is converted to a bool and stored in reference ref. If the name does not exist or ival'th value does not exist, or if the printed representation of the value cannot be converted to a bool, an error message is output and the program halts. Valid representations of bool are "true" and "false" (case is ignored), and numeric values 1 (=true) and 0 (=false). Note that ival == 0 is the first value in the list.

◆ query() [6/6]

int ParmParse::query ( const char *  name,
bool &  ref,
int  ival = 0 
) const
inline

Get the ival'th value of last occurrence of the requested name.

Get the ival'th value of last occurrence of the requested name. If successful, the value is converted to a bool and stored in reference ref. Returns 1 if successful. Returns 0 if the name does not exist. If ival'th value does not exist, or if the printed representation of the value cannot be converted to a bool, an error message is output and the program halts. Valid representations of bool are "true" and "false" (case is ignored), and numeric values 1 (=true) and 0 (=false). Note that ival == 0 is the first value in the list.

◆ getarr() [1/12]

void ParmParse::getarr ( const char *  name,
Vector< int > &  ref,
int  start_ix,
int  num_val 
) const
inline

access an array of objects

Gets a std::vector<int> of num_val values from last occurrence of given name. If successful, the values are converted to an int and stored in the std::vector<int> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<int>[0], std::vector<int>[1] holds start_ix+1, etc. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to an int, an error message is reported and the program halts.

References Vector< T >::resize(), and Vector< T >::size().

Referenced by getarr().

◆ getarr() [2/12]

void ParmParse::getarr ( const char *  name,
std::vector< int > &  ref,
int  start_ix,
int  num_val 
) const
inline

access an array of objects

Gets a std::vector<int> of num_val values from last occurrence of given name. If successful, the values are converted to an int and stored in the std::vector<int> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<int>[0], std::vector<int>[1] holds start_ix+1, etc. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to an int, an error message is reported and the program halts.

References getarr().

◆ queryarr() [1/12]

int ParmParse::queryarr ( const char *  name,
Vector< int > &  ref,
int  start_ix,
int  num_val 
) const
inline

access an array of objects

Gets a std::vector<int> of num_val values from last occurrence of given name. If successful, the values are converted to an int and stored in the std::vector<int> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<int>[0], std::vector<int>[1] holds start_ix+1, etc. Returns 0 if the name does not exist. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to an int, an error message is reported and the program halts.

References Vector< T >::resize(), and Vector< T >::size().

Referenced by getarr(), and queryarr().

◆ queryarr() [2/12]

int ParmParse::queryarr ( const char *  name,
std::vector< int > &  ref,
int  start_ix,
int  num_val 
) const
inline

access an array of objects

Gets a std::vector<int> of num_val values from last occurrence of given name. If successful, the values are converted to an int and stored in the std::vector<int> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<int>[0], std::vector<int>[1] holds start_ix+1, etc. Returns 0 if the name does not exist. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to an int, an error message is reported and the program halts.

References queryarr().

◆ getarr() [3/12]

void ParmParse::getarr ( const char *  name,
Vector< unsigned long > &  ref,
int  start_ix,
int  num_val 
) const

access an array of objects

Gets a std::vector<unsigned long> of num_val values from last occurrence of given name. If successful, the values are converted to an int and stored in the std::vector<unsigned long> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<unsigned long>[0], std::vector<unsigned long>[1] holds start_ix+1, etc. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to an unsigned long, an error message is reported and the program halts.

◆ getarr() [4/12]

void ParmParse::getarr ( const char *  name,
std::vector< unsigned long > &  ref,
int  start_ix,
int  num_val 
) const

access an array of objects

Gets a std::vector<unsigned long> of num_val values from last occurrence of given name. If successful, the values are converted to an unsigned long and stored in the std::vector<unsigned long> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<unsigned long>[0], std::vector<unsigned long>[1] holds start_ix+1, etc. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to an unsigned long, an error message is reported and the program halts.

◆ queryarr() [3/12]

int ParmParse::queryarr ( const char *  name,
Vector< unsigned long > &  ref,
int  start_ix,
int  num_val 
) const

access an array of objects

Gets a std::vector<unsigned long> of num_val values from last occurrence of given name. If successful, the values are converted to an unsigned long and stored in the std::vector<unsigned long> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<unsigned long>[0], std::vector<unsigned long>[1] holds start_ix+1, etc. Returns 0 if the name does not exist. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to an unsigned long, an error message is reported and the program halts.

◆ queryarr() [4/12]

int ParmParse::queryarr ( const char *  name,
std::vector< unsigned long > &  ref,
int  start_ix,
int  num_val 
) const

access an array of objects

Gets a std::vector<unsigned long> of num_val values from last occurrence of given name. If successful, the values are converted to an unsigned long and stored in the std::vector<unsigned long> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<unsigned long>[0], std::vector<unsigned long>[1] holds start_ix+1, etc. Returns 0 if the name does not exist. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to an unsigned long, an error message is reported and the program halts.

◆ getarr() [5/12]

void ParmParse::getarr ( const char *  name,
Vector< float > &  ref,
int  start_ix,
int  num_val 
) const
inline

access an array

Gets a std::vector<float> of num_val values from last occurrence of given name. If successful, the values are converted to a float and stored in the std::vector<float> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<float>[0], std::vector<float>[1] holds start_ix+1, etc. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a float, an error message is reported and the program halts.

References getarr(), Vector< T >::resize(), and Vector< T >::size().

◆ getarr() [6/12]

void ParmParse::getarr ( const char *  name,
std::vector< float > &  ref,
int  start_ix,
int  num_val 
) const
inline

access an array

Gets a std::vector<float> of num_val values from last occurrence of given name. If successful, the values are converted to a float and stored in the std::vector<float> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<float>[0], std::vector<float>[1] holds start_ix+1, etc. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a float, an error message is reported and the program halts.

References getarr().

◆ queryarr() [5/12]

int ParmParse::queryarr ( const char *  name,
Vector< float > &  ref,
int  start_ix,
int  num_val 
) const
inline

Gets a std::vector<float> of num_val values from last occurrence of given name. If successful, the values are converted to a float and stored in the std::vector<float> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<float>[0], std::vector<float>[1] holds start_ix+1, etc. Returns 0 if the name does not exist. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a float, an error message is reported and the program halts.

References queryarr(), Vector< T >::resize(), and Vector< T >::size().

◆ queryarr() [6/12]

int ParmParse::queryarr ( const char *  name,
std::vector< float > &  ref,
int  start_ix,
int  num_val 
) const
inline

Gets a std::vector<float> of num_val values from last occurrence of given name. If successful, the values are converted to a float and stored in the std::vector<float> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<float>[0], std::vector<float>[1] holds start_ix+1, etc. Returns 0 if the name does not exist. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a float, an error message is reported and the program halts.

References queryarr().

◆ getarr() [7/12]

void ParmParse::getarr ( const char *  name,
Vector< double > &  ref,
int  start_ix,
int  num_val 
) const
inline

Gets a std::vector<double> of num_val values from last occurrence of given name. If successful, the values are converted to a double and stored in the std::vector<double> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<double>[0], std::vector<double>[1] holds start_ix+1, etc. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a double, an error message is reported and the program halts.

References MayDay::Abort(), dumpTable(), queryarr(), Vector< T >::resize(), and Vector< T >::size().

◆ getarr() [8/12]

void ParmParse::getarr ( const char *  name,
std::vector< double > &  ref,
int  start_ix,
int  num_val 
) const
inline

Gets a std::vector<double> of num_val values from last occurrence of given name. If successful, the values are converted to a double and stored in the std::vector<double> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<double>[0], std::vector<double>[1] holds start_ix+1, etc. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a double, an error message is reported and the program halts.

References MayDay::Abort(), dumpTable(), and queryarr().

◆ queryarr() [7/12]

int ParmParse::queryarr ( const char *  name,
Vector< double > &  ref,
int  start_ix,
int  num_val 
) const
inline

Gets a std::vector<double> of num_val values from last occurrence of given name. If successful, the values are converted to a double and stored in the std::vector<double> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<double>[0], std::vector<double>[1] holds start_ix+1, etc. Returns 0 if the name does not exist. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a double, an error message is reported and the program halts.

References queryarr(), Vector< T >::resize(), and Vector< T >::size().

◆ queryarr() [8/12]

int ParmParse::queryarr ( const char *  name,
std::vector< double > &  ref,
int  start_ix,
int  num_val 
) const
inline

Gets a std::vector<double> of num_val values from last occurrence of given name. If successful, the values are converted to a double and stored in the std::vector<double> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<double>[0], std::vector<double>[1] holds start_ix+1, etc. Returns 0 if the name does not exist. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a double, an error message is reported and the program halts.

References queryarr().

◆ getarr() [9/12]

void ParmParse::getarr ( const char *  name,
Vector< std::string > &  ref,
int  start_ix,
int  num_val 
) const
inline

Gets a std::vector<string> of num_val values from last occurrence of given name. If successful, the values are converted to a string and stored in the std::vector<string> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<string>[0], std::vector<string>[1] holds start_ix+1, etc. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a string, an error message is reported and the program halts.

References getarr(), Vector< T >::resize(), and Vector< T >::size().

◆ getarr() [10/12]

void ParmParse::getarr ( const char *  name,
std::vector< std::string > &  ref,
int  start_ix,
int  num_val 
) const
inline

Gets a std::vector<string> of num_val values from last occurrence of given name. If successful, the values are converted to a string and stored in the std::vector<string> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<string>[0], std::vector<string>[1] holds start_ix+1, etc. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a string, an error message is reported and the program halts.

References getarr().

◆ queryarr() [9/12]

int ParmParse::queryarr ( const char *  name,
Vector< std::string > &  ref,
int  start_ix,
int  num_val 
) const
inline

Gets a std::vector<string> of num_val values from last occurrence of given name. If successful, the values are converted to a string and stored in the std::vector<string> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<string>[0], std::vector<string>[1] holds start_ix+1, etc. Returns 0 if the name does not exist. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a string, an error message is reported and the program halts.

References queryarr(), Vector< T >::resize(), and Vector< T >::size().

◆ queryarr() [10/12]

int ParmParse::queryarr ( const char *  name,
std::vector< std::string > &  ref,
int  start_ix,
int  num_val 
) const
inline

Gets a std::vector<string> of num_val values from last occurrence of given name. If successful, the values are converted to a string and stored in the std::vector<string> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<string>[0], std::vector<string>[1] holds start_ix+1, etc. Returns 0 if the name does not exist. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a string, an error message is reported and the program halts.

References queryarr().

◆ getarr() [11/12]

void ParmParse::getarr ( const char *  name,
Vector< bool > &  ref,
int  start_ix,
int  num_val 
) const

Gets a std::vector<bool> of num_val values from last occurrence of given name. If successful, the values are converted to a bool and stored in the std::vector<bool> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<bool>[0], std::vector<bool>[1] holds start_ix+1, etc. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a bool, an error message is reported and the program halts.

◆ getarr() [12/12]

void ParmParse::getarr ( const char *  name,
std::vector< bool > &  ref,
int  start_ix,
int  num_val 
) const
inline

Gets a std::vector<bool> of num_val values from last occurrence of given name. If successful, the values are converted to a bool and stored in the std::vector<bool> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<bool>[0], std::vector<bool>[1] holds start_ix+1, etc. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a bool, an error message is reported and the program halts.

References getarr().

◆ queryarr() [11/12]

int ParmParse::queryarr ( const char *  name,
Vector< bool > &  ref,
int  start_ix,
int  num_val 
) const

Gets a std::vector<bool> of num_val values from last occurrence of given name. If successful, the values are converted to a bool and stored in the std::vector<bool> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<bool>[0], std::vector<bool>[1] holds start_ix+1, etc. Returns 0 if the name does not exist. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a bool, an error message is reported and the program halts.

◆ queryarr() [12/12]

int ParmParse::queryarr ( const char *  name,
std::vector< bool > &  ref,
int  start_ix,
int  num_val 
) const
inline

Gets a std::vector<bool> of num_val values from last occurrence of given name. If successful, the values are converted to a bool and stored in the std::vector<bool> object ref. ref is resized (if necessary) to hold num_val values. The value in the list indexed by start_ix is copied into std::vector<bool>[0], std::vector<bool>[1] holds start_ix+1, etc. Returns 0 if the name does not exist. If there are fewer than start_ix + num_val values associated with the last occurrence, or if some of the values cannot be converted to a bool, an error message is reported and the program halts.

References queryarr().

◆ prefix()

const char* ParmParse::prefix ( ) const
inline

return prefix

References name(), and PP_entry.

Friends And Related Function Documentation

◆ PP_entry

friend class PP_entry
friend

Referenced by countval(), and prefix().


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