40 std::string getString(
const std::string & label)
const;
42 const index_t & getInt (
const std::string & label)
const;
44 Real getReal (
const std::string & label)
const;
46 bool getSwitch(
const std::string & label)
const;
51 std::vector<std::string> getMultiString(
const std::string & gn)
const;
53 std::vector<index_t> getMultiInt (
const std::string & gn)
const;
55 std::vector<Real> getMultiReal (
const std::string & gn)
const;
60 std::string askString(
const std::string & label,
const std::string & value =
"" )
const;
62 index_t askInt (
const std::string & label,
const index_t & value = 0 )
const;
64 Real askReal (
const std::string & label,
const Real & value = 0 )
const;
66 bool askSwitch(
const std::string & label,
const bool & value =
false )
const;
80 void setString(
const std::string & label,
const std::string & value);
82 void setInt (
const std::string & label,
const index_t & value);
84 void setReal (
const std::string & label,
const Real & value);
86 void setSwitch(
const std::string & label,
const bool & value);
88 void toggleSwitch(
const std::string & label );
105 void addString(
const std::string & label,
const std::string & desc,
const std::string & value );
107 void addInt (
const std::string & label,
const std::string & desc,
const index_t & value );
109 void addReal (
const std::string & label,
const std::string & desc,
const Real & value );
111 void addSwitch(
const std::string & label,
const std::string & desc,
const bool & value );
126 void remove(
const std::string& label);
140 void update(
const gsOptionList& other, updateType type = ignoreIfUnknown);
146 gsOptionList wrapIntoGroup(
const std::string & gn)
const;
158 bool hasGlobals()
const;
163 bool hasGroup(
const std::string & gn)
const;
166 std::ostream & print(std::ostream & os)
const;
170 {
return m_strings.size()+m_ints.size()+m_reals.size()+m_switches.size();}
180 std::ostream & print(std::ostream & os,
index_t label_slot = 19)
const;
184 std::vector<OptionListEntry> getAllEntries()
const;
198 #if EIGEN_HAS_RVALUE_REFERENCES
203 gsOptionList(
const gsOptionList & other) :
204 m_strings(other.m_strings),
205 m_ints(other.m_ints),
206 m_reals(other.m_reals),
207 m_switches(other.m_switches) { }
209 gsOptionList(gsOptionList && other) :
210 m_strings(std::move(other.m_strings)),
211 m_ints(std::move(other.m_ints)),
212 m_reals(std::move(other.m_reals)),
213 m_switches(std::move(other.m_switches)) { }
215 gsOptionList& operator=(gsOptionList && other)
218 m_ints = std::move(other.
m_ints);
219 m_reals = std::move(other.
m_reals);
229 m_ints .swap(other.
m_ints );
235 index_t & getIntRef(
const std::string & label);
240 std::string getInfo(
const std::string & label)
const;
243 bool exists(
const std::string & label)
const;
246 bool isString(
const std::string & label)
const;
248 bool isInt(
const std::string & label)
const;
250 bool isReal(
const std::string & label)
const;
252 bool isSwitch(
const std::string & label)
const;
258 typedef std::pair<std::string,std::string> StringOpt;
259 typedef std::pair<index_t ,std::string> IntOpt;
260 typedef std::pair<Real ,std::string> RealOpt;
261 typedef std::pair<bool ,std::string> SwitchOpt;
264 typedef std::map<std::string,StringOpt> StringTable;
265 typedef std::map<std::string,IntOpt> IntTable;
266 typedef std::map<std::string,RealOpt> RealTable;
267 typedef std::map<std::string,SwitchOpt> SwitchTable;
278 {
return b.
print(os); }
282 {
return b.print(os); }
296 class GISMO_EXPORT gsXml<gsOptionList>
301 GSXML_COMMON_FUNCTIONS(gsOptionList)
302 GSXML_GET_POINTER(gsOptionList)
303 static std::
string tag () {
return "OptionList"; }
304 static std::string type() {
return ""; }
306 static void get_into(gsXmlNode * node, gsOptionList & result);
307 static gsXmlNode * put (
const gsOptionList & obj, gsXmlTree & data);
312 #ifdef GISMO_WITH_PYBIND11
317 void pybind11_init_gsOptionList(pybind11::module &m);
319 #endif // GISMO_WITH_PYBIND11
#define GISMO_COEFF_TYPE
Definition: gsConfig.h:26
size_t size() const
Returns the length of this list of options.
Definition: gsOptionList.h:169
std::string type
Type (as string)
Definition: gsOptionList.h:176
std::string label
Label.
Definition: gsOptionList.h:177
#define index_t
Definition: gsConfig.h:32
Definition: gsOptionList.h:175
std::ostream & operator<<(std::ostream &os, const _expr< E > &b)
Stream operator for expressions.
Definition: gsExpressions.h:382
StringTable m_strings
String-valued options/parameters.
Definition: gsOptionList.h:269
updateType
Options for gsOptionList::update.
Definition: gsOptionList.h:129
std::ostream & print(std::ostream &os) const
Prints this list of options to stream os.
Definition: gsOptionList.cpp:442
std::string val
Value (as string)
Definition: gsOptionList.h:179
void swap(gsOptionList &other)
Swaps contents.
Definition: gsOptionList.h:226
Provides forward declarations of types and structs.
SwitchTable m_switches
Switches (ON/OFF) options/parameters.
Definition: gsOptionList.h:272
std::string desc
Description.
Definition: gsOptionList.h:178
IntTable m_ints
Integer-valued options/parameters.
Definition: gsOptionList.h:270
RealTable m_reals
Real-valued options/parameters.
Definition: gsOptionList.h:271
Class which holds a list of parameters/options, and provides easy access to them. ...
Definition: gsOptionList.h:32
Provides declaration of input/output XML utilities struct.