Ipopt  3.12.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Ipopt::OptionsList Class Reference

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

#include <IpOptionsList.hpp>

+ Inheritance diagram for Ipopt::OptionsList:

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. More...
 
virtual void PrintList (std::string &list) const
 Get a string with the list of all options (tag, value, counter) More...
 
virtual void PrintUserOptions (std::string &list) const
 Get a string with the list of all options set by the user (tag, value, use/notused). More...
 
virtual bool ReadFromStream (const Journalist &jnlst, std::istream &is, bool allow_clobber=false)
 Read options from the stream is. More...
 
Constructors/Destructors
 OptionsList (SmartPtr< RegisteredOptions > reg_options, SmartPtr< Journalist > jnlst)
 
 OptionsList ()
 
 OptionsList (const OptionsList &copy)
 Copy Constructor. More...
 
virtual ~OptionsList ()
 Default destructor. More...
 
virtual void operator= (const OptionsList &source)
 Overloaded Equals Operator. More...
 
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

set before

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

a tag is not found, the methods return false, and value is set to the default value defined in the registered options.

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
 
- Public Member Functions inherited from Ipopt::ReferencedObject
 ReferencedObject ()
 
virtual ~ReferencedObject ()
 
Index ReferenceCount () const
 
void AddRef (const Referencer *referencer) const
 
void ReleaseRef (const Referencer *referencer) const
 

Private Member Functions

const std::string & lowercase (const std::string tag) const
 auxilliary method for converting sting to all lower-case letters More...
 
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. More...
 
bool will_allow_clobber (const std::string &tag) const
 tells whether or not we can clobber a particular option. More...
 
bool readnexttoken (std::istream &is, std::string &token)
 read the next token from stream is. More...
 

Private Attributes

std::map< std::string,
OptionValue
options_
 Default Constructor. More...
 
SmartPtr< RegisteredOptionsreg_options_
 list of all the registered options to validate against More...
 
SmartPtr< Journalistjnlst_
 Journalist for writing error messages, etc. More...
 
std::string lowercase_buffer_
 auxilliary string set by lowercase method More...
 

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

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.

virtual Ipopt::OptionsList::~OptionsList ( )
inlinevirtual

Default destructor.

Definition at line 159 of file IpOptionsList.hpp.

Member Function Documentation

virtual void Ipopt::OptionsList::operator= ( const OptionsList source)
inlinevirtual

Overloaded Equals Operator.

Definition at line 163 of file IpOptionsList.hpp.

virtual void Ipopt::OptionsList::clear ( )
inlinevirtual

Method for clearing all previously set options.

Definition at line 172 of file IpOptionsList.hpp.

virtual void Ipopt::OptionsList::SetRegisteredOptions ( const SmartPtr< RegisteredOptions reg_options)
inlinevirtual

Definition at line 179 of file IpOptionsList.hpp.

virtual void Ipopt::OptionsList::SetJournalist ( const SmartPtr< Journalist jnlst)
inlinevirtual

Definition at line 183 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,
bool  allow_clobber = false 
)
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.

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.

SmartPtr<RegisteredOptions> Ipopt::OptionsList::reg_options_
private

list of all the registered options to validate against

Definition at line 255 of file IpOptionsList.hpp.

SmartPtr<Journalist> Ipopt::OptionsList::jnlst_
private

Journalist for writing error messages, etc.

Definition at line 258 of file IpOptionsList.hpp.

std::string Ipopt::OptionsList::lowercase_buffer_
mutableprivate

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: