7 #ifndef __IPREGOPTIONS_HPP__ 8 #define __IPREGOPTIONS_HPP__ 31 class 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,
159 const std::string& description
162 description_(description)
182 const std::string& name,
183 const std::string& short_description,
184 const std::string& long_description,
187 bool advanced =
false 190 short_description_(short_description),
191 long_description_(long_description),
192 registering_category_(registering_category),
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_;
251 const std::string& short_description
254 short_description_ = short_description;
259 const std::string& long_description
262 long_description_ = long_description;
270 return *registering_category_;
301 advanced_ = advanced;
333 return lower_strict_;
357 lower_strict_ = strict, has_lower_ =
true;
367 return (
Index) lower_;
400 return upper_strict_;
424 upper_strict_ = strict;
435 return (
Index) upper_;
456 const std::string& value,
457 const std::string& description)
460 valid_strings_.push_back(
string_entry(value, description));
470 return default_number_;
478 const Number& default_value
482 default_number_ = default_value;
492 return (
Index) default_number_;
500 const Index& default_value
504 default_number_ = (
Number) default_value;
514 return default_string_;
526 return MapStringSettingToEnum(default_string_);
534 const std::string& default_value
538 default_string_ = default_value;
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_ )
595 virtual bool IsValidStringSetting(
596 const std::string& value
602 virtual std::string MapStringSetting(
603 const std::string& value
611 virtual Index MapStringSettingToEnum(
612 const std::string& value
617 virtual void OutputDescription(
622 virtual void OutputShortDescription(
627 virtual void OutputLatexDescription(
632 virtual void OutputDoxygenDescription(
659 void MakeValidLatexString(
660 const std::string& source,
664 std::string MakeValidLatexNumber(
668 std::string MakeValidHTMLNumber(
673 bool string_equal_insensitive(
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();
731 virtual void SetRegisteringCategory(
732 const std::string& registering_category,
742 virtual void SetRegisteringCategory(
751 return current_registering_category_;
755 virtual void AddNumberOption(
756 const std::string& name,
757 const std::string& short_description,
759 const std::string& long_description =
"",
760 bool advanced =
false 764 virtual void AddLowerBoundedNumberOption(
765 const std::string& name,
766 const std::string& short_description,
770 const std::string& long_description =
"",
771 bool advanced =
false 775 virtual void AddUpperBoundedNumberOption(
776 const std::string& name,
777 const std::string& short_description,
781 const std::string& long_description =
"",
782 bool advanced =
false 786 virtual void AddBoundedNumberOption(
787 const std::string& name,
788 const std::string& short_description,
794 const std::string& long_description =
"",
795 bool advanced =
false 799 virtual void AddIntegerOption(
800 const std::string& name,
801 const std::string& short_description,
803 const std::string& long_description =
"",
804 bool advanced =
false 808 virtual void AddLowerBoundedIntegerOption(
809 const std::string& name,
810 const std::string& short_description,
813 const std::string& long_description =
"",
814 bool advanced =
false 818 virtual void AddUpperBoundedIntegerOption(
819 const std::string& name,
820 const std::string& short_description,
823 const std::string& long_description =
"",
824 bool advanced =
false 828 virtual void AddBoundedIntegerOption(
829 const std::string& name,
830 const std::string& short_description,
834 const std::string& long_description =
"",
835 bool advanced =
false 839 virtual void AddStringOption(
840 const std::string& name,
841 const std::string& short_description,
842 const std::string& default_value,
843 const std::vector<std::string>& settings,
844 const std::vector<std::string>& descriptions,
845 const std::string& long_description =
"",
846 bool advanced =
false 850 virtual void AddStringOption1(
851 const std::string& name,
852 const std::string& short_description,
853 const std::string& default_value,
854 const std::string& setting1,
855 const std::string& description1,
856 const std::string& long_description =
"",
857 bool advanced =
false 860 virtual void AddStringOption2(
861 const std::string& name,
862 const std::string& short_description,
863 const std::string& default_value,
864 const std::string& setting1,
865 const std::string& description1,
866 const std::string& setting2,
867 const std::string& description2,
868 const std::string& long_description =
"",
869 bool advanced =
false 872 virtual void AddStringOption3(
873 const std::string& name,
874 const std::string& short_description,
875 const std::string& default_value,
876 const std::string& setting1,
877 const std::string& description1,
878 const std::string& setting2,
879 const std::string& description2,
880 const std::string& setting3,
881 const std::string& description3,
882 const std::string& long_description =
"",
883 bool advanced =
false 886 virtual void AddStringOption4(
887 const std::string& name,
888 const std::string& short_description,
889 const std::string& default_value,
890 const std::string& setting1,
891 const std::string& description1,
892 const std::string& setting2,
893 const std::string& description2,
894 const std::string& setting3,
895 const std::string& description3,
896 const std::string& setting4,
897 const std::string& description4,
898 const std::string& long_description =
"",
899 bool advanced =
false 902 virtual void AddStringOption5(
903 const std::string& name,
904 const std::string& short_description,
905 const std::string& default_value,
906 const std::string& setting1,
907 const std::string& description1,
908 const std::string& setting2,
909 const std::string& description2,
910 const std::string& setting3,
911 const std::string& description3,
912 const std::string& setting4,
913 const std::string& description4,
914 const std::string& setting5,
915 const std::string& description5,
916 const std::string& long_description =
"",
917 bool advanced =
false 920 virtual void AddStringOption6(
921 const std::string& name,
922 const std::string& short_description,
923 const std::string& default_value,
924 const std::string& setting1,
925 const std::string& description1,
926 const std::string& setting2,
927 const std::string& description2,
928 const std::string& setting3,
929 const std::string& description3,
930 const std::string& setting4,
931 const std::string& description4,
932 const std::string& setting5,
933 const std::string& description5,
934 const std::string& setting6,
935 const std::string& description6,
936 const std::string& long_description =
"",
937 bool advanced =
false 940 virtual void AddStringOption7(
941 const std::string& name,
942 const std::string& short_description,
943 const std::string& default_value,
944 const std::string& setting1,
945 const std::string& description1,
946 const std::string& setting2,
947 const std::string& description2,
948 const std::string& setting3,
949 const std::string& description3,
950 const std::string& setting4,
951 const std::string& description4,
952 const std::string& setting5,
953 const std::string& description5,
954 const std::string& setting6,
955 const std::string& description6,
956 const std::string& setting7,
957 const std::string& description7,
958 const std::string& long_description =
"",
959 bool advanced =
false 962 virtual void AddStringOption8(
963 const std::string& name,
964 const std::string& short_description,
965 const std::string& default_value,
966 const std::string& setting1,
967 const std::string& description1,
968 const std::string& setting2,
969 const std::string& description2,
970 const std::string& setting3,
971 const std::string& description3,
972 const std::string& setting4,
973 const std::string& description4,
974 const std::string& setting5,
975 const std::string& description5,
976 const std::string& setting6,
977 const std::string& description6,
978 const std::string& setting7,
979 const std::string& description7,
980 const std::string& setting8,
981 const std::string& description8,
982 const std::string& long_description =
"",
983 bool advanced =
false 986 virtual void AddStringOption9(
987 const std::string& name,
988 const std::string& short_description,
989 const std::string& default_value,
990 const std::string& setting1,
991 const std::string& description1,
992 const std::string& setting2,
993 const std::string& description2,
994 const std::string& setting3,
995 const std::string& description3,
996 const std::string& setting4,
997 const std::string& description4,
998 const std::string& setting5,
999 const std::string& description5,
1000 const std::string& setting6,
1001 const std::string& description6,
1002 const std::string& setting7,
1003 const std::string& description7,
1004 const std::string& setting8,
1005 const std::string& description8,
1006 const std::string& setting9,
1007 const std::string& description9,
1008 const std::string& long_description =
"",
1009 bool advanced =
false 1012 virtual void AddStringOption10(
1013 const std::string& name,
1014 const std::string& short_description,
1015 const std::string& default_value,
1016 const std::string& setting1,
1017 const std::string& description1,
1018 const std::string& setting2,
1019 const std::string& description2,
1020 const std::string& setting3,
1021 const std::string& description3,
1022 const std::string& setting4,
1023 const std::string& description4,
1024 const std::string& setting5,
1025 const std::string& description5,
1026 const std::string& setting6,
1027 const std::string& description6,
1028 const std::string& setting7,
1029 const std::string& description7,
1030 const std::string& setting8,
1031 const std::string& description8,
1032 const std::string& setting9,
1033 const std::string& description9,
1034 const std::string& setting10,
1035 const std::string& description10,
1036 const std::string& long_description =
"",
1037 bool advanced =
false 1043 virtual void AddBoolOption(
1044 const std::string& name,
1045 const std::string& short_description,
1047 const std::string& long_description =
"",
1048 bool advanced =
false 1056 const std::string& name
1062 return registered_options_;
1070 return registered_categories_;
1078 void RegisteredCategoriesByPriority(
1079 RegCategoriesByPriority& categories
1089 virtual void OutputOptionDocumentation(
1102 virtual void OutputOptionDocumentation(
1104 const std::list<std::string>& categories = std::list<std::string>()
1114 virtual void OutputLatexOptionDocumentation(
1116 const std::list<std::string>& options_to_print = std::list<std::string>()
1126 virtual void OutputDoxygenOptionDocumentation(
1128 const std::list<std::string>& options_to_print = std::list<std::string>()
1134 static void RegisterOptions(
bool IsValid(const SmartPtr< U > &smart_ptr)
string_entry(const std::string &value, const std::string &description)
virtual const std::string & ShortDescription() const
Get the short description.
std::string name_
name of category
A category of registered options.
virtual void SetLowerInteger(const Index &lower)
set the Integer version of the lower bound
virtual void SetType(const RegisteredOptionType &type)
Set the Option's type.
IPOPT_DEPRECATED bool operator!=(const std::string &other) const
compare with string
virtual void SetDefaultInteger(const Index &default_value)
Set the default as an Integer.
RegOptionsList registered_options_
virtual std::string DefaultString() const
get the default as a string
IPOPT_DEPRECATED bool operator==(const std::string &other) const
compare with string
virtual Index UpperInteger() const
get the Integer version of the upper bound
DECLARE_STD_EXCEPTION(FATAL_ERROR_IN_LINEAR_SOLVER)
virtual Index LowerInteger() const
get the Integer version of the lower bound
SmartPtr< RegisteredCategory > current_registering_category_
virtual const std::string & Name() const
Standard Get / Set Methods.
std::list< SmartPtr< RegisteredOption > > regoptions_
options of this category
virtual bool IsValidIntegerSetting(const Index &value) const
Check if the Integer value is a valid setting.
Option that has been registered.
virtual const RegisteredOptionType & Type() const
Get the Option's type.
std::map< std::string, SmartPtr< RegisteredCategory > > RegCategoriesList
RegisteredCategory(const std::string &name, int priority)
Constructor.
ipindex Index
Type of all indices of vectors, matrices etc.
const std::string & Name() const
name of category
This file contains a base class for all exceptions and a set of macros to help with exceptions...
Template class for Smart Pointers.
RegisteredOptionType type_
Storing the reference count of all the smart pointers that currently reference it.
virtual ~RegisteredOptions()
Destructor.
virtual bool IsValidNumberSetting(const Number &value) const
Check if the Number value is a valid setting.
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 SmartPtr< RegisteredCategory > RegisteringCategory()
retrieve the value of the current registering category
virtual void SetLowerNumber(const Number &lower, const bool &strict)
set the Number version of the lower bound
class to hold the valid string settings for a string option
SmartPtr< RegisteredCategory > registering_category_
virtual void SetAdvanced(bool advanced=true)
Set the advanced flag.
virtual void SetUpperInteger(const Index &upper)
set the Integer version of the upper bound
virtual Number LowerNumber() const
get the Number version of the lower bound
virtual void SetDefaultString(const std::string &default_value)
Set the default as a string.
const Index counter_
Has the information as how many-th option this one was registered.
int priority_
priority of category (used to decide whether to print and printing order)
std::set< SmartPtr< RegisteredCategory >, RegisteredCategory::ComparePriority > RegCategoriesByPriority
ipnumber Number
Type of all numbers.
virtual void AddValidStringSetting(const std::string &value, const std::string &description)
method to add valid string entries
virtual const std::string & LongDescription() const
Get the long description.
virtual Number UpperNumber() const
get the Number version of the upper bound
RegisteredOptions()
Constructors / Destructors.
virtual const bool & LowerStrict() const
check if the lower bound is strict
virtual Index DefaultInteger() const
get the default as an Integer
const RegCategoriesList & RegisteredCategories() const
Giving access to registered categories.
const std::list< SmartPtr< RegisteredOption > > & RegisteredOptions() const
gives list of options in this category
std::map< std::string, SmartPtr< RegisteredOption > > RegOptionsList
std::string long_description_
virtual std::vector< string_entry > GetValidStrings() const
get the valid string settings
virtual void SetUpperNumber(const Number &upper, const bool &strict)
set the Number version of the upper bound
virtual const bool & HasUpper() const
check if the option has an upper bound
Class responsible for all message output.
bool operator()(const SmartPtr< RegisteredCategory > &lhs, const SmartPtr< RegisteredCategory > &rhs) const
std::string default_string_
std::string short_description_
const RegOptionsList & RegisteredOptionsList() const
Giving access to iteratable representation of the registered options.
virtual const RegisteredCategory & RegisteringCategory() const
Get the registering class.
IPOPT_DEPRECATED bool operator<(const RegisteredCategory &other) const
compare two categories
virtual void SetLongDescription(const std::string &long_description)
Set the long description.
virtual const bool & HasLower() const
check if the option has a lower bound
virtual bool Advanced() const
Get the advanced flag.
#define IPOPT_DEPRECATED
macro to declare symbols as deprecated
RegisteredOption(const RegisteredOption ©)
virtual void SetDefaultNumber(const Number &default_value)
Set the default as a Number.
virtual void SetShortDescription(const std::string &short_description)
Set the short description.
std::vector< string_entry > valid_strings_
virtual void SetName(const std::string &name)
Set the option's name (tag in the input file)
virtual Number DefaultNumber() const
get the default as a Number
virtual ~RegisteredOption()
int Priority() const
priority of category
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 Index Counter() const
Counter.
virtual const bool & UpperStrict() const
check if the upper bound is strict
RegCategoriesList registered_categories_