7#ifndef __IPREGOPTIONS_HPP__
8#define __IPREGOPTIONS_HPP__
31class RegisteredOption;
44 const std::string&
name,
52 const std::string&
Name()
const
62 operator const std::string& ()
const
73 const std::string&
other
76 return name_ !=
other;
85 const std::string&
other
88 return name_ ==
other;
100 return name_ <
other.name_;
126 return lhs->priority_ >
rhs->priority_;
158 const std::string&
value,
182 const std::string&
name,
204 short_description_(
copy.short_description_),
205 long_description_(
copy.long_description_),
206 registering_category_(
copy.registering_category_),
208 advanced_(
copy.advanced_),
209 has_lower_(
copy.has_lower_),
211 has_upper_(
copy.has_upper_),
213 valid_strings_(
copy.valid_strings_),
214 counter_(
copy.counter_)
226 virtual const std::string&
Name()
const
232 const std::string&
name
240 return short_description_;
246 return long_description_;
270 return *registering_category_;
333 return lower_strict_;
357 lower_strict_ =
strict, has_lower_ =
true;
367 return (
Index) lower_;
400 return upper_strict_;
435 return (
Index) upper_;
456 const std::string&
value,
470 return default_number_;
492 return (
Index) default_number_;
514 return default_string_;
526 return MapStringSettingToEnum(default_string_);
548 return valid_strings_;
560 if( has_lower_ && ((lower_strict_ ==
true &&
value <= lower_) || (lower_strict_ ==
false &&
value < lower_)) )
564 if( has_upper_ && ((upper_strict_ ==
true &&
value >= upper_) || (upper_strict_ ==
false &&
value > upper_)) )
580 if( has_lower_ &&
value < lower_ )
584 if( has_upper_ &&
value > upper_ )
596 const std::string&
value
603 const std::string&
value
612 const std::string&
value
660 const std::string&
source,
674 const std::string&
s1,
675 const std::string&
s2
714 for( RegCategoriesList::iterator
it(registered_categories_.begin());
it != registered_categories_.end(); ++
it )
716 it->second->regoptions_.clear();
751 return current_registering_category_;
756 const std::string&
name,
765 const std::string&
name,
776 const std::string&
name,
787 const std::string&
name,
800 const std::string&
name,
809 const std::string&
name,
819 const std::string&
name,
829 const std::string&
name,
840 const std::string&
name,
843 const std::vector<std::string>&
settings,
851 const std::string&
name,
861 const std::string&
name,
873 const std::string&
name,
887 const std::string&
name,
903 const std::string&
name,
921 const std::string&
name,
941 const std::string&
name,
963 const std::string&
name,
987 const std::string&
name,
1013 const std::string&
name,
1044 const std::string&
name,
1056 const std::string&
name
1062 return registered_options_;
1070 return registered_categories_;
1104 const std::list<std::string>&
categories = std::list<std::string>()
IPOPT_DEPRECATED typedef ipnumber Number
Type for all number.
#define IPOPT_DEPRECATED
macro to declare symbols as deprecated
Templated class which stores one entry for the CachedResult class.
Class responsible for all message output.
Storing the reference count of all the smart pointers that currently reference it.
bool operator()(const SmartPtr< RegisteredCategory > &lhs, const SmartPtr< RegisteredCategory > &rhs) const
A category of registered options.
IPOPT_DEPRECATED bool operator!=(const std::string &other) const
compare with string
const std::string & Name() const
name of category
RegisteredCategory(const std::string &name, int priority)
Constructor.
int Priority() const
priority of category
RegisteredCategory(const RegisteredCategory &)
unimplemented copy constructor
std::list< SmartPtr< RegisteredOption > > regoptions_
options of this category
IPOPT_DEPRECATED bool operator==(const std::string &other) const
compare with string
int priority_
priority of category (used to decide whether to print and printing order)
IPOPT_DEPRECATED bool operator<(const RegisteredCategory &other) const
compare two categories
RegisteredCategory & operator=(const RegisteredCategory &)
unimplemented assignment operator
RegisteredCategory()
unimplemented default constructor
const std::list< SmartPtr< RegisteredOption > > & RegisteredOptions() const
gives list of options in this category
std::string name_
name of category
class to hold the valid string settings for a string option
string_entry(const std::string &value, const std::string &description)
Option that has been registered.
virtual Number LowerNumber() const
get the Number version of the lower bound
virtual std::string MapStringSetting(const std::string &value) const
Map a user setting (allowing any case) to the case used when the setting was registered.
RegisteredOptionType type_
std::vector< string_entry > valid_strings_
RegisteredOption(Index counter)
Constructors / Destructors.
bool string_equal_insensitive(const std::string &s1, const std::string &s2) const
Compare two strings and return true if they are equal (case insensitive comparison)
virtual bool IsValidStringSetting(const std::string &value) const
Check if the String value is a valid setting.
virtual std::vector< string_entry > GetValidStrings() const
get the valid string settings
virtual Index MapStringSettingToEnum(const std::string &value) const
Map a user setting (allowing any case) to the index of the matched setting in the list of string sett...
virtual Index DefaultInteger() const
get the default as an Integer
RegisteredOption(const std::string &name, const std::string &short_description, const std::string &long_description, const SmartPtr< RegisteredCategory > ®istering_category, Index counter, bool advanced=false)
virtual const RegisteredOptionType & Type() const
Get the Option's type.
std::string short_description_
virtual void OutputShortDescription(const Journalist &jnlst) const
output a more concise version
virtual const std::string & LongDescription() const
Get the long description.
virtual const bool & HasLower() const
check if the option has a lower bound
virtual void SetName(const std::string &name)
Set the option's name (tag in the input file)
virtual void OutputDoxygenDescription(const Journalist &jnlst) const
output a doxygen version
virtual const std::string & Name() const
Standard Get / Set Methods.
virtual const RegisteredCategory & RegisteringCategory() const
Get the registering class.
virtual Number UpperNumber() const
get the Number version of the upper bound
virtual void SetDefaultInteger(const Index &default_value)
Set the default as an Integer.
virtual void SetLowerInteger(const Index &lower)
set the Integer version of the lower bound
virtual bool IsValidNumberSetting(const Number &value) const
Check if the Number value is a valid setting.
virtual Number DefaultNumber() const
get the default as a Number
std::string default_string_
std::string long_description_
virtual void SetLongDescription(const std::string &long_description)
Set the long description.
virtual void OutputLatexDescription(const Journalist &jnlst) const
output a latex version
std::string MakeValidLatexNumber(Number value) const
virtual const bool & UpperStrict() const
check if the upper bound is strict
virtual void SetLowerNumber(const Number &lower, const bool &strict)
set the Number version of the lower bound
virtual Index UpperInteger() const
get the Integer version of the upper bound
virtual Index LowerInteger() const
get the Integer version of the lower bound
void MakeValidLatexString(const std::string &source, std::string &dest) const
virtual void SetUpperNumber(const Number &upper, const bool &strict)
set the Number version of the upper bound
virtual void SetDefaultNumber(const Number &default_value)
Set the default as a Number.
virtual bool IsValidIntegerSetting(const Index &value) const
Check if the Integer value is a valid setting.
const Index counter_
Has the information as how many-th option this one was registered.
virtual void SetUpperInteger(const Index &upper)
set the Integer version of the upper bound
SmartPtr< RegisteredCategory > registering_category_
virtual void SetShortDescription(const std::string &short_description)
Set the short description.
virtual void SetAdvanced(bool advanced=true)
Set the advanced flag.
virtual Index Counter() const
Counter.
virtual ~RegisteredOption()
DECLARE_STD_EXCEPTION(ERROR_CONVERTING_STRING_TO_ENUM)
std::string MakeValidHTMLNumber(Number value) const
virtual const std::string & ShortDescription() const
Get the short description.
virtual const bool & LowerStrict() const
check if the lower bound is strict
virtual bool Advanced() const
Get the advanced flag.
virtual void SetType(const RegisteredOptionType &type)
Set the Option's type.
virtual void SetDefaultString(const std::string &default_value)
Set the default as a string.
virtual const bool & HasUpper() const
check if the option has an upper bound
RegisteredOption(const RegisteredOption ©)
virtual void OutputDescription(const Journalist &jnlst) const
output a description of the option
virtual void AddValidStringSetting(const std::string &value, const std::string &description)
method to add valid string entries
virtual std::string DefaultString() const
get the default as a string
virtual Index DefaultStringAsEnum() const
get the default as a string, but as the index of the string in the list
Class for storing registered options.
virtual void AddBoundedIntegerOption(const std::string &name, const std::string &short_description, Index lower, Index upper, Index default_value, const std::string &long_description="", bool advanced=false)
Add a Integer option (with a both bounds)
virtual void AddStringOption6(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &setting4, const std::string &description4, const std::string &setting5, const std::string &description5, const std::string &setting6, const std::string &description6, const std::string &long_description="", bool advanced=false)
virtual void AddStringOption1(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &long_description="", bool advanced=false)
Methods that make adding string options with only a few entries easier.
static void RegisterOptions(SmartPtr< RegisteredOptions > roptions)
register options of RegisteredOptions class
virtual void AddUpperBoundedIntegerOption(const std::string &name, const std::string &short_description, Index upper, Index default_value, const std::string &long_description="", bool advanced=false)
Add a Integer option (with a upper bound)
SmartPtr< RegisteredCategory > current_registering_category_
virtual void SetRegisteringCategory(const std::string ®istering_category, int priority=0)
set the registering class
virtual void AddIntegerOption(const std::string &name, const std::string &short_description, Index default_value, const std::string &long_description="", bool advanced=false)
Add a Integer option (with no restrictions)
virtual void AddBoolOption(const std::string &name, const std::string &short_description, bool default_value, const std::string &long_description="", bool advanced=false)
Create a string value with two possible settings: yes and no.
virtual void SetRegisteringCategory(SmartPtr< RegisteredCategory > registering_category)
set the registering class
RegisteredOptions()
Constructors / Destructors.
virtual void AddStringOption5(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &setting4, const std::string &description4, const std::string &setting5, const std::string &description5, const std::string &long_description="", bool advanced=false)
virtual void AddStringOption10(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &setting4, const std::string &description4, const std::string &setting5, const std::string &description5, const std::string &setting6, const std::string &description6, const std::string &setting7, const std::string &description7, const std::string &setting8, const std::string &description8, const std::string &setting9, const std::string &description9, const std::string &setting10, const std::string &description10, const std::string &long_description="", bool advanced=false)
virtual void AddLowerBoundedIntegerOption(const std::string &name, const std::string &short_description, Index lower, Index default_value, const std::string &long_description="", bool advanced=false)
Add a Integer option (with a lower bound)
void AddOption(const SmartPtr< RegisteredOption > &option)
DECLARE_STD_EXCEPTION(OPTION_ALREADY_REGISTERED)
virtual IPOPT_DEPRECATED void OutputOptionDocumentation(const Journalist &jnlst, const std::list< std::string > &categories=std::list< std::string >()) const
Output documentation in text format.
virtual SmartPtr< RegisteredCategory > RegisteringCategory()
retrieve the value of the current registering category
virtual void AddUpperBoundedNumberOption(const std::string &name, const std::string &short_description, Number upper, bool strict, Number default_value, const std::string &long_description="", bool advanced=false)
Add a Number option (with a upper bound)
virtual SmartPtr< const RegisteredOption > GetOption(const std::string &name)
Get a registered option.
virtual void AddNumberOption(const std::string &name, const std::string &short_description, Number default_value, const std::string &long_description="", bool advanced=false)
Add a Number option (with no restrictions)
virtual void AddStringOption8(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &setting4, const std::string &description4, const std::string &setting5, const std::string &description5, const std::string &setting6, const std::string &description6, const std::string &setting7, const std::string &description7, const std::string &setting8, const std::string &description8, const std::string &long_description="", bool advanced=false)
virtual void AddLowerBoundedNumberOption(const std::string &name, const std::string &short_description, Number lower, bool strict, Number default_value, const std::string &long_description="", bool advanced=false)
Add a Number option (with a lower bound)
std::map< std::string, SmartPtr< RegisteredCategory > > RegCategoriesList
virtual void OutputOptionDocumentation(const Journalist &jnlst, SmartPtr< OptionsList > options, int minpriority=0) const
Output documentation.
virtual void AddStringOption4(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &setting4, const std::string &description4, const std::string &long_description="", bool advanced=false)
virtual void AddStringOption9(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &setting4, const std::string &description4, const std::string &setting5, const std::string &description5, const std::string &setting6, const std::string &description6, const std::string &setting7, const std::string &description7, const std::string &setting8, const std::string &description8, const std::string &setting9, const std::string &description9, const std::string &long_description="", bool advanced=false)
RegCategoriesList registered_categories_
const RegCategoriesList & RegisteredCategories() const
Giving access to registered categories.
RegOptionsList registered_options_
virtual void AddBoundedNumberOption(const std::string &name, const std::string &short_description, Number lower, bool lower_strict, Number upper, bool upper_strict, Number default_value, const std::string &long_description="", bool advanced=false)
Add a Number option (with a both bounds)
virtual IPOPT_DEPRECATED void OutputDoxygenOptionDocumentation(const Journalist &jnlst, const std::list< std::string > &options_to_print=std::list< std::string >()) const
Output documentation in Doxygen format to include in doxygen documentation.
virtual void AddStringOption2(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &long_description="", bool advanced=false)
virtual void AddStringOption3(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &long_description="", bool advanced=false)
void RegisteredCategoriesByPriority(RegCategoriesByPriority &categories) const
Giving access to registered categories ordered by (decreasing) priority.
virtual ~RegisteredOptions()
Destructor.
virtual IPOPT_DEPRECATED void OutputLatexOptionDocumentation(const Journalist &jnlst, const std::list< std::string > &options_to_print=std::list< std::string >()) const
Output documentation in Latex format to include in a latex file.
virtual void AddStringOption7(const std::string &name, const std::string &short_description, const std::string &default_value, const std::string &setting1, const std::string &description1, const std::string &setting2, const std::string &description2, const std::string &setting3, const std::string &description3, const std::string &setting4, const std::string &description4, const std::string &setting5, const std::string &description5, const std::string &setting6, const std::string &description6, const std::string &setting7, const std::string &description7, const std::string &long_description="", bool advanced=false)
std::map< std::string, SmartPtr< RegisteredOption > > RegOptionsList
virtual void AddStringOption(const std::string &name, const std::string &short_description, const std::string &default_value, const std::vector< std::string > &settings, const std::vector< std::string > &descriptions, const std::string &long_description="", bool advanced=false)
Add a String option (with no restrictions)
const RegOptionsList & RegisteredOptionsList() const
Giving access to iteratable representation of the registered options.
std::set< SmartPtr< RegisteredCategory >, RegisteredCategory::ComparePriority > RegCategoriesByPriority
This file contains a base class for all exceptions and a set of macros to help with exceptions.
bool IsValid(const SmartPtr< U > &smart_ptr)
ipindex Index
Type of all indices of vectors, matrices etc.
ipnumber Number
Type of all numbers.