#include <APPSPACK_Parameter_List.hpp>
Definition at line 55 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 paraemter 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 Value &value) |
Set an Value parameter. | |
void | setParameter (const string &name, const Vector &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 Value & | getParameter (const string &name, const Value &nominal) |
Get an Value 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 Value & | getParameter (const string &name, const Value &nominal) const |
Get an Value 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" tp 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 Value & | getValueParameter (const string &name) const |
Get an APPSPACK::Value parameter - no change to the list. | |
const Vector & | getVectorParameter (const string &name) const |
Get an APPSPACK::Vector parameter - no change to the list. | |
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. | |
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 Value &value) const |
Return true if a Value 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 58 of file APPSPACK_Parameter_List.hpp. |
|
Parameter container const iterator typedef. Definition at line 61 of file APPSPACK_Parameter_List.hpp. Referenced by entry(), getDoubleParameter(), getParameter(), getValueParameter(), getVectorParameter(), isParameterBool(), isParameterDouble(), isParameterEqual(), isParameterInt(), isParameterString(), isParameterSublist(), isParameterValue(), isParameterVector(), name(), pack(), print(), and sublist(). |
|
Parameter container iterator typedef. Definition at line 64 of file APPSPACK_Parameter_List.hpp. |
|
Enums for pack/unpack.
|
|
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 420 of file APPSPACK_Parameter_List.cpp. References entry(), APPSPACK::Parameter::Entry::getListValue(), APPSPACK::Parameter::Entry::isList(), Iterator, and params. Referenced by main(), 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 457 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::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 Value 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, and APPSPACK::Vector. |
|
Get a bool parameter. Definition at line 96 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getBoolValue(), APPSPACK::Parameter::Entry::isBool(), and params. Referenced by APPSPACK::Solver::initializeBestPointPtr(), APPSPACK::Cache::Manager::Manager(), APPSPACK::Cache::Manager::openOutputFile(), APPSPACK::Cache::Manager::parseInputFile(), APPSPACK::Print::Print(), APPSPACK::Constraints::Bounds::setup(), and APPSPACK::Solver::Solver(). |
|
Get an int parameter. Definition at line 112 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getIntValue(), APPSPACK::Parameter::Entry::isInt(), and params. |
|
Get a double parameter. Definition at line 128 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getDoubleValue(), APPSPACK::Parameter::Entry::isDouble(), and params. |
|
Get a string parameter. Definition at line 145 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getStringValue(), APPSPACK::Parameter::Entry::isString(), and params. |
|
Get a string parameter. Definition at line 161 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getStringValue(), APPSPACK::Parameter::Entry::isString(), and params. |
|
Get an Value parameter. Definition at line 177 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getValueValue(), APPSPACK::Parameter::Entry::isValue(), and params. |
|
Get an Vector parameter. Definition at line 194 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getVectorValue(), APPSPACK::Parameter::Entry::isVector(), params, and APPSPACK::Vector. |
|
Get a bool parameter - no change to the list. Definition at line 211 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 219 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 227 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 235 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 246 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getStringValue(), APPSPACK::Parameter::Entry::isString(), and params. |
|
Get an Value parameter - no change to the list. Definition at line 254 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getValueValue(), APPSPACK::Parameter::Entry::isValue(), and params. |
|
Get an Vector parameter - no change to the list. Definition at line 262 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getVectorValue(), APPSPACK::Parameter::Entry::isVector(), params, and APPSPACK::Vector. |
|
Get a double parameter - no change to the list. Definition at line 271 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::Solver(). |
|
Get an APPSPACK::Value parameter - no change to the list. Definition at line 282 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getValueValue(), APPSPACK::Parameter::Entry::isValue(), and params. Referenced by APPSPACK::Solver::initializeBestPointPtr(), APPSPACK::Cache::Manager::Manager(), and APPSPACK::Solver::Solver(). |
|
Get an APPSPACK::Vector parameter - no change to the list. Definition at line 293 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getVectorValue(), APPSPACK::Parameter::Entry::isVector(), params, and APPSPACK::Vector. Referenced by APPSPACK::Cache::Manager::Manager(), and APPSPACK::Constraints::Bounds::setup(). |
|
Return true if a parameter with this name exists. Definition at line 374 of file APPSPACK_Parameter_List.cpp. References params. Referenced by APPSPACK::Solver::initializeBestPointPtr(), and APPSPACK::Solver::Solver(). |
|
Return true if a bool parameter with this name exists. Definition at line 304 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 314 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 324 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::isDouble(), and params. Referenced by APPSPACK::Solver::initializeBestPointPtr(), APPSPACK::Cache::Manager::Manager(), and APPSPACK::Solver::Solver(). |
|
Return true if a string parameter with this name exists. Definition at line 334 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 344 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::isList(), and params. |
|
Return true if a Value parameter with this name exists. Definition at line 354 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::isValue(), and params. Referenced by APPSPACK::Solver::initializeBestPointPtr(), APPSPACK::Cache::Manager::Manager(), and APPSPACK::Solver::Solver(). |
|
Return true if a Vector parameter with this name exists. Definition at line 364 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::isVector(), and params. Referenced by APPSPACK::Cache::Manager::Manager(), and APPSPACK::Constraints::Bounds::setup(). |
|
Return true if a bool parameter with this name exists and is equal to the specified value. Definition at line 379 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 387 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 395 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 403 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 411 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getStringValue(), APPSPACK::Parameter::Entry::isString(), and params. |
|
Return true if a Value parameter with this name exists and is equal to the specified value. Definition at line 439 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getValueValue(), APPSPACK::Parameter::Entry::isValue(), and params. |
|
Return true if a Vector parameter with this name exists and is equal to the specified value. Definition at line 448 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getVectorValue(), APPSPACK::Parameter::Entry::isVector(), params, and APPSPACK::Vector. |
|
Pretty-print a list. Indents sublists. Definition at line 477 of file APPSPACK_Parameter_List.cpp. References ConstIterator, entry(), APPSPACK::Parameter::Entry::getListValue(), APPSPACK::Parameter::Entry::isList(), name(), and params. |
|
Pack. Definition at line 501 of file APPSPACK_Parameter_List.cpp. References ConstIterator, END_OF_LIST, entry(), name(), NEW_ENTRY, APPSPACK::Parameter::Entry::pack(), APPSPACK::GCI::pack(), and params. Referenced by APPSPACK::Parameter::Entry::pack(). |
|
Unpack. Definition at line 512 of file APPSPACK_Parameter_List.cpp. References END_OF_LIST, name(), params, and APPSPACK::GCI::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 547 of file APPSPACK_Parameter_List.cpp. References ConstIterator. |
|
Access to Entry (i.e., returns i->second). Definition at line 552 of file APPSPACK_Parameter_List.cpp. References Iterator. Referenced by getDoubleParameter(), getParameter(), getValueParameter(), getVectorParameter(), isParameterBool(), isParameterDouble(), isParameterEqual(), isParameterInt(), isParameterString(), isParameterSublist(), isParameterValue(), isParameterVector(), pack(), print(), and sublist(). |
|
Access to Entry (i.e., returns i->second). Definition at line 557 of file APPSPACK_Parameter_List.cpp. References ConstIterator. |
|
Parameter list. Definition at line 342 of file APPSPACK_Parameter_List.hpp. Referenced by getDoubleParameter(), getParameter(), getValueParameter(), getVectorParameter(), isParameter(), isParameterBool(), isParameterDouble(), isParameterEqual(), isParameterInt(), isParameterString(), isParameterSublist(), isParameterValue(), 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 349 of file APPSPACK_Parameter_List.hpp. Referenced by getParameter(). |
© Sandia Corporation | Site Contact | Privacy and Security
Generated on Wed Dec 14 18:41:05 2005 for APPSPACK 4.0.2 by
1.3.8 written by Dimitri van Heesch,
© 1997-2002