#include <IpOptionsList.hpp>
Inheritance diagram for Ipopt::OptionsList:
Public Member Functions | |
void | clear () |
Method for clearing all previously set options. | |
void | PrintList (std::string &list) const |
Get a string with the list of all options (tag, value, counter). | |
void | PrintUserOptions (std::string &list) const |
Get a string with the list of all options set by the user (tag, value, use/notused). | |
bool | ReadFromStream (const Journalist &jnlst, std::istream &is) |
Read options from the stream is. | |
Constructors/Destructors | |
OptionsList (SmartPtr< RegisteredOptions > reg_options, SmartPtr< Journalist > jnlst) | |
OptionsList () | |
OptionsList (const OptionsList ©) | |
Copy Constructor. | |
virtual | ~OptionsList () |
Default destructor. | |
void | operator= (const OptionsList &source) |
Overloaded Equals Operator. | |
Get / Set Methods | |
void | SetRegisteredOptions (const SmartPtr< RegisteredOptions > reg_options) |
void | SetJournalist (const SmartPtr< Journalist > jnlst) |
Methods for setting options | |
bool | SetStringValue (const std::string &tag, const std::string &value, bool allow_clobber=true, bool dont_print=false) |
bool | SetNumericValue (const std::string &tag, Number value, bool allow_clobber=true, bool dont_print=false) |
bool | SetIntegerValue (const std::string &tag, Index value, bool allow_clobber=true, bool dont_print=false) |
Methods for setting options only if they have not been | |
set before | |
bool | SetStringValueIfUnset (const std::string &tag, const std::string &value, bool allow_clobber=true, bool dont_print=false) |
bool | SetNumericValueIfUnset (const std::string &tag, Number value, bool allow_clobber=true, bool dont_print=false) |
bool | SetIntegerValueIfUnset (const std::string &tag, Index value, bool allow_clobber=true, bool dont_print=false) |
Methods for retrieving values from the options list. If | |
a tag is not found, the methods return false, and value is set to the default value defined in the registered options. | |
bool | GetStringValue (const std::string &tag, std::string &value, const std::string &prefix) const |
bool | GetEnumValue (const std::string &tag, Index &value, const std::string &prefix) const |
bool | GetBoolValue (const std::string &tag, bool &value, const std::string &prefix) const |
bool | GetNumericValue (const std::string &tag, Number &value, const std::string &prefix) const |
bool | GetIntegerValue (const std::string &tag, Index &value, const std::string &prefix) const |
Private Member Functions | |
const std::string & | lowercase (const std::string tag) const |
auxilliary method for converting sting to all lower-case letters | |
bool | find_tag (const std::string &tag, const std::string &prefix, std::string &value) const |
auxilliary method for finding the value for a tag in the options list. | |
bool | will_allow_clobber (const std::string &tag) const |
tells whether or not we can clobber a particular option. | |
bool | readnexttoken (std::istream &is, std::string &token) |
read the next token from stream is. | |
Private Attributes | |
std::map< std::string, OptionValue > | options_ |
map for storing the options | |
SmartPtr< RegisteredOptions > | reg_options_ |
list of all the registered options to validate against | |
SmartPtr< Journalist > | jnlst_ |
Journalist for writing error messages, etc. | |
std::string | lowercase_buffer_ |
auxilliary string set by lowercase method | |
Classes | |
class | OptionValue |
Class for storing the value and counter for each option in OptionsList. More... |
Each options is identified by a case-insensitive keyword (tag). Its value is stored internally as a string (always lower case), but for convenience set and get methods are provided to obtain Index and Number type values. For each keyword we also keep track of how often the value of an option has been requested by a get method.
Definition at line 32 of file IpOptionsList.hpp.
Ipopt::OptionsList::OptionsList | ( | SmartPtr< RegisteredOptions > | reg_options, | |
SmartPtr< Journalist > | jnlst | |||
) | [inline] |
Definition at line 142 of file IpOptionsList.hpp.
Ipopt::OptionsList::OptionsList | ( | ) | [inline] |
Definition at line 146 of file IpOptionsList.hpp.
Ipopt::OptionsList::OptionsList | ( | const OptionsList & | copy | ) | [inline] |
Copy Constructor.
Definition at line 150 of file IpOptionsList.hpp.
References options_, and reg_options_.
virtual Ipopt::OptionsList::~OptionsList | ( | ) | [inline, virtual] |
void Ipopt::OptionsList::operator= | ( | const OptionsList & | source | ) | [inline] |
Overloaded Equals Operator.
Definition at line 163 of file IpOptionsList.hpp.
References jnlst_, options_, and reg_options_.
void Ipopt::OptionsList::clear | ( | ) | [inline] |
Method for clearing all previously set options.
Definition at line 172 of file IpOptionsList.hpp.
References options_.
void Ipopt::OptionsList::SetRegisteredOptions | ( | const SmartPtr< RegisteredOptions > | reg_options | ) | [inline] |
void Ipopt::OptionsList::SetJournalist | ( | const SmartPtr< Journalist > | jnlst | ) | [inline] |
bool Ipopt::OptionsList::SetStringValue | ( | const std::string & | tag, | |
const std::string & | value, | |||
bool | allow_clobber = true , |
|||
bool | dont_print = false | |||
) |
bool Ipopt::OptionsList::SetNumericValue | ( | const std::string & | tag, | |
Number | value, | |||
bool | allow_clobber = true , |
|||
bool | dont_print = false | |||
) |
bool Ipopt::OptionsList::SetIntegerValue | ( | const std::string & | tag, | |
Index | value, | |||
bool | allow_clobber = true , |
|||
bool | dont_print = false | |||
) |
bool Ipopt::OptionsList::SetStringValueIfUnset | ( | const std::string & | tag, | |
const std::string & | value, | |||
bool | allow_clobber = true , |
|||
bool | dont_print = false | |||
) |
bool Ipopt::OptionsList::SetNumericValueIfUnset | ( | const std::string & | tag, | |
Number | value, | |||
bool | allow_clobber = true , |
|||
bool | dont_print = false | |||
) |
bool Ipopt::OptionsList::SetIntegerValueIfUnset | ( | const std::string & | tag, | |
Index | value, | |||
bool | allow_clobber = true , |
|||
bool | dont_print = false | |||
) |
bool Ipopt::OptionsList::GetStringValue | ( | const std::string & | tag, | |
std::string & | value, | |||
const std::string & | prefix | |||
) | const |
bool Ipopt::OptionsList::GetEnumValue | ( | const std::string & | tag, | |
Index & | value, | |||
const std::string & | prefix | |||
) | const |
bool Ipopt::OptionsList::GetBoolValue | ( | const std::string & | tag, | |
bool & | value, | |||
const std::string & | prefix | |||
) | const |
bool Ipopt::OptionsList::GetNumericValue | ( | const std::string & | tag, | |
Number & | value, | |||
const std::string & | prefix | |||
) | const |
bool Ipopt::OptionsList::GetIntegerValue | ( | const std::string & | tag, | |
Index & | value, | |||
const std::string & | prefix | |||
) | const |
void Ipopt::OptionsList::PrintList | ( | std::string & | list | ) | const |
Get a string with the list of all options (tag, value, counter).
void Ipopt::OptionsList::PrintUserOptions | ( | std::string & | list | ) | const |
Get a string with the list of all options set by the user (tag, value, use/notused).
Here, options with dont_print flag set to true are not printed.
bool Ipopt::OptionsList::ReadFromStream | ( | const Journalist & | jnlst, | |
std::istream & | is | |||
) |
Read options from the stream is.
Returns false if an error was encountered.
const std::string& Ipopt::OptionsList::lowercase | ( | const std::string | tag | ) | const [private] |
auxilliary method for converting sting to all lower-case letters
bool Ipopt::OptionsList::find_tag | ( | const std::string & | tag, | |
const std::string & | prefix, | |||
std::string & | value | |||
) | const [private] |
auxilliary method for finding the value for a tag in the options list.
This method first looks for the concatenated string prefix+tag (if prefix is not ""), and if this is not found, it looks for tag. The return value is true iff prefix+tag or tag is found. In that case, the corresponding string value is copied into value.
bool Ipopt::OptionsList::will_allow_clobber | ( | const std::string & | tag | ) | const [private] |
tells whether or not we can clobber a particular option.
returns true if the option does not already exist, or if the option exists but is set to allow_clobber
bool Ipopt::OptionsList::readnexttoken | ( | std::istream & | is, | |
std::string & | token | |||
) | [private] |
read the next token from stream is.
Returns false, if EOF was reached before a tokens was ecountered.
std::map< std::string, OptionValue > Ipopt::OptionsList::options_ [private] |
map for storing the options
Definition at line 252 of file IpOptionsList.hpp.
Referenced by clear(), operator=(), and OptionsList().
list of all the registered options to validate against
Definition at line 255 of file IpOptionsList.hpp.
Referenced by operator=(), OptionsList(), and SetRegisteredOptions().
SmartPtr<Journalist> Ipopt::OptionsList::jnlst_ [private] |
Journalist for writing error messages, etc.
Definition at line 258 of file IpOptionsList.hpp.
Referenced by operator=(), and SetJournalist().
std::string Ipopt::OptionsList::lowercase_buffer_ [mutable, private] |