Ipopt::OptionsList Class Reference

This class stores a list of user set options. More...

#include <IpOptionsList.hpp>

Inheritance diagram for Ipopt::OptionsList:
Inheritance graph
[legend]
Collaboration diagram for Ipopt::OptionsList:
Collaboration graph
[legend]

List of all members.

Classes

class  OptionValue
 Class for storing the value and counter for each option in OptionsList. More...

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)
 Copy Constructor.
 OptionsList ()
 Copy Constructor.
 OptionsList (const OptionsList &copy)
 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_
 Default Constructor.
SmartPtr< RegisteredOptionsreg_options_
 list of all the registered options to validate against
SmartPtr< Journalistjnlst_
 Journalist for writing error messages, etc.
std::string lowercase_buffer_
 auxilliary string set by lowercase method

Detailed Description

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 32 of file IpOptionsList.hpp.


Constructor & Destructor Documentation

Ipopt::OptionsList::OptionsList ( SmartPtr< RegisteredOptions reg_options,
SmartPtr< Journalist jnlst 
) [inline]

Copy Constructor.

Definition at line 142 of file IpOptionsList.hpp.

Ipopt::OptionsList::OptionsList (  )  [inline]

Copy Constructor.

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.

virtual Ipopt::OptionsList::~OptionsList (  )  [inline, virtual]

Default destructor.

Definition at line 159 of file IpOptionsList.hpp.


Member Function Documentation

void Ipopt::OptionsList::operator= ( const OptionsList source  )  [inline]

Overloaded Equals Operator.

Definition at line 163 of file IpOptionsList.hpp.

void Ipopt::OptionsList::clear (  )  [inline]

Method for clearing all previously set options.

Definition at line 172 of file IpOptionsList.hpp.

void Ipopt::OptionsList::SetRegisteredOptions ( const SmartPtr< RegisteredOptions reg_options  )  [inline]

Definition at line 179 of file IpOptionsList.hpp.

void Ipopt::OptionsList::SetJournalist ( const SmartPtr< Journalist jnlst  )  [inline]

Definition at line 183 of file IpOptionsList.hpp.

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.


Member Data Documentation

std::map< std::string, OptionValue > Ipopt::OptionsList::options_ [private]

Default Constructor.

map for storing the options

Definition at line 252 of file IpOptionsList.hpp.

list of all the registered options to validate against

Definition at line 255 of file IpOptionsList.hpp.

Journalist for writing error messages, etc.

Definition at line 258 of file IpOptionsList.hpp.

std::string Ipopt::OptionsList::lowercase_buffer_ [mutable, private]

auxilliary string set by lowercase method

Definition at line 284 of file IpOptionsList.hpp.


The documentation for this class was generated from the following file:

Generated on 15 Mar 2015 for Coin-All by  doxygen 1.6.1