#include <stdlib.h>#include <string.h>#include "ParseOptions.h"#include "ConfigList.h"#include "InfoStream.h"#include "strlib.h"Go to the source code of this file.
Defines | |
| #define | dataelement_cons_macro_default(Mtype, MType, Mptr, Mdef) |
| #define | dataelement_cons_macro(Mtype, MType, Mptr) |
| #define | parse_input_macro_default(fctnname, type, optional) |
| routines to add dependencies to the array | |
| #define | parse_input_macro(fctnname, type, optional) |
| #define | parse_input_macro_default_b(fctnname, type, optional, extra) |
| #define | parse_input_macro_b(fctnname, type, optional, extra) |
| #define | parse_stringlist_macro(fctn, xxx) |
| #define | set_macro(type, field, fieldptr) |
| #define | simple_set_macro(type, field, fieldptr) |
Functions | |
| const char * | rstring (Range r) |
| const char * | ustring (Units u) |
| Units | next (Units u) |
| BigReal | convert (Units to, Units from) |
| char * | Strdup (const char *newname) |
| dataelement_cons_macro_default (BigReal, FLOAT, fptr, fdef) | |
| dataelement_cons_macro_default (int, INT, iptr, idef) | |
| dataelement_cons_macro_default (unsigned int, UINT, uiptr, uidef) | |
| dataelement_cons_macro_default (Vector, VECTOR, vptr, vdef) | |
| dataelement_cons_macro (BigReal, FLOAT, fptr) | |
| dataelement_cons_macro (Vector, VECTOR, vptr) | |
| dataelement_cons_macro (int, INT, iptr) | |
| dataelement_cons_macro (unsigned int, UINT, uiptr) | |
| dataelement_cons_macro (char, STRING, sptr) | |
| parse_input_macro (require, BigReal, FALSE) | |
| parse_input_macro (require, Vector, FALSE) | |
| parse_input_macro (require, int, FALSE) | |
| parse_input_macro (require, unsigned int, FALSE) | |
| parse_input_macro_b (requireB, int, FALSE, tmp->type=DataElement::BOOL) | |
| parse_input_macro (require, char, FALSE) | |
| parse_input_macro (optional, BigReal, TRUE) | |
| parse_input_macro (optional, Vector, TRUE) | |
| parse_input_macro (optional, int, TRUE) | |
| parse_input_macro (optional, unsigned int, TRUE) | |
| parse_input_macro_b (optionalB, int, TRUE, tmp->type=DataElement::BOOL) | |
| parse_input_macro (optional, char, TRUE) | |
| parse_input_macro_default (require, BigReal, FALSE) | |
| parse_input_macro_default (require, Vector, FALSE) | |
| parse_input_macro_default (require, int, FALSE) | |
| parse_input_macro_default (require, unsigned int, FALSE) | |
| parse_input_macro_default_b (requireB, int, FALSE, tmp->type=DataElement::BOOL) | |
| parse_input_macro_default (optional, BigReal, TRUE) | |
| parse_input_macro_default (optional, Vector, TRUE) | |
| parse_input_macro_default (optional, int, TRUE) | |
| parse_input_macro_default (optional, unsigned int, TRUE) | |
| parse_input_macro_default_b (optionalB, int, TRUE, tmp->type=DataElement::BOOL) | |
| parse_stringlist_macro (require, FALSE) | |
| parse_stringlist_macro (optional, TRUE) | |
| set_macro (float, fdata, fptr) | |
| set_macro (int, idata, iptr) | |
| set_macro (uint, uidata, uiptr) | |
| simple_set_macro (bool, idata, iptr) | |
| simple_set_macro (vector, vdata, vptr) | |
| simple_set_macro (stringlist, sldata, slptr) | |
Variables | |
| const char * | unit_string_array [N_UNITS_UNDEFINED+1] |
| BigReal | scaling_factors [N_UNITS_UNDEFINED+1] |
|
|
Value: ParseOptions::DataElement::DataElement(const char *newname, \ const char *newparent, int optional, const char *err, \ Mtype *ptr) \ { \ init(newname, newparent, optional, err); \ type = MType; \ Mptr = ptr; \ } Definition at line 148 of file ParseOptions.C. |
|
|
Value: ParseOptions::DataElement::DataElement(const char *newname, \ const char *newparent, int optional, const char *err, \ Mtype *ptr, Mtype defalt) \ { \ init(newname, newparent, optional, err); \ type = MType; \ Mptr = ptr; \ Mdef = defalt; \ has_default = TRUE; \ } Definition at line 136 of file ParseOptions.C. |
|
|
Value: int ParseOptions::fctnname(const char *parent, const char *newname, \ const char *msg, type *ptr) \ { \ DataElement *tmp = new DataElement(newname, parent, optional, msg, \ ptr); \ if (!make_dependencies(tmp)) { \ iout << iERROR << "ParseOption '" << newname << "' already exists" << "\n" << endi; \ return FALSE; \ } \ add_element(tmp); \ return TRUE; \ } Definition at line 279 of file ParseOptions.C. |
|
|
Value: int ParseOptions::fctnname(const char *parent, const char *newname, \ const char *msg, type *ptr) \ { \ DataElement *tmp = new DataElement(newname, parent, optional, msg, \ ptr); \ if (!make_dependencies(tmp)) { \ iout << iERROR << "ParseOption '" << newname << "' already exists" << "\n" << endi; \ return FALSE; \ } \ add_element(tmp); \ extra; \ return TRUE; \ } Definition at line 306 of file ParseOptions.C. |
|
|
Value: int ParseOptions::fctnname(const char *parent, const char *newname, \ const char *msg, type *ptr, type defalt) \ { \ DataElement *tmp = new DataElement(newname, parent, optional, msg, \ ptr, defalt); \ if (!make_dependencies(tmp)) { \ iout << iERROR << "ParseOption '" << newname << "' already exists" << "\n" << endi; \ return FALSE; \ } \ add_element(tmp); \ return TRUE; \ }
Definition at line 266 of file ParseOptions.C. |
|
|
Value: int ParseOptions::fctnname(const char *parent, const char *newname, \ const char *msg, type *ptr, type defalt) \ { \ DataElement *tmp = new DataElement(newname, parent, optional, msg, \ ptr, defalt); \ if (!make_dependencies(tmp)) { \ iout << iERROR << "ParseOption '" << newname << "' already exists" << "\n" << endi; \ return FALSE; \ } \ add_element(tmp); \ extra; \ return TRUE; \ } Definition at line 292 of file ParseOptions.C. |
|
|
Value: int ParseOptions::fctn(const char *parent, const char *newname, \ const char *msg, StringList **ptr, int many_allowed)\ { \ DataElement *tmp = new DataElement(newname, parent, xxx, msg, \ ptr, many_allowed); \ if (!make_dependencies(tmp)) { \ iout << iERROR << "ParseOption '" << newname << "' already exists" << "\n" << endi;\ return FALSE; \ } \ add_element(tmp); \ return TRUE; \ } Definition at line 347 of file ParseOptions.C. |
|
|
Value: int ParseOptions::set_##type(DataElement *el) \ { \ if (el->range == FREE_RANGE || \ (el->range == POSITIVE && el->field > 0) || \ (el->range == NOT_NEGATIVE && el->field >= 0) || \ (el->range == NEGATIVE && el->field < 0) || \ (el->range == NOT_POSITIVE && el->field <= 0)) { \ if (el->fieldptr) *(el->fieldptr) = el->field; \ return 1; \ } \ iout << iERROR << "'" << el->name << "' was set to " << el->field << " but it " \ << "should be " << rstring(el->range) \ << "\n" << endi; \ return 0; \ } Definition at line 588 of file ParseOptions.C. |
|
|
Value: void ParseOptions::set_##type(DataElement *el) \ { \ if (el->fieldptr) *(el->fieldptr) = el->field; \ } Definition at line 609 of file ParseOptions.C. |
|
||||||||||||
|
Definition at line 85 of file ParseOptions.C. References BigReal, N_FSEC, N_KCAL, N_KELVIN, N_KJOULE, N_METER, N_MIN, N_NANOMETER, N_NSEC, N_SEC, N_UNIT, and scaling_factors. 00086 {
00087 // cout << "Converting from " << string(from) << " to " << string(to) << std::endl;
00088 // cout << scaling_factors[from] << " <--> " << scaling_factors[to] << std::endl;
00089 if (from == N_UNIT && to == N_UNIT) { return 1.0; }
00090 if ((from == N_NSEC || from == N_FSEC || from == N_SEC || from == N_MIN ||
00091 from == N_HOUR) &&
00092 (to == N_NSEC || to == N_FSEC || to == N_SEC || to == N_MIN ||
00093 to == N_HOUR)) {
00094 return scaling_factors[from]/scaling_factors[to];
00095 }
00096 if ((from == N_METER || from == N_NANOMETER || from == N_ANGSTROM) &&
00097 (to == N_METER || to == N_NANOMETER || to == N_ANGSTROM)) {
00098 return scaling_factors[from]/scaling_factors[to];
00099 }
00100 if ((from == N_KCAL || from == N_KJOULE || from == N_EV) &&
00101 (to == N_KCAL || to == N_KJOULE || to == N_EV)) {
00102 return scaling_factors[from]/scaling_factors[to];
00103 }
00104 if (from == N_KELVIN && to == N_KELVIN) {
00105 return scaling_factors[from]/scaling_factors[to];
00106 }
00107 return 0.0;
00108 }
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
|
Definition at line 44 of file ParseOptions.C. References N_ANGSTROM, N_EV, N_FSEC, N_HOUR, N_KCAL, N_KELVIN, N_KJOULE, N_METER, N_MIN, N_NANOMETER, N_NSEC, N_SEC, N_UNIT, and Units. Referenced by Rebalancer::refine(), and Entry< ProxyElem >::removeSelf(). 00044 {
00045 switch (u) {
00046 case N_UNIT: return N_FSEC;
00047 case N_FSEC: return N_NSEC;
00048 case N_NSEC: return N_SEC;
00049 case N_SEC: return N_MIN;
00050 case N_MIN: return N_HOUR;
00051 case N_HOUR: return N_ANGSTROM;
00052 case N_ANGSTROM: return N_NANOMETER;
00053 case N_NANOMETER: return N_METER;
00054 case N_METER: return N_KCAL;
00055 case N_KCAL: return N_KJOULE;
00056 case N_KJOULE: return N_EV;
00057 case N_EV: return N_KELVIN;
00058 case N_KELVIN: return N_UNITS_UNDEFINED;
00059 default: return N_UNITS_UNDEFINED;
00060 }
00061 }
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
|
Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved. Definition at line 21 of file ParseOptions.C. References FREE_RANGE, NEGATIVE, NOT_NEGATIVE, NOT_POSITIVE, and POSITIVE. 00022 {
00023 switch (r) {
00024 case FREE_RANGE: return "unconstrained";
00025 case POSITIVE: return "positive";
00026 case NOT_NEGATIVE: return "non-negative";
00027 case NEGATIVE: return "negative";
00028 case NOT_POSITIVE: return "non-positive";
00029 default: return "error in rstring(Range )";
00030 }
00031 }
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
|
Definition at line 110 of file ParseOptions.C. 00111 {
00112 char *tmp = new char[strlen(newname)+1];
00113 strcpy(tmp, newname);
00114 return tmp;
00115 }
|
|
|
Definition at line 38 of file ParseOptions.C. References unit_string_array. Referenced by ParseOptions::units(). 00039 {
00040 return unit_string_array[u];
00041 }
|
|
|
Initial value: {
1, 1, 1000, 1E15, 60E15, 3600E15, 1, 10, 1E10, 1, 1/4.1855, 1/23.052,
1, 0
}
Definition at line 78 of file ParseOptions.C. Referenced by convert(). |
|
|
Initial value: {
"", "fs", "ns", "sec", "min", "hr", "A", "nm", "m",
"kcal", "kJ", "eV", "K", "undefined units"
}
Definition at line 33 of file ParseOptions.C. Referenced by ustring(). |
1.3.9.1