Psi4
liboptions.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * @END LICENSE
26  */
27 
28 #ifndef _psi_src_lib_liboptions_liboptions_hpp
29 #define _psi_src_lib_liboptions_liboptions_hpp
30 
31 #include <string>
32 #include <vector>
33 #include <map>
34 // Forward boost python object
35 #ifdef _POSIX_C_SOURCE
36 #undef _POSIX_C_SOURCE
37 #endif
38 #ifdef _XOPEN_SOURCE
39 #undef _XOPEN_SOURCE
40 #endif
41 
43 #include "psi4/libpsi4util/libpsi4util.h" // Needed for Ref counting, string splitting, and conversions
44 #include "psi4/libpsi4util/ref.h" // Needed for Ref counting, string splitting, and conversions
45 #include "psi4/pybind11.h"
46 
47 namespace psi {
48 
50 {
51 public:
52  DataTypeException(const std::string& message) : PSIEXCEPTION(message) { }
53 };
54 
56 {
57 public:
58  IndexException(const std::string& message) : PSIEXCEPTION(message + " is not a valid option.") { }
59  IndexException(const std::string& message, const std::string &module) :
60  PSIEXCEPTION(message + " is not a valid option for module " + module) { }
61 };
62 
64 {
65 public:
66  DuplicateKeyException(const std::string &key, const std::string &type1, const std::string &type2,
67  const char *lfile, int lline):
68  PsiException("Option " + key + " has been declared as a " + type1 + " and a " + type2, lfile, lline) { }
69 };
70 
72 {
73 public:
74  OptionsException(const std::string& message) : PSIEXCEPTION("Options Exception: " + message) { }
75 };
76 
77 class Data;
78 class DataType
79 {
80  bool changed_;
81 public:
82  DataType();
83  virtual ~DataType();
84 
85  bool has_changed() const;
86  void changed();
87  void dechanged();
88 
89  void to_upper(std::string& str);
90 
91  virtual void add_choices(std::string str);
92  virtual std::string type() const;
93 
94  virtual bool is_array() const;
95  virtual unsigned int size() const;
96  virtual void add(DataType *);
97  virtual void add(std::string, DataType*);
98  virtual void add(bool);
99  virtual void add(int);
100  virtual void add(double);
101  virtual void add(std::string, bool);
102  virtual void add(std::string, std::string);
103  virtual void add(std::string, int);
104  virtual void add(std::string, double);
105  virtual void add(std::string, std::string, std::string);
106 
107  virtual bool exists(std::string);
108 
109  virtual std::string to_string() const;
110  virtual int to_integer() const;
111  virtual double to_double() const;
112  virtual py::list to_list() const;
113 
114  virtual void assign(DataType*);
115  virtual void assign(bool);
116  virtual void assign(int);
117  virtual void assign(double);
118  virtual void assign(std::string);
119 
120  virtual void reset();
121 
122  virtual Data& operator[](std::string);
123  virtual Data& operator[](unsigned int);
124 };
125 
126 #ifdef __INTEL_COMPILER
127 #pragma warning disable 654
128 #endif
129 class BooleanDataType : public DataType
130 {
131  bool boolean_;
132 public:
133  BooleanDataType();
134  BooleanDataType(bool b);
135  virtual ~BooleanDataType();
136 
137  virtual std::string type() const;
138 
139  virtual std::string to_string() const;
140  virtual int to_integer() const;
141  virtual double to_double() const;
142 
143  virtual void assign(bool b);
144  virtual void assign(int i);
145  virtual void assign(double d);
146  virtual void assign(std::string s);
147 };
148 
149 #ifdef __INTEL_COMPILER
150 #pragma warning disable 654
151 #endif
152 class IntDataType : public DataType
153 {
154  int integer_;
155 public:
156  IntDataType();
157  IntDataType(int i);
158  virtual ~IntDataType();
159 
160  virtual std::string type() const;
161 
162  virtual std::string to_string() const;
163  virtual int to_integer() const;
164  virtual double to_double() const;
165 
166  virtual void assign(bool b);
167  virtual void assign(int i);
168  virtual void assign(double d);
169  virtual void assign(std::string s);
170 };
171 
172 #ifdef __INTEL_COMPILER
173 #pragma warning disable 654
174 #endif
175 class DoubleDataType : public DataType
176 {
177  double double_;
178 public:
179  DoubleDataType();
180  DoubleDataType(double d);
181  virtual ~DoubleDataType();
182 
183  virtual std::string type() const;
184 
185  virtual std::string to_string() const;
186  virtual int to_integer() const;
187  virtual double to_double() const;
188 
189  virtual void assign(bool b);
190  virtual void assign(int i);
191  virtual void assign(double d);
192  virtual void assign(std::string s);
193 };
194 
195 #ifdef __INTEL_COMPILER
196 #pragma warning disable 654
197 #endif
198 class StringDataType : public DataType
199 {
200  std::string str_;
201  std::vector<std::string> choices_;
202 public:
203  StringDataType();
204  StringDataType(std::string s);
205  StringDataType(std::string s, std::string c);
206 
207  virtual ~StringDataType();
208 
209  virtual void add_choices(std::string str);
210 
211  virtual std::string type() const;
212 
213  virtual std::string to_string() const;
214  virtual int to_integer() const;
215  virtual double to_double() const;
216 
217  virtual void assign(bool b);
218  virtual void assign(int i);
219  virtual void assign(double d);
220  virtual void assign(std::string s);
221 };
222 
223 #ifdef __INTEL_COMPILER
224 #pragma warning disable 654
225 #endif
226 class IStringDataType : public DataType
227 {
228  std::string str_;
229  std::vector<std::string> choices_;
230 public:
231  IStringDataType();
232  IStringDataType(std::string s);
233  IStringDataType(std::string s, std::string c);
234  virtual ~IStringDataType();
235 
236  virtual void add_choices(std::string str);
237 
238  virtual std::string type() const;
239 
240  virtual std::string to_string() const;
241  virtual int to_integer() const;
242  virtual double to_double() const;
243 
244  virtual void assign(bool b);
245  virtual void assign(int i);
246  virtual void assign(double d);
247  virtual void assign(std::string s);
248 };
249 
250 class Data
251 {
253 public:
254  Data();
255  Data(DataType *t);
256  Data(const Data& copy);
257 
258  std::string to_string() const;
259  int to_integer() const;
260  double to_double() const;
261  py::list to_list() const;
262 
263  bool is_array() const;
264  unsigned int size() const;
265 
266  bool has_changed() const;
267 
268  void changed();
269  void dechanged();
270 
271  void add_choices(std::string str);
272 
273  std::string type() const;
274 
275  void add(DataType *data);
276  void add(std::string s, DataType *data);
277  void add(bool b);
278  void add(int i);
279  void add(double d);
280  void add(std::string s, std::string c);
281  void add(std::string key, bool b);
282  void add(std::string key, int i);
283  void add(std::string key, double d);
284  void add(std::string key, std::string s, std::string c);
285 
286  void assign(DataType *data);
287  void assign(bool b);
288  void assign(int i);
289  void assign(double d);
290  void assign(std::string s);
291 
292  void reset();
293 
294  DataType* get() const;
295 
296  Data& operator[](int i);
297  Data& operator[](std::string s);
298 };
299 
300 #ifdef __INTEL_COMPILER
301 #pragma warning disable 654
302 #endif
303 class ArrayType : public DataType
304 {
305  std::vector<Data> array_;
306 public:
307  ArrayType();
308 
309  virtual std::string type() const;
310 
311  virtual void add(DataType *data);
312  virtual void add(bool b);
313  virtual void add(int i);
314  virtual void add(double d);
315  virtual void add(std::string s, std::string c = "");
316  virtual void assign(DataType* data);
317 
318  virtual Data& operator[](unsigned int i);
319  virtual Data& operator[](std::string s);
320  virtual bool is_array() const;
321 
322  virtual unsigned int size() const;
323 
324  virtual std::string to_string() const;
325  virtual py::list to_list() const;
326 
327  virtual void reset();
328 };
329 
330 #ifdef __INTEL_COMPILER
331 #pragma warning disable 654
332 #endif
333 class MapType : public DataType
334 {
335  std::map<std::string, Data> keyvals_;
336  typedef std::map<std::string, Data>::iterator iterator;
337  typedef std::map<std::string, Data>::const_iterator const_iterator;
338 public:
339  MapType();
340 
341  virtual std::string type() const;
342 
343  virtual void add(std::string key, DataType *data);
344  virtual void add(std::string key, bool b);
345  virtual void add(std::string key, int i);
346  virtual void add(std::string key, double d);
347  virtual void add(std::string key, std::string s, std::string c = "");
348 
349  virtual bool exists(std::string key);
350 
351  virtual Data& operator[](std::string s);
352  virtual bool is_array() const;
353 
354  virtual unsigned int size() const;
355 
356  virtual std::string to_string() const;
357 };
358 
359 class Options
360 {
362 
364  std::map<std::string, Data> all_local_options_;
366  std::string current_module_;
367 
369  std::map<std::string, std::map<std::string, Data> > locals_;
370 
372  std::map<std::string, Data> globals_;
373 
374  typedef std::map<std::string, Data>::iterator iterator;
375  typedef std::map<std::string, Data>::const_iterator const_iterator;
376  typedef std::map<std::string, std::map<std::string, Data> >::const_iterator const_mod_iterator;
377 
378 public:
379  Options();
380 
381  Options & operator=(const Options& rhs);
382  bool read_globals() const;
383  void set_read_globals(bool _b);
384  void set_current_module(const std::string s);
385 
386  void to_upper(std::string& str);
387 
388  void validate_options();
389 
390  void add(std::string key, DataType *data);
391  void add(std::string key, bool b);
392  void add(std::string key, int i);
393  void add(std::string key, double d);
394  void add(std::string key, std::string s, std::string c = "");
395  void add_i(std::string key, std::string s, std::string c = "");
396 
397  void add_bool(std::string key, bool b);
398  void add_int(std::string key, int i);
399  void add_double(std::string key, double d);
400  void add_str(std::string key, std::string s, std::string c = "");
401  void add_str_i(std::string key, std::string s, std::string c = "");
402  void add_array(std::string key);
403  void set_bool(const std::string &module, const std::string &key, bool b);
404  void set_int(const std::string &module, const std::string &key, int i);
405  void set_double(const std::string & module, const std::string &key, double d);
406  void set_str(const std::string & module, const std::string &key, std::string s);
407  void set_str_i(const std::string & module, const std::string &key, std::string s);
408  void set_python(const std::string &module, const std::string& key, const py::object &p);
409  void set_array(const std::string &module, const std::string& key);
410 
411  void set_global_bool(const std::string &key, bool b);
412  void set_global_int(const std::string &key, int i);
413  void set_global_double(const std::string &key, double d);
414  void set_global_str(const std::string &key, const std::string &s);
415  void set_global_python(const std::string& key, const py::object &p);
416  void set_global_array(const std::string& key);
417 
418  DataType* set_global_array_entry(const std::string& key, DataType* entry, DataType* loc);
419  void set_global_array_double(std::string key, double val, DataType *entry);
420  void set_global_array_string(std::string key, std::string val, DataType *entry);
421  void set_global_array_int(std::string key, int val, DataType *entry);
422  DataType* set_global_array_array(std::string key, DataType *entry);
423  DataType* set_local_array_entry(const std::string &module, const std::string& key, DataType* entry, DataType* loc);
424  void set_local_array_double(const std::string &module, const std::string &key, double val, DataType *entry);
425  void set_local_array_string(const std::string &module, const std::string &key, std::string val, DataType *entry);
426  void set_local_array_int(const std::string &module, const std::string &key, int val, DataType *entry);
427  DataType* set_local_array_array(const std::string &module, const std::string &key, DataType *entry);
428 
429  void clear(void);
430 
431  bool exists_in_active(std::string key);
432 
433  bool exists_in_global(std::string key);
434  bool exists(std::string key);
435 
436  Data& get(std::string key);
437 
438  Data& get(std::map<std::string, Data>& m, std::string& key);
439 
440  Data& get_global(std::string key);
441 
442  Data& get_local(std::string& key);
443 
444  Data& use(std::string& key);
445 
446  Data& use_local(std::string& key);
447 
448  bool get_bool(std::string key);
449  int get_int(std::string key);
450  double get_double(std::string key);
451  std::string get_str(std::string key);
452  int* get_int_array(std::string key);
453  void fill_int_array(std::string key, int* empty_array);
454  std::vector<int> get_int_vector(std::string key);
455  double* get_double_array(std::string key);
456 
457  std::vector<double> get_double_vector(std::string key);
458 
459  const char* get_cstr(std::string key);
460 
461  Data& operator[](std::string key);
462 
463  std::string to_string() const;
464  std::string globals_to_string() const;
465 
466  void print();
467  void print_globals();
468  std::vector<std::string> list_globals();
469 };
470 
471 }
472 #endif
virtual void add(std::string key, DataType *data)
Definition: liboptions.cc:812
bool read_globals() const
Definition: liboptions.cc:895
std::map< std::string, Data >::iterator iterator
Definition: liboptions.h:374
virtual void assign(bool b)
Definition: liboptions.cc:255
Ref< DataType > ptr_
Definition: liboptions.h:252
std::vector< Data > array_
Definition: liboptions.h:305
bool exists_in_global(std::string key)
Definition: liboptions.cc:1172
virtual int to_integer() const
Definition: liboptions.cc:355
void set_local_array_string(const std::string &module, const std::string &key, std::string val, DataType *entry)
Definition: liboptions.cc:1143
virtual ~IStringDataType()
Definition: liboptions.cc:492
Data & use_local(std::string &key)
Definition: liboptions.cc:1225
std::map< std::string, Data > keyvals_
Definition: liboptions.h:335
IndexException(const std::string &message, const std::string &module)
Definition: liboptions.h:59
void set_global_array(const std::string &key)
Definition: liboptions.cc:1083
double get_double(std::string key)
Definition: liboptions.cc:1344
std::string type() const
Definition: liboptions.cc:620
virtual void assign(bool b)
Definition: liboptions.cc:365
void set_array(const std::string &module, const std::string &key)
Definition: liboptions.cc:1051
Data()
Definition: liboptions.cc:563
virtual Data & operator[](unsigned int i)
Definition: liboptions.cc:760
void set_str_i(const std::string &module, const std::string &key, std::string s)
Definition: liboptions.cc:1039
std::map< std::string, Data > globals_
&quot;Global&quot; set of options
Definition: liboptions.h:372
virtual void assign(DataType *data)
Definition: liboptions.cc:754
virtual std::string to_string() const
Definition: liboptions.cc:158
void set_global_array_double(std::string key, double val, DataType *entry)
Definition: liboptions.cc:1104
virtual Data & operator[](std::string)
Definition: liboptions.cc:208
virtual std::string type() const
Definition: liboptions.cc:288
Definition: liboptions.h:250
std::vector< std::string > choices_
Definition: liboptions.h:229
void set_str(const std::string &module, const std::string &key, std::string s)
Definition: liboptions.cc:1033
OptionsException(const std::string &message)
Definition: liboptions.h:74
virtual bool is_array() const
Definition: liboptions.cc:93
std::map< std::string, Data >::const_iterator const_iterator
Definition: liboptions.h:337
virtual int to_integer() const
Definition: liboptions.cc:512
bool has_changed() const
Definition: liboptions.cc:600
void set_global_array_int(std::string key, int val, DataType *entry)
Definition: liboptions.cc:1114
Definition: liboptions.h:63
void set_global_double(const std::string &key, double d)
Definition: liboptions.cc:1067
virtual void add_choices(std::string str)
Definition: liboptions.cc:495
Definition: liboptions.h:175
void set_int(const std::string &module, const std::string &key, int i)
Definition: liboptions.cc:1021
std::string str_
Definition: liboptions.h:200
virtual std::string type() const
Definition: liboptions.cc:807
virtual py::list to_list() const
Definition: python.cc:61
virtual ~IntDataType()
Definition: liboptions.cc:285
Definition: liboptions.h:152
std::map< std::string, Data > all_local_options_
A temporary map used for validation of local options.
Definition: liboptions.h:364
Definition: liboptions.h:226
Definition: pointgrp.h:105
void dechanged()
Definition: liboptions.cc:73
double * get_double_array(std::string key)
Definition: liboptions.cc:1378
void add_choices(std::string str)
Definition: liboptions.cc:615
void set_global_bool(const std::string &key, bool b)
Definition: liboptions.cc:1057
DataTypeException(const std::string &message)
Definition: liboptions.h:52
void set_local_array_int(const std::string &module, const std::string &key, int val, DataType *entry)
Definition: liboptions.cc:1148
std::map< std::string, Data >::iterator iterator
Definition: liboptions.h:336
std::string globals_to_string() const
Definition: liboptions/print.cc:116
virtual std::string type() const
Definition: liboptions.cc:88
bool changed_
Definition: liboptions.h:80
virtual void add(DataType *)
Definition: liboptions.cc:103
virtual double to_double() const
Definition: liboptions.cc:250
void set_python(const std::string &module, const std::string &key, const py::object &p)
Definition: liboptions.cc:1045
Data & get_local(std::string &key)
Definition: liboptions.cc:1198
Data & operator[](int i)
Definition: liboptions.cc:710
Data & use(std::string &key)
Definition: liboptions.cc:1259
void fill_int_array(std::string key, int *empty_array)
Definition: liboptions.cc:1362
bool exists_in_active(std::string key)
Definition: liboptions.cc:1164
void set_global_python(const std::string &key, const py::object &p)
Definition: liboptions.cc:1077
virtual std::string to_string() const
Definition: liboptions.cc:869
void add_bool(std::string key, bool b)
Definition: liboptions.cc:985
StringDataType()
Definition: liboptions.cc:387
py::list to_list() const
Definition: python.cc:56
virtual void assign(bool b)
Definition: liboptions.cc:436
virtual ~DoubleDataType()
Definition: liboptions.cc:340
virtual void add(DataType *data)
Definition: liboptions.cc:729
virtual double to_double() const
Definition: liboptions.cc:431
DataType * set_global_array_entry(const std::string &key, DataType *entry, DataType *loc)
Definition: liboptions.cc:1089
void set_read_globals(bool _b)
Definition: liboptions.cc:900
std::vector< double > get_double_vector(std::string key)
Definition: liboptions.cc:1387
virtual void assign(bool b)
Definition: liboptions.cc:310
Definition: exception.h:53
void to_upper(std::string &str)
Definition: liboptions.cc:911
void add_i(std::string key, std::string s, std::string c="")
Definition: liboptions.cc:975
virtual unsigned int size() const
Definition: liboptions.cc:864
int to_integer() const
Definition: liboptions.cc:580
bool has_changed() const
Definition: liboptions.cc:63
bool boolean_
Definition: liboptions.h:131
DoubleDataType()
Definition: liboptions.cc:332
BooleanDataType()
Definition: liboptions.cc:219
IStringDataType()
Definition: liboptions.cc:478
std::map< std::string, Data >::const_iterator const_iterator
Definition: liboptions.h:375
Definition: ref.h:125
virtual std::string type() const
Definition: liboptions.cc:416
std::vector< int > get_int_vector(std::string key)
Definition: liboptions.cc:1369
void set_local_array_double(const std::string &module, const std::string &key, double val, DataType *entry)
Definition: liboptions.cc:1138
Options()
Definition: liboptions.cc:879
void clear(void)
Definition: liboptions.cc:1158
void reset()
Definition: liboptions.cc:700
int get_int(std::string key)
Definition: liboptions.cc:1339
Options & operator=(const Options &rhs)
Definition: liboptions.cc:883
void dechanged()
Definition: liboptions.cc:610
void set_bool(const std::string &module, const std::string &key, bool b)
Definition: liboptions.cc:1015
virtual std::string to_string() const
Definition: liboptions.cc:293
void add_array(std::string key)
Definition: liboptions.cc:1010
virtual void reset()
Definition: liboptions.cc:203
void to_upper(std::string &str)
Definition: liboptions.cc:78
bool is_array() const
Definition: liboptions.cc:590
void assign(DataType *data)
Definition: liboptions.cc:675
virtual py::list to_list() const
Definition: liboptions.cc:173
MapType()
Definition: liboptions.cc:804
virtual std::string type() const
Definition: liboptions.cc:724
bool exists(std::string key)
Definition: liboptions.cc:1182
virtual bool is_array() const
Definition: liboptions.cc:859
virtual std::string to_string() const
Definition: liboptions.cc:235
const char * get_cstr(std::string key)
Definition: liboptions.cc:1396
Definition: liboptions.h:129
DataType * set_local_array_array(const std::string &module, const std::string &key, DataType *entry)
Definition: liboptions.cc:1153
Definition: liboptions.h:71
void add_str(std::string key, std::string s, std::string c="")
Definition: liboptions.cc:1000
Definition: liboptions.h:359
virtual double to_double() const
Definition: liboptions.cc:305
virtual std::string type() const
Definition: liboptions.cc:343
void add_double(std::string key, double d)
Definition: liboptions.cc:995
virtual unsigned int size() const
Definition: liboptions.cc:98
Definition: liboptions.h:333
Definition: liboptions.h:49
void add_int(std::string key, int i)
Definition: liboptions.cc:990
unsigned int size() const
Definition: liboptions.cc:595
void set_global_str(const std::string &key, const std::string &s)
Definition: liboptions.cc:1072
void add_str_i(std::string key, std::string s, std::string c="")
Definition: liboptions.cc:1005
virtual void reset()
Definition: liboptions.cc:799
virtual void assign(bool b)
Definition: liboptions.cc:522
std::string to_string() const
Definition: liboptions/print.cc:54
void add(DataType *data)
Definition: liboptions.cc:625
virtual void add_choices(std::string str)
Definition: liboptions.cc:408
Data & get_global(std::string key)
Definition: liboptions.cc:1215
std::vector< std::string > list_globals()
Definition: liboptions/print.cc:158
void add(std::string key, DataType *data)
Definition: liboptions.cc:931
Definition: liboptions.h:303
virtual int to_integer() const
Definition: liboptions.cc:300
bool edit_globals_
Definition: liboptions.h:361
Definition: liboptions.h:55
void set_double(const std::string &module, const std::string &key, double d)
Definition: liboptions.cc:1027
virtual std::string to_string() const
Definition: liboptions.cc:348
virtual int to_integer() const
Definition: liboptions.cc:163
std::string to_string() const
Definition: liboptions.cc:575
Definition: liboptions.h:78
std::string current_module_
The module that&#39;s active right now.
Definition: liboptions.h:366
virtual bool exists(std::string)
Definition: liboptions.cc:153
double to_double() const
Definition: liboptions.cc:585
virtual ~StringDataType()
Definition: liboptions.cc:405
virtual double to_double() const
Definition: liboptions.cc:360
virtual ~BooleanDataType()
Definition: liboptions.cc:227
virtual std::string to_string() const
Definition: liboptions.cc:507
void validate_options()
Definition: liboptions.cc:916
DuplicateKeyException(const std::string &key, const std::string &type1, const std::string &type2, const char *lfile, int lline)
Definition: liboptions.h:66
DataType * set_global_array_array(std::string key, DataType *entry)
Definition: liboptions.cc:1119
void print_globals()
Definition: liboptions/print.cc:151
std::string str_
Definition: liboptions.h:228
virtual std::string type() const
Definition: liboptions.cc:230
bool get_bool(std::string key)
Definition: liboptions.cc:1334
virtual std::string to_string() const
Definition: liboptions.cc:421
virtual Data & operator[](std::string s)
Definition: liboptions.cc:851
ArrayType()
Definition: liboptions.cc:721
void changed()
Definition: liboptions.cc:605
void print()
Definition: liboptions/print.cc:108
void set_global_int(const std::string &key, int i)
Definition: liboptions.cc:1062
std::map< std::string, std::map< std::string, Data > >::const_iterator const_mod_iterator
Definition: liboptions.h:376
int * get_int_array(std::string key)
Definition: liboptions.cc:1353
virtual double to_double() const
Definition: liboptions.cc:168
virtual bool exists(std::string key)
Definition: liboptions.cc:842
virtual std::string type() const
Definition: liboptions.cc:502
IntDataType()
Definition: liboptions.cc:277
void set_global_array_string(std::string key, std::string val, DataType *entry)
Definition: liboptions.cc:1109
virtual double to_double() const
Definition: liboptions.cc:517
DataType * set_local_array_entry(const std::string &module, const std::string &key, DataType *entry, DataType *loc)
Definition: liboptions.cc:1124
virtual void add_choices(std::string str)
Definition: liboptions.cc:83
IndexException(const std::string &message)
Definition: liboptions.h:58
virtual unsigned int size() const
Definition: liboptions.cc:782
virtual ~DataType()
Definition: liboptions.cc:60
#define PSIEXCEPTION(message)
Definition: exception.h:47
virtual void assign(DataType *)
Definition: liboptions.cc:178
std::map< std::string, std::map< std::string, Data > > locals_
&quot;Active&quot; set of options
Definition: liboptions.h:369
int integer_
Definition: liboptions.h:154
std::vector< std::string > choices_
Definition: liboptions.h:201
virtual int to_integer() const
Definition: liboptions.cc:245
Data & operator[](std::string key)
Definition: liboptions.cc:1401
void changed()
Definition: liboptions.cc:68
virtual bool is_array() const
Definition: liboptions.cc:777
DataType()
Definition: liboptions.cc:56
void set_current_module(const std::string s)
Definition: liboptions.cc:905
virtual int to_integer() const
Definition: liboptions.cc:426
double double_
Definition: liboptions.h:177
std::string get_str(std::string key)
Definition: liboptions.cc:1349
virtual std::string to_string() const
Definition: liboptions.cc:787
Definition: liboptions.h:198