Bayeux  3.4.1
Core Foundation library for SuperNEMO
parameter_model.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date : 2014-05-11
4  * Last modified : 2016-10-31
5  *
6  * Copyright (C) 2014-2016 Francois Mauger <mauger@lpccaen.in2p3.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or (at
11  * your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc. 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  * Description:
24  *
25  * The model of a configuration variant parameter.
26  *
27  */
28 
29 #ifndef DATATOOLS_CONFIGURATION_PARAMETER_MODEL_H
30 #define DATATOOLS_CONFIGURATION_PARAMETER_MODEL_H
31 
32 // Standard library:
33 #include <string>
34 #include <set>
35 #include <vector>
36 #include <map>
37 
38 // This project (Bayeux/datatools)
39 #include <datatools/i_tree_dump.h>
41 #include <datatools/types.h>
45 #include <datatools/real_range.h>
46 
47 namespace datatools {
48 
49  // Forward declaration:
50  class multi_properties;
51 
52  namespace configuration {
53 
54  // Forward declaration:
55  class variant_model;
56  class variant_physical;
57  class variant_repository;
58 
61  {
62  public:
63 
65  enum rst_flags {
68  };
69 
71  virtual bool is_name_valid(const std::string & name_) const;
72 
74  typedef std::map<std::string, variant_physical> variant_dict_type;
75 
77  typedef std::map<std::string, std::string> group_dict_type;
78 
85  };
86 
88  static std::string label_from_mutability(const mutability_type);
89 
91  static mutability_type mutability_from_label(const std::string &);
92 
100  };
101 
103  static std::string label_from_variable_mode(const variable_mode_type);
104 
106  static variable_mode_type variable_mode_from_label(const std::string &);
107 
109  static const std::string & aux_prefix();
110 
114  PATH_INPUT = 0x1,
115  PATH_OUTPUT = 0x2,
117  };
118 
120  static std::string label_from_path_io(const path_io_type);
121 
123  static path_io_type path_io_from_label(const std::string &);
124 
131  {
132  public:
133 
135  enum ctor_flags {
137  };
138 
140  base_enum_metadata(uint32_t flags_ = 0);
141 
143  bool has_documentation() const;
144 
146  void set_documentation(const std::string &);
147 
149  const std::string & get_documentation() const;
150 
152  bool has_variants() const;
153 
155  bool has_variant(const std::string & variant_name_) const;
156 
158  void add_variant(const std::string & variant_name_);
159 
161  void remove_variant(const std::string & variant_name_);
162 
164  void remove_variants();
165 
167  const std::set<std::string> & get_variants() const;
168 
170  bool has_group() const;
171 
173  void set_group(const std::string & group_name_);
174 
176  const std::string & get_group() const;
177 
179  bool match_group(const std::string & group_name_) const;
180 
182  void initialize(const datatools::properties & config_,
183  parameter_model & parmod_);
184 
186  void reset();
187 
189  virtual void tree_dump(std::ostream & out_ = std::clog,
190  const std::string & title_ = "",
191  const std::string & indent_ = "",
192  bool inherit_ = false) const;
193 
195  enum rst_flags {
197  };
198 
200  void print_rst(std::ostream & out_,
201  const std::string & indent_ = "",
202  const uint32_t flags_ = 0) const;
203 
205  bool has_group_support() const;
206 
207  protected:
208 
209  std::string _documentation;
210  std::set<std::string> _variants;
211  std::string _group;
212 
213  private:
214  bool _no_group_support_ = false;
215  };
216 
220  };
221 
224  };
225  typedef std::map<int, integer_enum_value_metadata> integer_enum_dict_type;
226 
229  };
230  typedef std::map<integer_range, integer_range_enum_metadata> integer_range_enum_dict_type;
231 
234  };
235  typedef std::map<double, real_enum_value_metadata> real_enum_dict_type;
236 
239  };
240  typedef std::map<std::string, string_enum_value_metadata> string_enum_dict_type;
241 
244  };
245  typedef std::map<real_range, real_range_enum_metadata> real_range_enum_dict_type;
246 
248  parameter_model();
249 
251  virtual ~parameter_model();
252 
254  bool has_documentation() const;
255 
257  void set_documentation(const std::string & documentation_);
258 
260  const std::string & get_documentation() const;
261 
263  bool has_type() const;
264 
266  void set_type(const basic_type type_);
267 
269  basic_type get_type() const;
270 
272  bool is_boolean() const;
273 
275  bool is_integer() const;
276 
278  bool is_real() const;
279 
281  bool is_string() const;
282 
284  bool is_path() const;
285 
287  void set_path(const bool is_path_);
288 
290  void reset_path();
291 
293  bool has_path_io() const;
294 
296  void set_path_io(const path_io_type path_io_);
297 
299  bool is_path_input() const;
300 
302  bool is_path_output() const;
303 
305  bool is_path_input_output() const;
306 
308  void set(const basic_type type_, const variable_mode_type variable_mode_);
309 
311  bool has_variable_mode() const;
312 
314  void set_variable_mode(const variable_mode_type variable_mode_);
315 
318 
320  bool has_mutability() const;
321 
323  void set_mutability(const mutability_type mutability_);
324 
327 
329  bool is_fixed() const;
330 
332  bool is_variable() const;
333 
335  bool has_fixed_value() const;
336 
338  bool get_fixed_boolean() const;
339 
341  int get_fixed_integer() const;
342 
344  double get_fixed_real() const;
345 
347  const std::string & get_fixed_string() const;
348 
350  void set_fixed_boolean(const bool value_);
351 
353  void set_fixed_integer(const int value_);
354 
356  void set_fixed_real(const double value_);
357 
359  void set_fixed_string(const std::string & value_);
360 
362  bool is_free() const;
363 
365  bool is_interval() const;
366 
368  bool is_enumeration() const;
369 
371  bool has_integer_domain() const;
372 
374  void set_integer_domain(const integer_range & ir_);
375 
377  const integer_range & get_integer_domain() const;
378 
380  bool has_real_domain() const;
381 
382  // Set real interval
383  void set_real_domain(const real_range & ir_);
384 
386  const real_range & get_real_domain() const;
387 
389  bool has_default_value() const;
390 
392  void reset_default_value();
393 
395  void set_default_boolean(const bool value_);
396 
398  bool get_default_boolean() const;
399 
401  void set_default_integer(const int value_);
402 
404  int get_default_integer() const;
405 
407  bool has_real_precision() const;
408 
410  void set_real_precision(const double prec_);
411 
413  void reset_real_precision();
414 
416  double get_real_precision() const;
417 
419  double get_real_effective_precision() const;
420 
422  void set_default_real(const double value_);
423 
425  double get_default_real() const;
426 
428  void set_default_string(const std::string & value_);
429 
431  const std::string & get_default_string() const;
432 
434  bool has_real_unit_label() const;
435 
437  void set_real_unit_label(const std::string & unit_label_);
438 
440  const std::string & get_real_unit_label() const;
441 
443  bool has_real_preferred_unit() const;
444 
446  void set_real_preferred_unit(const std::string & value_);
447 
449  const std::string & get_real_preferred_unit() const;
450 
452  bool fetch_real_display_unit(std::string & display_unit_symbol_, double & unit_value_) const;
453 
454  //
455  // Boolean
456  //
457 
459  void set_enumerated_boolean_value_metadata(const bool value_, const boolean_enum_value_metadata & metadata_);
460 
463 
466 
468  bool enumerated_boolean_value_has_group(const bool value_) const;
469 
471  const std::string & get_enumerated_boolean_value_group(const bool value_) const;
472 
474  void build_list_of_enumerated_boolean_groups(std::set<std::string> & groups_) const;
475 
477  void build_list_of_enumerated_boolean_values_in_group(const std::string & group_,
478  std::set<bool> & values_) const;
479 
481  void build_list_of_enumerated_boolean_values(std::set<bool> & values_) const;
482 
483  //
484  // Integer enumerated
485  //
486 
488  void add_enumerated_integer_value(const int value_,
489  const integer_enum_value_metadata & metadata,
490  const bool default_ = false);
491 
493  void add_enumerated_integer_value(const int value_,
494  const bool default_ = false);
495 
497  bool has_enumerated_integer_value(const int value_) const;
498 
500  void fetch_integer_enumeration(std::vector<int> & values_) const;
501 
503  bool enumerated_integer_value_has_group(const int value_) const;
504 
506  const std::string & get_enumerated_integer_value_group(const int value_) const;
507 
510 
513 
515  void build_list_of_enumerated_integer_groups(std::set<std::string> & groups_) const;
516 
518  void build_list_of_enumerated_integer_values_in_group(const std::string & group_,
519  std::set<int> & values_) const;
520 
522  void build_list_of_enumerated_integer_values(std::set<int> & values_) const;
523 
524  //
525  // Real enumerated
526  //
527 
529  bool has_enumerated_real_value(const double value_) const;
530 
532  bool find_enumerated_real_value(const double value_, double & enum_value_) const;
533 
535  void add_enumerated_real_value(const double value_,
536  const real_enum_value_metadata & metadata_,
537  const bool default_ = false);
538 
540  void add_enumerated_real_value(const double value_,
541  const bool default_ = false);
542 
544  bool enumerated_real_value_has_group(const double value_) const;
545 
547  const std::string & get_enumerated_real_value_group(const double value_) const;
548 
550  const real_enum_value_metadata & get_enumerated_real_value_metadata(const double value_) const;
551 
554 
556  void fetch_real_enumeration(std::vector<double> & values_) const;
557 
559  void build_list_of_enumerated_real_groups(std::set<std::string> & groups_) const;
560 
562  void build_list_of_enumerated_real_values_in_group(const std::string & group_,
563  std::set<double> & values_) const;
564 
566  void build_list_of_enumerated_real_values(std::set<double> & values_) const;
567 
568  //
569  // String enumerated
570  //
571 
573  bool has_enumerated_string_value(const std::string & value_) const;
574 
576  void add_enumerated_string_value(const std::string & value_,
577  const string_enum_value_metadata & metadata_,
578  const bool default_ = false);
579 
581  bool enumerated_string_value_has_group(const std::string & value_) const;
582 
584  const std::string & get_enumerated_string_value_group(const std::string & value_) const;
585 
587  void add_enumerated_string_value(const std::string & value_,
588  const bool default_ = false);
589 
591  const string_enum_value_metadata & get_enumerated_string_value_metadata(const std::string & value_) const;
592 
595 
597  void build_list_of_enumerated_string_groups(std::set<std::string> & groups_) const;
598 
600  void build_list_of_enumerated_string_values_in_group(const std::string & group_,
601  std::set<std::string> & values_) const;
602 
604  void build_list_of_enumerated_string_values(std::set<std::string> & values_) const;
605 
606  //
607  // Group
608 
610  bool has_groups() const;
611 
613  bool has_group(const std::string & group_name_) const;
614 
616  void add_group(const std::string & group_name_,
617  const std::string & doc_ = "");
618 
620  void build_set_of_groups(std::set<std::string> & group_) const;
621 
622  //
623  // Variant
624  //
625 
627  bool has_variant(const std::string & variant_name_) const;
628 
630  void add_variant(const std::string & variant_name_,
631  const vm_handle_type & variant_model_handle_,
632  const std::string & description_ = "");
633 
635  void remove_variant(const std::string & variant_name_);
636 
638  const std::string & get_variant_description(const std::string & variant_name_) const;
639 
641  const variant_model & get_variant_model(const std::string & variant_name_) const;
642 
644  vm_handle_type get_variant_model_handle(const std::string & variant_name_) const;
645 
646  // Variant associations:
647 
649  void associate_variant_to_boolean(const bool value_, const std::string & variant_name_);
650 
652  void associate_variant_to_integer(const int value_, const std::string & variant_name_);
653 
655  void associate_variant_to_real(const double value_, const std::string & variant_name_);
656 
658  void associate_variant_to_string(const std::string & value_,
659  const std::string & variant_name_);
660 
661  //
662  // Management
663  //
664 
666  bool is_initialized() const;
667 
669  void initialize(const properties & setup_, model_item_dict_type & items_);
670 
672  void initialize_standalone(const properties &);
673 
675  void initialize_simple();
676 
678  void reset();
679 
681  virtual void tree_dump(std::ostream & out_ = std::clog,
682  const std::string & title_ = "",
683  const std::string & indent_ = "",
684  bool inherit_ = false) const;
685 
687  bool is_boolean_valid(const bool) const;
688 
690  bool is_integer_valid(const int) const;
691 
693  bool is_real_valid(const double) const;
694 
696  bool is_string_valid(const std::string &) const;
697 
699  const variant_dict_type & get_variants() const;
700 
702  bool find_variants_associated_to_boolean(const bool value_, std::set<std::string> & variants_) const;
703 
705  bool find_variants_associated_to_integer(const int value_, std::set<std::string> & variants_) const;
706 
708  bool find_variants_associated_to_real(const double value_, std::set<std::string> & variants_) const;
709 
711  bool find_variants_associated_to_string(const std::string & value_, std::set<std::string> & variants_) const;
712 
713  //
714  // Ranges of interest (available for integer and real parameters)
715  //
716 
719  const std::string & variant_name_);
720 
722  void associate_variant_to_real_range(const real_range & range_,
723  const std::string & variant_name_);
724 
727 
729  void add_real_range(const real_range &, const real_range_enum_metadata &);
730 
733 
736 
737  //
738  // Miscellaneous
739  //
740 
743 
745  void print_rst(std::ostream & out_,
746  const std::string & indent_ = "",
747  const uint32_t flags_ = 0) const;
748 
749  protected:
750 
753 
755  void _set_default();
756 
770  void _parse_string_enumeration_from_csv_file(const std::string & csv_filename_,
771  const char csv_separator_ = ':',
772  const char csv_subseparator_ = ';',
773  const std::string & value_regex_ = "",
774  const std::string & group_regex_ = "");
775 
776  private:
777 
779  void _update_real_domain_();
780 
781  private:
782 
783  bool _initialized_;
784  std::string _documentation_;
785 
786  // Basic traits:
787  basic_type _type_;
788  mutability_type _mutability_;
789  bool _has_default_value_;
790  bool _has_fixed_value_;
791  variable_mode_type _variable_mode_;
792  variant_dict_type _variants_;
793  group_dict_type _groups_;
794 
795  // Boolean property:
796  bool _boolean_default_;
797  bool _boolean_fixed_;
798  boolean_enum_value_metadata _false_metadata_;
799  boolean_enum_value_metadata _true_metadata_;
800 
801  // Integer property:
802  integer_range _integer_domain_;
803  int _integer_default_;
804  int _integer_fixed_;
805  integer_enum_dict_type _integer_enumeration_;
806  integer_range_enum_dict_type _integer_ranges_;
807 
808  // Real property:
809  std::string _real_unit_label_;
810  std::string _real_preferred_unit_;
811  double _real_precision_;
812  double _real_default_;
813  double _real_fixed_;
814  real_range _real_domain_;
815  real_enum_dict_type _real_enumeration_;
816  real_range_enum_dict_type _real_ranges_;
817 
818  // String property:
819  std::string _string_default_;
820  std::string _string_fixed_;
821  bool _path_;
822  path_io_type _path_io_;
823  string_enum_dict_type _string_enumeration_;
824 
825  };
826 
827  } // end of namespace configuration
828 
829 } // end of namespace datatools
830 
831 // OCD support:
832 #include <datatools/ocd_macros.h>
833 
837 
838 #endif // DATATOOLS_CONFIGURATION_PARAMETER_MODEL_H
839 
840 // Local Variables: --
841 // mode: c++ --
842 // c-file-style: "gnu" --
843 // tab-width: 2 --
844 // End: --
variable_mode_type
Parameter variable mode.
Definition: parameter_model.h:94
void print_rst(std::ostream &out_, const std::string &indent_="", const uint32_t flags_=0) const
Print in ReST format.
Undefined I/O flag.
Definition: parameter_model.h:113
Model of a configuration variant.
Definition: variant_model.h:59
void set_path(const bool is_path_)
Set the path flag.
static variable_mode_type variable_mode_from_label(const std::string &)
Return the variable mode associated to a label.
bool is_string_valid(const std::string &) const
Check if a string value is valid.
Parameter can have a free value.
Definition: parameter_model.h:96
void set_documentation(const std::string &)
Set documentation.
void set_real_preferred_unit(const std::string &value_)
Set the unit symbol.
bool is_integer_valid(const int) const
Check if an integer value is valid.
const variant_model & get_variant_model(const std::string &variant_name_) const
Return a const reference to a variant model associated to a given variant.
void add_enumerated_string_value(const std::string &value_, const string_enum_value_metadata &metadata_, const bool default_=false)
Add an enumerated string value with its metadata.
std::set< std::string > _variants
Set of variants associated to /triggered by the value.
Definition: parameter_model.h:210
Parameter is fixed (no mutability)
Definition: parameter_model.h:82
void set_variable_mode(const variable_mode_type variable_mode_)
Set the mode of the parameter.
void set_fixed_integer(const int value_)
Set fixed integer value.
basic_type get_type() const
Return the type of the parameter.
bool has_integer_domain() const
Check the integer domain.
void reset_real_precision()
Reset the real precision.
Base enumerated item metadata.
Definition: parameter_model.h:129
static void init_ocd(datatools::object_configuration_description &)
OCD support.
std::map< int, integer_enum_value_metadata > integer_enum_dict_type
Definition: parameter_model.h:225
boolean_enum_value_metadata & grab_enumerated_boolean_value_metadata(const bool value_)
Return the metadata associated to a boolean value.
void remove_variant(const std::string &variant_name_)
Remove a variant, given its name.
Flag for input & output file.
Definition: parameter_model.h:116
String enumeration support.
Definition: parameter_model.h:238
void associate_variant_to_boolean(const bool value_, const std::string &variant_name_)
Associate a variant to an enumerated boolean value.
bool get_default_boolean() const
Return the default boolean.
Undefined mutability trait.
Definition: parameter_model.h:81
void set_default_boolean(const bool value_)
Set default boolean value.
Integer range support.
Definition: parameter_model.h:228
std::string _group
Group the value belongs to.
Definition: parameter_model.h:211
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
void initialize_simple()
Bare initialization.
bool has_variant(const std::string &variant_name_) const
Check if a variant exists.
Undefined variable mode.
Definition: parameter_model.h:95
static const uint32_t bit01
Definition: bit_mask.h:28
void set_default_string(const std::string &value_)
Set default string value.
void set_documentation(const std::string &documentation_)
Set the documentation.
Boolean enumeration support.
Definition: parameter_model.h:218
const variant_dict_type & get_variants() const
Return a reference to the list of variants.
Flag for input file.
Definition: parameter_model.h:114
std::map< integer_range, integer_range_enum_metadata > integer_range_enum_dict_type
Definition: parameter_model.h:230
Integer enumeration support.
Definition: parameter_model.h:223
const std::set< std::string > & get_variants() const
Return the set of variants.
int get_fixed_integer() const
Return the fixed integer.
rst_flags
Special flag for RestructuredText formatting.
Definition: parameter_model.h:65
const std::string & get_enumerated_real_value_group(const double value_) const
Return the group associated to an enumerated real value.
std::map< real_range, real_range_enum_metadata > real_range_enum_dict_type
Definition: parameter_model.h:245
Parameter can have values from an enumeration.
Definition: parameter_model.h:97
void fetch_integer_enumeration(std::vector< int > &values_) const
Fetch the list of enumerated integer values.
static path_io_type path_io_from_label(const std::string &)
Return the path I/O mode associated to a label.
bool match_group(const std::string &group_name_) const
Check if a group name matches the group set.
bool has_documentation() const
Check if documentation is set.
bool is_string() const
Check string type.
path_io_type
Path I/O flags.
Definition: parameter_model.h:112
const std::string & get_enumerated_integer_value_group(const int value_) const
Return the group associated to an enumerated integer value.
void build_set_of_groups(std::set< std::string > &group_) const
Build the list of groups.
void initialize(const datatools::properties &config_, parameter_model &parmod_)
Initialization.
bool has_real_unit_label() const
Check the real unit label.
string_enum_value_metadata & grab_enumerated_string_value_metadata(const std::string &value_)
Return the metadata associated to an enumerated string value.
void associate_variant_to_integer_range(const integer_range &range_, const std::string &variant_name_)
Associate a variant to an integer range.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
bool has_type() const
Check if type is defined.
bool find_variants_associated_to_real(const double value_, std::set< std::string > &variants_) const
Find the name of the variant associated to a given real value.
int get_default_integer() const
Return the default integer.
const std::string & get_enumerated_boolean_value_group(const bool value_) const
Return the group associated to an enumerated boolean value.
An object that describes the way an object of a given class can be configured through properties.
Definition: object_configuration_description.h:234
void build_list_of_enumerated_integer_groups(std::set< std::string > &groups_) const
Build the list of groups associated to enumerated integer value.
bool fetch_real_display_unit(std::string &display_unit_symbol_, double &unit_value_) const
Fetch the display unit symbol.
rst_flags
Restructured text formatting.
Definition: parameter_model.h:195
const real_range & get_real_domain() const
Return the real domain.
const std::string & get_real_preferred_unit() const
Return the unit symbol.
void _set_default()
Set default values.
void set_default_integer(const int value_)
Set default integer value.
void _set_variable_mode(const variable_mode_type)
Set the mode.
void build_list_of_enumerated_string_values_in_group(const std::string &group_, std::set< std::string > &values_) const
Build the list of enumerated string values associated to a given group.
void build_list_of_enumerated_integer_values(std::set< int > &values_) const
Build the list of enumerated integer values.
basic_type
Basic type identifier.
Definition: types.h:28
void reset_path()
Reset the path flag.
bool enumerated_string_value_has_group(const std::string &value_) const
Check if an enumerated string value has a group.
double get_fixed_real() const
Return the fixed real.
const std::string & get_real_unit_label() const
Return the unit label.
bool has_real_precision() const
Check the real precision.
vm_handle_type get_variant_model_handle(const std::string &variant_name_) const
Return a variant model handle associated to a given variant.
void set_default_real(const double value_)
Set default real value.
void set_path_io(const path_io_type path_io_)
Set the path I/O.
const integer_range & get_integer_domain() const
Return the integer domain.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
bool has_real_preferred_unit() const
Check the real unit symbol.
bool has_variable_mode() const
Check if variable mode is defined.
const std::string & get_enumerated_string_value_group(const std::string &value_) const
Return the group associated to an enumerated string value.
std::map< std::string, model_item > model_item_dict_type
Dictionary of items.
Definition: utils.h:62
void set_real_precision(const double prec_)
Set the real precision.
Real range support.
Definition: parameter_model.h:243
void build_list_of_enumerated_boolean_values_in_group(const std::string &group_, std::set< bool > &values_) const
Build the list of enumerated boolean values associated to a given group.
bool enumerated_integer_value_has_group(const int value_) const
Check if an enumerated integer value has a group.
void associate_variant_to_real_range(const real_range &range_, const std::string &variant_name_)
Associate a variant to an real range.
void associate_variant_to_real(const double value_, const std::string &variant_name_)
Associate a variant to an enumerated real value.
bool has_variant(const std::string &variant_name_) const
Check is a variant is set, given its name.
bool is_variable() const
Check mutability trait.
bool is_free() const
Check free mode.
std::map< std::string, string_enum_value_metadata > string_enum_dict_type
Definition: parameter_model.h:240
bool has_enumerated_integer_value(const int value_) const
Check enumerated integer value.
bool find_variants_associated_to_integer(const int value_, std::set< std::string > &variants_) const
Find the set of variants associated to a given integer value.
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
double get_real_precision() const
Return the real precision.
mutability_type get_mutability() const
Get mutability.
bool is_enumeration() const
Check enumeration mode.
void associate_variant_to_integer(const int value_, const std::string &variant_name_)
Associate a variant to an enumerated integer value.
const boolean_enum_value_metadata & get_enumerated_boolean_value_metadata(const bool value_) const
Return the metadata associated to a boolean value.
void set_real_domain(const real_range &ir_)
const std::string & get_group() const
Return the group.
bool find_enumerated_real_value(const double value_, double &enum_value_) const
Find the matching enumerated real value taking into account the precision if any.
const string_enum_value_metadata & get_enumerated_string_value_metadata(const std::string &value_) const
Return the metadata associated to an enumerated string value.
bool has_real_domain() const
Check the real domain.
bool is_real_valid(const double) const
Check if a real value is valid.
const std::string & get_variant_description(const std::string &variant_name_) const
Return a description string associated to a given variant.
std::map< std::string, variant_physical > variant_dict_type
Dictionary of variant physicals.
Definition: parameter_model.h:74
void build_list_of_enumerated_real_groups(std::set< std::string > &groups_) const
Build the list of groups associated to enumerated reals.
const real_enum_value_metadata & get_enumerated_real_value_metadata(const double value_) const
Return the metadata associated to an enumerated real value.
const integer_enum_value_metadata & get_enumerated_integer_value_metadata(const int value_) const
Return the metadata associated to an enumerated integer value.
Parameter is variable (mutability)
Definition: parameter_model.h:83
bool has_enumerated_string_value(const std::string &value_) const
Check enumerated string value.
const std::string & get_documentation() const
Return documentation.
void remove_variant(const std::string &variant_name_)
Remove a variant.
A class representing an interval of integer values.
Definition: integer_range.h:49
bool enumerated_boolean_value_has_group(const bool value_) const
Check if an enumerated boolean value has a group.
virtual bool is_name_valid(const std::string &name_) const
Check if a name is valid.
void set_mutability(const mutability_type mutability_)
Set the mutability trait.
mutability_type
Parameter mode.
Definition: parameter_model.h:80
void build_list_of_enumerated_real_values(std::set< double > &values_) const
Build the list of enumerated integer values.
void _parse_string_enumeration_from_csv_file(const std::string &csv_filename_, const char csv_separator_=':', const char csv_subseparator_=';', const std::string &value_regex_="", const std::string &group_regex_="")
bool has_enumerated_real_value(const double value_) const
Check enumerated real value.
void associate_variant_to_string(const std::string &value_, const std::string &variant_name_)
Associate a variant to an enumerated string value.
double get_default_real() const
Return the default real.
void add_group(const std::string &group_name_, const std::string &doc_="")
Add a group.
variable_mode_type get_variable_mode() const
Return the mode of the parameter.
static std::string label_from_mutability(const mutability_type)
Return the label associated to the mutability.
void add_enumerated_integer_value(const int value_, const integer_enum_value_metadata &metadata, const bool default_=false)
Add an enumerated integer value.
void reset_default_value()
Reset the default value.
static const std::string & aux_prefix()
Return the prefix for auxialiary properties.
bool is_boolean_valid(const bool) const
Check if a boolean value is valid.
bool has_path_io() const
Check if path I/O mode is defined.
ctor_flags
Constructor flags.
Definition: parameter_model.h:135
bool has_fixed_value() const
Check fixed value.
void add_variant(const std::string &variant_name_, const vm_handle_type &variant_model_handle_, const std::string &description_="")
Add a variant with its model and description string.
bool has_documentation() const
Check if the documentation is empty.
void initialize_standalone(const properties &)
Initialization from properties only.
void set_group(const std::string &group_name_)
Set group.
void add_real_range(const real_range &, const real_range_enum_metadata &)
Add a real range.
bool is_initialized() const
Check initialization status.
Parameter can have values in an interval (if applicable)
Definition: parameter_model.h:98
bool is_path_output() const
Check path output flag.
A class representing an interval of real (double precision) values with support of embedded units.
Definition: real_range.h:45
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
bool get_fixed_boolean() const
Return the fixed boolean.
bool is_path() const
Check path string.
bool has_mutability() const
Check mutability.
std::string _documentation
Terse documentation string associated to the enumerated item.
Definition: parameter_model.h:209
const real_range_enum_dict_type & get_real_ranges() const
Return the dictionary ofreal ranges.
void set_integer_domain(const integer_range &ir_)
Set integer interval.
bool is_path_input_output() const
Check path output flag.
integer_enum_value_metadata & grab_enumerated_integer_value_metadata(const int value_)
Return the metadata associated to an enumerated integer value.
Default mutability trait.
Definition: parameter_model.h:84
void set(const basic_type type_, const variable_mode_type variable_mode_)
Set the type and variable mode of the parameter.
void add_variant(const std::string &variant_name_)
Add a variant, given its name.
void set_real_unit_label(const std::string &unit_label_)
Set the unit label.
bool enumerated_real_value_has_group(const double value_) const
Check if an enumerated real value has a group.
static std::string label_from_variable_mode(const variable_mode_type)
Return the label associated to a variable mode.
void build_list_of_enumerated_real_values_in_group(const std::string &group_, std::set< double > &values_) const
Build the list of enumerated real values associated to a given group.
A base class with useful attributes usable in many contexts.
Definition: enriched_base.h:52
real_enum_value_metadata & grab_enumerated_real_value_metadata(const double value_)
Return the metadata associated to an enumerated real value.
void print_rst(std::ostream &out_, const std::string &indent_="", const uint32_t flags_=0) const
Print in RestructuredText format.
void build_list_of_enumerated_integer_values_in_group(const std::string &group_, std::set< int > &values_) const
Build the list of enumerated integer values associated to a given group.
void build_list_of_enumerated_boolean_groups(std::set< std::string > &groups_) const
Build the list of groups associated to enumerated boolean value.
const std::string & get_fixed_string() const
Return the fixed string.
bool is_integer() const
Check integer type.
static const uint32_t bit00
Definition: bit_mask.h:27
bool is_real() const
Check real type.
Default variable mode.
Definition: parameter_model.h:99
void build_list_of_enumerated_boolean_values(std::set< bool > &values_) const
Build the list of enumerated boolean values.
void set_fixed_boolean(const bool value_)
Set fixed boolean value.
void set_enumerated_boolean_value_metadata(const bool value_, const boolean_enum_value_metadata &metadata_)
Set the metadata associated to a boolean value.
bool find_variants_associated_to_string(const std::string &value_, std::set< std::string > &variants_) const
Find the name of the variant associated to a given string value.
bool has_groups() const
Check if groups are defines.
Flag for output file.
Definition: parameter_model.h:115
double get_real_effective_precision() const
Return the real effective precision.
std::map< std::string, std::string > group_dict_type
Dictionary of groups.
Definition: parameter_model.h:77
static mutability_type mutability_from_label(const std::string &)
Return the mutability associated to the mutability label.
void add_enumerated_real_value(const double value_, const real_enum_value_metadata &metadata_, const bool default_=false)
Add an enumerated real value with its metadata.
bool is_interval() const
Check interval mode.
Real enumeration support.
Definition: parameter_model.h:233
const std::string & get_documentation() const
Return the documentation.
bool has_variants() const
Check is some variants are set.
bool has_group_support() const
Check if group support is set.
void initialize(const properties &setup_, model_item_dict_type &items_)
Initialization from properties and a dictionary of configuration items.
const integer_range_enum_dict_type & get_integer_ranges() const
Return the dictionary of integer ranges.
bool find_variants_associated_to_boolean(const bool value_, std::set< std::string > &variants_) const
Find the set of variants associated to a given boolean value.
void add_integer_range(const integer_range &, const integer_range_enum_metadata &)
Add a integer range.
std::map< double, real_enum_value_metadata > real_enum_dict_type
Definition: parameter_model.h:235
void set_type(const basic_type type_)
Set the type of the parameter.
bool has_default_value() const
Check default value.
bool is_fixed() const
Check fixed trait.
bool has_group(const std::string &group_name_) const
Check if a group exists.
void set_fixed_real(const double value_)
Set fixed real value.
bool is_boolean() const
Check boolean type.
Description/model of a configuration parameter.
Definition: parameter_model.h:60
bool is_path_input() const
Check path input flag.
static std::string label_from_path_io(const path_io_type)
Return the label associated to a path I/O mode.
void set_fixed_string(const std::string &value_)
Set fixed string value.
void fetch_real_enumeration(std::vector< double > &values_) const
Fetch the list of enumerated real values.
const std::string & get_default_string() const
Return the default string.
void build_list_of_enumerated_string_groups(std::set< std::string > &groups_) const
Build the list of groups associated to enumerated strings.
A dictionary of arbitrary properties.
Definition: properties.h:125
void build_list_of_enumerated_string_values(std::set< std::string > &values_) const
Build the list of enumerated string values.