This class stores a list of user set options. More...
#include <IpOptionsList.hpp>
Classes | |
class | OptionValue |
Class for storing the value and counter for each option in OptionsList. More... | |
Public Member Functions | |
virtual void | clear () |
Method for clearing all previously set options. | |
virtual void | PrintList (std::string &list) const |
Get a string with the list of all options (tag, value, counter). | |
virtual void | PrintUserOptions (std::string &list) const |
Get a string with the list of all options set by the user (tag, value, use/notused). | |
virtual bool | ReadFromStream (const Journalist &jnlst, std::istream &is) |
Read options from the stream is. | |
Constructors/Destructors | |
OptionsList (SmartPtr< RegisteredOptions > reg_options, SmartPtr< Journalist > jnlst) | |
Copy Constructor. | |
OptionsList () | |
Copy Constructor. | |
OptionsList (const OptionsList ©) | |
Copy Constructor. | |
virtual | ~OptionsList () |
Default destructor. | |
virtual void | operator= (const OptionsList &source) |
Overloaded Equals Operator. | |
Get / Set Methods | |
virtual void | SetRegisteredOptions (const SmartPtr< RegisteredOptions > reg_options) |
virtual void | SetJournalist (const SmartPtr< Journalist > jnlst) |
Methods for setting options | |
virtual bool | SetStringValue (const std::string &tag, const std::string &value, bool allow_clobber=true, bool dont_print=false) |
virtual bool | SetNumericValue (const std::string &tag, Number value, bool allow_clobber=true, bool dont_print=false) |
virtual 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 | |
virtual bool | SetStringValueIfUnset (const std::string &tag, const std::string &value, bool allow_clobber=true, bool dont_print=false) |
virtual bool | SetNumericValueIfUnset (const std::string &tag, Number value, bool allow_clobber=true, bool dont_print=false) |
virtual 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 | |
virtual bool | GetStringValue (const std::string &tag, std::string &value, const std::string &prefix) const |
virtual bool | GetEnumValue (const std::string &tag, Index &value, const std::string &prefix) const |
virtual bool | GetBoolValue (const std::string &tag, bool &value, const std::string &prefix) const |
virtual bool | GetNumericValue (const std::string &tag, Number &value, const std::string &prefix) const |
virtual 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_ |
Default Constructor. | |
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 |
This class stores a list of user set options.
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 27 of file IpOptionsList.hpp.
Ipopt::OptionsList::OptionsList | ( | SmartPtr< RegisteredOptions > | reg_options, | |
SmartPtr< Journalist > | jnlst | |||
) | [inline] |
Copy Constructor.
Definition at line 137 of file IpOptionsList.hpp.
Ipopt::OptionsList::OptionsList | ( | ) | [inline] |
Copy Constructor.
Definition at line 141 of file IpOptionsList.hpp.
Ipopt::OptionsList::OptionsList | ( | const OptionsList & | copy | ) | [inline] |
Copy Constructor.
Definition at line 145 of file IpOptionsList.hpp.
virtual Ipopt::OptionsList::~OptionsList | ( | ) | [inline, virtual] |
Default destructor.
Definition at line 154 of file IpOptionsList.hpp.
virtual void Ipopt::OptionsList::operator= | ( | const OptionsList & | source | ) | [inline, virtual] |
Overloaded Equals Operator.
Definition at line 158 of file IpOptionsList.hpp.
virtual void Ipopt::OptionsList::clear | ( | ) | [inline, virtual] |
Method for clearing all previously set options.
Definition at line 167 of file IpOptionsList.hpp.
virtual void Ipopt::OptionsList::SetRegisteredOptions | ( | const SmartPtr< RegisteredOptions > | reg_options | ) | [inline, virtual] |
Definition at line 174 of file IpOptionsList.hpp.
virtual void Ipopt::OptionsList::SetJournalist | ( | const SmartPtr< Journalist > | jnlst | ) | [inline, virtual] |
Definition at line 178 of file IpOptionsList.hpp.
virtual bool Ipopt::OptionsList::SetStringValue | ( | const std::string & | tag, | |
const std::string & | value, | |||
bool | allow_clobber = true , |
|||
bool | dont_print = false | |||
) | [virtual] |
virtual bool Ipopt::OptionsList::SetNumericValue | ( | const std::string & | tag, | |
Number | value, | |||
bool | allow_clobber = true , |
|||
bool | dont_print = false | |||
) | [virtual] |
virtual bool Ipopt::OptionsList::SetIntegerValue | ( | const std::string & | tag, | |
Index | value, | |||
bool | allow_clobber = true , |
|||
bool | dont_print = false | |||
) | [virtual] |
virtual bool Ipopt::OptionsList::SetStringValueIfUnset | ( | const std::string & | tag, | |
const std::string & | value, | |||
bool | allow_clobber = true , |
|||
bool | dont_print = false | |||
) | [virtual] |
virtual bool Ipopt::OptionsList::SetNumericValueIfUnset | ( | const std::string & | tag, | |
Number | value, | |||
bool | allow_clobber = true , |
|||
bool | dont_print = false | |||
) | [virtual] |
virtual bool Ipopt::OptionsList::SetIntegerValueIfUnset | ( | const std::string & | tag, | |
Index | value, | |||
bool | allow_clobber = true , |
|||
bool | dont_print = false | |||
) | [virtual] |
virtual bool Ipopt::OptionsList::GetStringValue | ( | const std::string & | tag, | |
std::string & | value, | |||
const std::string & | prefix | |||
) | const [virtual] |
virtual bool Ipopt::OptionsList::GetEnumValue | ( | const std::string & | tag, | |
Index & | value, | |||
const std::string & | prefix | |||
) | const [virtual] |
virtual bool Ipopt::OptionsList::GetBoolValue | ( | const std::string & | tag, | |
bool & | value, | |||
const std::string & | prefix | |||
) | const [virtual] |
virtual bool Ipopt::OptionsList::GetNumericValue | ( | const std::string & | tag, | |
Number & | value, | |||
const std::string & | prefix | |||
) | const [virtual] |
virtual bool Ipopt::OptionsList::GetIntegerValue | ( | const std::string & | tag, | |
Index & | value, | |||
const std::string & | prefix | |||
) | const [virtual] |
virtual void Ipopt::OptionsList::PrintList | ( | std::string & | list | ) | const [virtual] |
Get a string with the list of all options (tag, value, counter).
virtual void Ipopt::OptionsList::PrintUserOptions | ( | std::string & | list | ) | const [virtual] |
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.
virtual bool Ipopt::OptionsList::ReadFromStream | ( | const Journalist & | jnlst, | |
std::istream & | is | |||
) | [virtual] |
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] |
list of all the registered options to validate against
Definition at line 250 of file IpOptionsList.hpp.
SmartPtr<Journalist> Ipopt::OptionsList::jnlst_ [private] |
Journalist for writing error messages, etc.
Definition at line 253 of file IpOptionsList.hpp.
std::string Ipopt::OptionsList::lowercase_buffer_ [mutable, private] |
auxilliary string set by lowercase method
Definition at line 279 of file IpOptionsList.hpp.