#include <APPSPACK_Parameter_List.hpp>
Definition at line 56 of file APPSPACK_Parameter_List.hpp.
Public Member Functions | |
| List () | |
| Constructor. | |
| List (const List &source) | |
| Copy constructor (deep copy). | |
| List & | operator= (const List &source) |
| Copy (deep copy). | |
| ~List () | |
| Destructor. | |
Sublists | |
The entries in a parameter list can be organized into sublists. | |
| List & | sublist (const string &name) |
| Create a new sublist or return the sublist if it already exists. | |
| const List & | sublist (const string &name) const |
| Returns a const reference to the sublist if it exists, otherwise throw an error. | |
Setting Parameters | |
Methods to set parameters in a List. Each parameter has a name and a value which is either bool, int, double, string, Value, or ::Vector. Be sure to use static_cast<type>() when the type is ambiguous. For example,
List list;
list.setParameter("Blah", static_cast<double>(0))
creates a double parameter named "Blah" with a value of zero. Both char* and string are stored as string's internally.
Sets "Used" to false and "Default" to false. | |
| void | setParameter (const string &name, bool value) |
| Set a bool parameter. | |
| void | setParameter (const string &name, int value) |
| Set an int parameter. | |
| void | setParameter (const string &name, double value) |
| Set a double parameter. | |
| void | setParameter (const string &name, const char *value) |
| Set a string parameter. | |
| void | setParameter (const string &name, const string &value) |
| Set a string parameter. | |
| void | setParameter (const string &name, const Vector &value) |
| Set an ::Vector parameter. | |
| void | setParameter (const string &name, const Matrix &value) |
| Set an ::Vector parameter. | |
Getting Parameters | |
Get the value of a parameter from the list. Returns the nominal value if the parameter is not already specified. Sets "Used" to true. The non-const version adds the nominal value to the list if it's not already specified. In this case, "Default" is set to true. Use static_cast<type>() when the type is ambiguous.
Both char* and string map return string values. | |
| bool | getParameter (const string &name, bool nominal) |
| Get a bool parameter. | |
| int | getParameter (const string &name, int nominal) |
| Get an int parameter. | |
| double | getParameter (const string &name, double nominal) |
| Get a double parameter. | |
| const string & | getParameter (const string &name, const char *nominal) |
| Get a string parameter. | |
| const string & | getParameter (const string &name, const string &nominal) |
| Get a string parameter. | |
| const Vector & | getParameter (const string &name, const Vector &nominal) |
| Get an ::Vector parameter. | |
| bool | getParameter (const string &name, bool nominal) const |
| Get a bool parameter - no change to the list. | |
| int | getParameter (const string &name, int nominal) const |
| Get an int parameter - no change to the list. | |
| double | getParameter (const string &name, double nominal) const |
| Get a double parameter - no change to the list. | |
| const string & | getParameter (const string &name, const char *nominal) const |
| Get a string parameter - no change to the list. | |
| const string & | getParameter (const string &name, const string &nominal) const |
| Get a string parameter - no change to the list. | |
| const Vector & | getParameter (const string &name, const Vector &nominal) const |
| Get an ::Vector parameter - no change to the list. | |
Getting Parameters Without Nominal Value | |
Get the value of a parameter from the list. Turns "Used" to true. Throws an error if the parameter does not exist or is not the correct type. | |
| double | getDoubleParameter (const string &name) const |
| Get a double parameter - no change to the list. | |
| const Vector & | getVectorParameter (const string &name) const |
| Get an APPSPACK::Vector parameter - no change to the list. | |
| const Matrix & | getMatrixParameter (const string &name) const |
| Get Matrix value. | |
Checking parameter existence. | |
Returns true if the specified parameter exists AND is of the specified type. | |
| bool | isParameter (const string &name) const |
| Return true if a parameter with this name exists. | |
| bool | isParameterBool (const string &name) const |
| Return true if a bool parameter with this name exists. | |
| bool | isParameterInt (const string &name) const |
| Return true if an int parameter with this name exists. | |
| bool | isParameterDouble (const string &name) const |
| Return true if a double parameter with this name exists. | |
| bool | isParameterString (const string &name) const |
| Return true if a string parameter with this name exists. | |
| bool | isParameterSublist (const string &name) const |
| Return true if a sublist with this name exists. | |
| bool | isParameterValue (const string &name) const |
| Return true if a Value parameter with this name exists. | |
| bool | isParameterVector (const string &name) const |
| Return true if a ::Vector parameter with this name exists. | |
| bool | isParameterMatrix (const string &name) const |
| Return true if a matrix parameter with this name exists. | |
Is Parameter Equal Value? | |
Returns true if the specified parameter exists AND is equal to the specified value. | |
| bool | isParameterEqual (const string &name, bool value) const |
| Return true if a bool parameter with this name exists and is equal to the specified value. | |
| bool | isParameterEqual (const string &name, int value) const |
| Return true if an int parameter with this name exists and is equal to the specified value. | |
| bool | isParameterEqual (const string &name, double value) const |
| Return true if a double parameter with this name exists and is equal to the specified value. | |
| bool | isParameterEqual (const string &name, const char *value) const |
| Return true if a string parameter with this name exists and is equal to the specified value. | |
| bool | isParameterEqual (const string &name, const string &value) const |
| Return true if a string parameter with this name exists and is equal to the specified value. | |
| bool | isParameterEqual (const string &name, const Vector &value) const |
| Return true if a ::Vector parameter with this name exists and is equal to the specified value. | |
Printing | |
| ostream & | print (ostream &stream=cout, int indent=0) const |
| Pretty-print a list. Indents sublists. | |
Pack/Unpack for Communication | |
| void | pack () const |
| Pack. | |
| void | unpack () |
| Unpack. | |
Private Types | |
| typedef map< string, Entry > | Map |
| Parameter container typedef. | |
| typedef Map::const_iterator | ConstIterator |
| Parameter container const iterator typedef. | |
| typedef Map::iterator | Iterator |
| Parameter container iterator typedef. | |
| enum | PackingCodes { NEW_ENTRY, END_OF_LIST } |
| Enums for pack/unpack. More... | |
Private Member Functions | |
| bool | isRecursive (const List &l) const |
| Check to see if "l" or any of its sublists is "this". | |
| const string & | name (ConstIterator i) const |
| Access to name (i.e., returns i->first). | |
| Entry & | entry (Iterator i) |
| Access to Entry (i.e., returns i->second). | |
| const Entry & | entry (ConstIterator i) const |
| Access to Entry (i.e., returns i->second). | |
Private Attributes | |
| Map | params |
| Parameter list. | |
| vector< string > | tmpstrings |
|
|
Parameter container typedef.
Definition at line 59 of file APPSPACK_Parameter_List.hpp. |
|
|
Parameter container const iterator typedef.
Definition at line 62 of file APPSPACK_Parameter_List.hpp. Referenced by getDoubleParameter(), getMatrixParameter(), getParameter(), getVectorParameter(), isParameterBool(), isParameterDouble(), isParameterEqual(), isParameterInt(), isParameterMatrix(), isParameterString(), isParameterSublist(), isParameterVector(), pack(), print(), and sublist(). |
|
|
Parameter container iterator typedef.
Definition at line 65 of file APPSPACK_Parameter_List.hpp. Referenced by sublist(). |
|
|
Enums for pack/unpack.
Definition at line 328 of file APPSPACK_Parameter_List.hpp. |
|
|
Constructor.
Definition at line 40 of file APPSPACK_Parameter_List.cpp. |
|
|
Copy constructor (deep copy).
Definition at line 42 of file APPSPACK_Parameter_List.cpp. References params. |
|
|
Destructor.
Definition at line 56 of file APPSPACK_Parameter_List.cpp. |
|
|
Copy (deep copy).
Definition at line 47 of file APPSPACK_Parameter_List.cpp. References params. |
|
|
Create a new sublist or return the sublist if it already exists. Creates and empty sublist and returns a reference to the sublist. If the list already exists, returns reference to that sublist. If the name exists but is not a sublist, throws an error. Definition at line 401 of file APPSPACK_Parameter_List.cpp. References entry(), APPSPACK::Parameter::Entry::getListValue(), APPSPACK::Parameter::Entry::isList(), Iterator, and params. Referenced by main(), master(), and APPSPACK::processTextInputFileLine(). |
|
|
Returns a const reference to the sublist if it exists, otherwise throw an error. If the list does not already exist, throws an error. If the name exists but is not a sublist, throws an error. Definition at line 420 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getListValue(), APPSPACK::Parameter::Entry::isList(), and params. |
|
||||||||||||
|
Set a bool parameter.
Definition at line 60 of file APPSPACK_Parameter_List.cpp. References params. Referenced by APPSPACK::Solver::initializeBestPointPtr(), main(), master(), and APPSPACK::processTextInputFileLine(). |
|
||||||||||||
|
Set an int parameter.
Definition at line 65 of file APPSPACK_Parameter_List.cpp. References params. |
|
||||||||||||
|
Set a double parameter.
Definition at line 70 of file APPSPACK_Parameter_List.cpp. References params. |
|
||||||||||||
|
Set a string parameter.
Definition at line 75 of file APPSPACK_Parameter_List.cpp. References params. |
|
||||||||||||
|
Set a string parameter.
Definition at line 80 of file APPSPACK_Parameter_List.cpp. References params. |
|
||||||||||||
|
Set an ::Vector parameter.
Definition at line 85 of file APPSPACK_Parameter_List.cpp. References params. |
|
||||||||||||
|
Set an ::Vector parameter.
Definition at line 90 of file APPSPACK_Parameter_List.cpp. References params. |
|
||||||||||||
|
||||||||||||
|
Get an int parameter.
Definition at line 111 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getIntValue(), APPSPACK::Parameter::Entry::isInt(), params, and APPSPACK::Parameter::Entry::setValue(). |
|
||||||||||||
|
Get a double parameter.
Definition at line 127 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getDoubleValue(), APPSPACK::Parameter::Entry::isDouble(), params, and APPSPACK::Parameter::Entry::setValue(). |
|
||||||||||||
|
Get a string parameter.
Definition at line 144 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getStringValue(), APPSPACK::Parameter::Entry::isString(), params, and APPSPACK::Parameter::Entry::setValue(). |
|
||||||||||||
|
Get a string parameter.
Definition at line 160 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getStringValue(), APPSPACK::Parameter::Entry::isString(), params, and APPSPACK::Parameter::Entry::setValue(). |
|
||||||||||||
|
Get an ::Vector parameter.
Definition at line 176 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getVectorValue(), APPSPACK::Parameter::Entry::isVector(), params, and APPSPACK::Parameter::Entry::setValue(). |
|
||||||||||||
|
Get a bool parameter - no change to the list.
Definition at line 193 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getBoolValue(), APPSPACK::Parameter::Entry::isBool(), and params. |
|
||||||||||||
|
Get an int parameter - no change to the list.
Definition at line 201 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getIntValue(), APPSPACK::Parameter::Entry::isInt(), and params. |
|
||||||||||||
|
Get a double parameter - no change to the list.
Definition at line 209 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getDoubleValue(), APPSPACK::Parameter::Entry::isDouble(), and params. |
|
||||||||||||
|
Get a string parameter - no change to the list.
Definition at line 217 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getStringValue(), APPSPACK::Parameter::Entry::isString(), params, and tmpstrings. |
|
||||||||||||
|
Get a string parameter - no change to the list.
Definition at line 228 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getStringValue(), APPSPACK::Parameter::Entry::isString(), and params. |
|
||||||||||||
|
Get an ::Vector parameter - no change to the list.
Definition at line 236 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getVectorValue(), APPSPACK::Parameter::Entry::isVector(), and params. |
|
|
Get a double parameter - no change to the list.
Definition at line 245 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getDoubleValue(), APPSPACK::Parameter::Entry::isDouble(), and params. Referenced by APPSPACK::Solver::initializeBestPointPtr(), APPSPACK::Cache::Manager::Manager(), and APPSPACK::Solver::setup(). |
|
|
Get an APPSPACK::Vector parameter - no change to the list.
Definition at line 256 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getVectorValue(), APPSPACK::Parameter::Entry::isVector(), and params. Referenced by APPSPACK::Solver::initializeBestPointPtr(), APPSPACK::Cache::Manager::Manager(), APPSPACK::Constraints::Linear::setupBounds(), and APPSPACK::Constraints::Linear::setupRhs(). |
|
|
Get Matrix value.
Definition at line 267 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getMatrixValue(), APPSPACK::Parameter::Entry::isMatrix(), and params. Referenced by APPSPACK::Constraints::Linear::setupMatrix(). |
|
|
Return true if a parameter with this name exists.
Definition at line 348 of file APPSPACK_Parameter_List.cpp. References params. Referenced by APPSPACK::Solver::initializeBestPointPtr(), and APPSPACK::Solver::setup(). |
|
|
Return true if a bool parameter with this name exists.
Definition at line 278 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::isBool(), and params. |
|
|
Return true if an int parameter with this name exists.
Definition at line 288 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::isInt(), and params. |
|
|
Return true if a double parameter with this name exists.
Definition at line 298 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::isDouble(), and params. Referenced by APPSPACK::Solver::initializeBestPointPtr(), and APPSPACK::Solver::setup(). |
|
|
Return true if a string parameter with this name exists.
Definition at line 308 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::isString(), and params. |
|
|
Return true if a sublist with this name exists.
Definition at line 318 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::isList(), and params. Referenced by main(). |
|
|
Return true if a Value parameter with this name exists.
|
|
|
Return true if a ::Vector parameter with this name exists.
Definition at line 328 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::isVector(), and params. Referenced by APPSPACK::Solver::initializeBestPointPtr(), APPSPACK::Cache::Manager::Manager(), APPSPACK::Constraints::Linear::setupBounds(), and APPSPACK::Constraints::Linear::setupRhs(). |
|
|
Return true if a matrix parameter with this name exists.
Definition at line 338 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::isMatrix(), and params. Referenced by APPSPACK::Constraints::Linear::setupMatrix(). |
|
||||||||||||
|
Return true if a bool parameter with this name exists and is equal to the specified value.
Definition at line 353 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getBoolValue(), APPSPACK::Parameter::Entry::isBool(), and params. |
|
||||||||||||
|
Return true if an int parameter with this name exists and is equal to the specified value.
Definition at line 361 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getIntValue(), APPSPACK::Parameter::Entry::isInt(), and params. |
|
||||||||||||
|
Return true if a double parameter with this name exists and is equal to the specified value.
Definition at line 369 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getDoubleValue(), APPSPACK::Parameter::Entry::isDouble(), and params. |
|
||||||||||||
|
Return true if a string parameter with this name exists and is equal to the specified value.
Definition at line 377 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getStringValue(), APPSPACK::Parameter::Entry::isString(), and params. |
|
||||||||||||
|
Return true if a string parameter with this name exists and is equal to the specified value.
Definition at line 385 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getStringValue(), APPSPACK::Parameter::Entry::isString(), and params. |
|
||||||||||||
|
Return true if a ::Vector parameter with this name exists and is equal to the specified value.
Definition at line 393 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getVectorValue(), APPSPACK::Parameter::Entry::isVector(), and params. |
|
||||||||||||
|
Pretty-print a list. Indents sublists.
Definition at line 440 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getListValue(), APPSPACK::Parameter::Entry::isList(), name(), and params. |
|
|
Pack.
Definition at line 464 of file APPSPACK_Parameter_List.cpp. References ConstIterator, END_OF_LIST, entry(), name(), NEW_ENTRY, APPSPACK::Parameter::Entry::pack(), and params. Referenced by main(), and APPSPACK::Parameter::Entry::pack(). |
|
|
Unpack.
Definition at line 475 of file APPSPACK_Parameter_List.cpp. References params, and APPSPACK::Parameter::Entry::unpack(). Referenced by main(), and APPSPACK::Parameter::Entry::unpack(). |
|
|
Check to see if "l" or any of its sublists is "this".
|
|
|
Access to name (i.e., returns i->first).
Definition at line 510 of file APPSPACK_Parameter_List.cpp. |
|
|
Access to Entry (i.e., returns i->second).
Definition at line 515 of file APPSPACK_Parameter_List.cpp. Referenced by getDoubleParameter(), getMatrixParameter(), getParameter(), getVectorParameter(), isParameterBool(), isParameterDouble(), isParameterEqual(), isParameterInt(), isParameterMatrix(), isParameterString(), isParameterSublist(), isParameterVector(), pack(), print(), and sublist(). |
|
|
Access to Entry (i.e., returns i->second).
Definition at line 520 of file APPSPACK_Parameter_List.cpp. |
|
|
Parameter list.
Definition at line 337 of file APPSPACK_Parameter_List.hpp. Referenced by getDoubleParameter(), getMatrixParameter(), getParameter(), getVectorParameter(), isParameter(), isParameterBool(), isParameterDouble(), isParameterEqual(), isParameterInt(), isParameterMatrix(), isParameterString(), isParameterSublist(), isParameterVector(), List(), operator=(), pack(), print(), setParameter(), sublist(), and unpack(). |
|
|
Used to create a string when the getParameter is called with a char* nominal value. A new string is created for each such argument. The whole group of strings is destroyed when this object is destroyed. This is really annoying, but I don't know a better way. Definition at line 344 of file APPSPACK_Parameter_List.hpp. Referenced by getParameter(). |
![]()
© Sandia Corporation | Site Contact | Privacy and Security
![]()
Generated on Fri Feb 16 10:33:36 2007 for APPSPACK 5.0.1 by
1.3.9.1 written by Dimitri van Heesch,
© 1997-2002