Flow123d  last_with_con_2.0.0-4-g42e6930
type_base.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file type_base.hh
15  * @brief
16  */
17 
18 #ifndef TYPE_BASE_HH_
19 #define TYPE_BASE_HH_
20 
21 #include <limits>
22 #include <ios>
23 #include <set>
24 #include <map>
25 #include <vector>
26 #include <string>
27 #include <iomanip>
28 
29 #include <boost/type_traits.hpp>
30 #include <boost/tokenizer.hpp>
31 #include <boost/shared_ptr.hpp>
32 #include <boost/make_shared.hpp>
33 #include <boost/algorithm/string.hpp>
34 
35 #include "system/global_defs.h"
36 #include "system/system.hh"
37 #include "system/exceptions.hh"
38 #include "system/file_path.hh"
39 
40 
41 
42 
43 namespace Input {
44 
45 namespace Type {
46 
47 
48 
49 using namespace std;
50 
51 /**
52  * Declaration of common exceptions and error info types.
53  */
54 TYPEDEF_ERR_INFO( EI_KeyName, const string );
55 
56 TYPEDEF_ERR_INFO( EI_DefaultStr, const string);
57 TYPEDEF_ERR_INFO( EI_TypeName, const string);
58 TYPEDEF_ERR_INFO( EI_Desc, const string);
59 DECLARE_EXCEPTION( ExcWrongDefaultJSON, << "Consistency Error: Not valid JSON of Default value "
60  << EI_DefaultStr::qval << " of type " << EI_TypeName::qval << ";\n"
61  << "During declaration of the key: " << EI_KeyName::qval );
62 DECLARE_EXCEPTION( ExcWrongDefault, << "Consistency Error: " << EI_Desc::val << "Default value "
63  << EI_DefaultStr::qval << " do not match type: " << EI_TypeName::qval << ";\n"
64  << "During declaration of the key: " << EI_KeyName::qval );
65 DECLARE_EXCEPTION( ExcUnknownDescendant, << "Unknown descendant of TypeBase class, name: " << EI_TypeName::qval );
66 
67 
68 
69 
70 /**
71  * @brief Base of classes for declaring structure of the input data.
72  *
73  * Provides methods and class members common to all types. Namely, the type name, finished status (nontrivial only
74  * for types with complex initialization - Record, AbstractRecosd, Selection), attributes, data of generic types
75  * and output of the documentation.
76  *
77  * @ingroup input_types
78  */
79 class TypeBase {
80 public:
81  /// Type returned by content_hash methods.
82  typedef std::size_t TypeHash;
83 
84  /// String stored in JSON format.
85  typedef std::string json_string;
86  /// Defines map of Input::Type attributes.
88 
89  /// Defines pairs of (name, Input::Type), that are used for replace of parameters in generic types.
90  typedef std::pair< std::string, std::shared_ptr<TypeBase> > ParameterPair;
91  /// Define vector of parameters passed to the overloaded make_instance method.
93 
94  /// Defines map of used parameters
96  /// Return type of make_instance methods, contains instance of generic type and map of used parameters
97  typedef std::pair< std::shared_ptr<TypeBase>, ParameterMap > MakeInstanceReturnType;
98 
99 
100  /**
101  * @brief Returns true if the type is fully specified and ready for read access.
102  *
103  * For Record and Array types this say nothing about child types referenced in particular type object.
104  * In particular for Record and Selection, it returns true after @p finish() method is called.
105  */
106  virtual bool is_finished() const
107  {return true;}
108 
109  /**
110  * @brief Returns true if the type is closed.
111  */
112  virtual bool is_closed() const
113  {return true;}
114 
115  /// Returns an identification of the type. Useful for error messages.
116  virtual string type_name() const { return "TypeBase"; }
117  /// Returns an identification of the class. Useful for output of the documentation.
118  virtual string class_name() const { return "TypeBase"; }
119 
120  /**
121  * @brief Returns string with Type extensive documentation.
122  *
123  * We need this to pass Type description at throw points since the Type object can be deallocated during stack
124  * unrolling so it is not good idea to pass pointer. Maybe we can pass smart pointers. Actually this method is
125  * used in various exceptions in json_to_storage.
126  *
127  * TODO: Some old note on this topic:
128  * !!! how to pass instance of descendant of TypeBase through EI -
129  * - can not pass it directly since TypeBase is not copyconstructable
130  * - can not use shared_ptr for same reason
131  * - can not use C pointers since the referred object can be temporary
132  * solutions:
133  * - consistently move TypeBase to Pimpl design
134  * - provide virtual function make_copy, that returns valid shared_ptr
135  *
136  */
137  string desc() const;
138 
139 
140 
141  /**
142  * @brief Comparison of types.
143  *
144  * It compares kind of type (Integer, Double, String, Record, ..), for complex types it also compares names.
145  * For arrays compare subtypes.
146  */
147  virtual bool operator==(const TypeBase &other) const
148  { return typeid(*this) == typeid(other); }
149 
150  /// Comparison of types.
151  bool operator!=(const TypeBase & other) const
152  { return ! (*this == other); }
153 
154  /// Destructor
155  virtual ~TypeBase();
156 
157 
158 
159  /**
160  * @brief Finishes all types registered in type repositories.
161  *
162  * Finish must be executed in suitable order
163  * 1) finish of Instance types, generic Abstract and generic Record types
164  * 2) finish of non-generic Abstract and non-generic Record types
165  * 3) finish of the other types
166  */
167  static void lazy_finish();
168 
169 
170  /**
171  * @brief Finish method. Finalize construction of "Lazy types": Record, Selection, Abstract and generic type.
172  *
173  * These input types are typically defined by means of static generating methods, whose allows initialization
174  * any of other input types. Since e.g. a Record can link to other input types through its keys at the
175  * initialization phase. But some setting (e.g. add descendants to Abstract) can't be done in initialization
176  * phase. Therefore, the remaining part of initialization can be done later, in finalization phase, typically
177  * from main(), by calling the method finish().
178  *
179  * Finish of generic types can be different of other Input::Types (e. g. for Record) and needs set @p is_generic
180  * to true.
181  */
182  virtual bool finish(bool is_generic = false)
183  { return true; };
184 
185  /**
186  * @brief Hash of the type specification.
187  *
188  * Provides unique id computed from its content (definition) so that same types have same hash.
189  *
190  * Hash is counted using type, name and other class members specific for descendants.
191  */
192  virtual TypeHash content_hash() const =0;
193 
194  /**
195  * @brief Format given hash for output.
196  *
197  * Use hex format and double quotas.
198  */
199  static std::string hash_str(TypeHash hash);
200 
201  /// Format the hash of this type.
202  inline std::string hash_str() const {
203  return hash_str(content_hash());
204  }
205 
206  /**
207  * Create instance of generic type.
208  *
209  * Replace parameters in input tree by type stored in @p vec.
210  */
211  virtual MakeInstanceReturnType make_instance(ParameterVector vec = ParameterVector()) =0;
212 
213  /// Indicates if type is marked with flag @p root_of_generic_subtree_
215  return root_of_generic_subtree_;
216  }
217 
218 protected:
219 
220  /// The default constructor.
221  TypeBase();
222 
223  /// Copy constructor.
224  TypeBase(const TypeBase& other);
225 
226  /**
227  * @brief Add attribute of given @p name to attribute map.
228  *
229  * Parameter @p val must contain valid JSON string.
230  */
231  void add_attribute_(std::string name, json_string val);
232 
233 
234 
235  /**
236  * @brief The type of hash values used in associative array that translates key names to indices in Record and Selection.
237  *
238  * For simplicity, we currently use whole strings as "hash".
239  */
240  typedef string KeyHash;
241 
242  /// Hash function.
243  inline static KeyHash key_hash(const string &str) {
244  return (str);
245  }
246 
247  /**
248  * @brief Check that a @p key is valid identifier.
249  *
250  * I.e. consists only of valid characters, that are lower-case letters, digits and underscore,
251  * we allow identifiers starting with a digit, but it is discouraged since it slows down parsing of the input file.
252  */
253  static bool is_valid_identifier(const string& key);
254 
255  /// Check if @p str is valid JSON string
256  bool validate_json(json_string str) const;
257 
258  /// Create JSON output from @p parameter_map formatted as value of attribute.
259  json_string print_parameter_map_to_json(ParameterMap parameter_map) const;
260 
261  /**
262  * JSON format of the vector of parameter names. Used for generic composed types.
263  * TODO: use ParameterVector instead of ParameterMap and merge this method with the previous one.
264  */
265  json_string print_parameter_map_keys_to_json(ParameterMap param_map) const;
266 
267  /**
268  * Extract and set attributes from the ParameterMap containing parameters of the subtree.
269  * Used in implementations of the make_instance method.
270  */
271  void set_generic_attributes(ParameterMap param_map);
272 
273  /**
274  * Copy attributes to the instance of the generic type. Remove all internal attributes starting with '_'.
275  */
276  void copy_attributes(attribute_map other_attributes);
277 
278 
279  /// map of type attributes (e. g. input_type, name etc.)
280  std::shared_ptr<attribute_map> attributes_;
281 
282  /// flag is true if type should be root of generic subtree
284 
285  /// hash string of generic type if type is derived, or empty string
287 
288  /// map of parameters if type is part of generic subtree
289  ParameterMap parameter_map_;
290 
291  friend class Array;
292  friend class Record;
293  friend class OutputBase;
294 };
295 
296 /**
297  * @brief For convenience we provide also redirection operator for output documentation of Input:Type classes.
298  */
299 std::ostream& operator<<(std::ostream& stream, const TypeBase& type);
300 
301 
302 class Record;
303 class Selection;
304 
305 
306 /**
307  * @brief Class for declaration of inputs sequences.
308  *
309  * The type is fully specified after its constructor is called. All elements of the Array has same type, however you
310  * can use elements of Abstract.
311  *
312  * If you not disallow Array size 1, the input reader will try to convert any other type
313  * on input into array with one element, e.g.
314  @code
315  int_array=1 # is equivalent to
316  int_array=[ 1 ]
317  @endcode
318  *
319  * @ingroup input_types
320  */
321 class Array : public TypeBase {
322  friend class OutputBase;
323 
324 protected:
325 
326  /**
327  * @brief Actual data of the Array.
328  */
329  class ArrayData {
330  public:
331 
332  /// Constructor
333  ArrayData(unsigned int min_size, unsigned int max_size)
334  : lower_bound_(min_size), upper_bound_(max_size), finished(false)
335  {}
336  /// Finishes initialization of the ArrayData.
337  bool finish(bool is_generic = false);
338  /// Type of Array
339  std::shared_ptr<TypeBase> type_of_values_;
340  /// Minimal size of Array
341  unsigned int lower_bound_;
342  /// Maximal size of Array
343  unsigned int upper_bound_;
344  /// Flag specified if Array is finished
345  bool finished;
346 
347  };
348 
349 public:
350  /**
351  * @brief Constructor with a @p type of array items given as pure reference.
352  *
353  * In this case \p type has to by descendant of \p TypeBase different from 'complex' types
354  * @p Record and @p Selection. You can also specify minimum and maximum size of the array.
355  */
356  template <class ValueType>
357  Array(const ValueType &type, unsigned int min_size=0, unsigned int max_size=std::numeric_limits<unsigned int>::max() );
358 
359  /**
360  * @brief Constructor with a shared pointer @p type of array.
361  */
362  Array(std::shared_ptr<TypeBase> type, unsigned int min_size=0, unsigned int max_size=std::numeric_limits<unsigned int>::max() );
363 
364  /**
365  * @brief Implements @p TypeBase::content_hash.
366  *
367  * Hash is calculated by type name, bounds, hash of stored type and hash of attributes.
368  */
369  TypeHash content_hash() const override;
370 
371  /// Finishes initialization of the Array type because of lazy evaluation of type_of_values.
372  bool finish(bool is_generic = false) override;
373 
374  /// Override @p Type::TypeBase::is_finished.
375  bool is_finished() const override {
376  return data_->finished; }
377 
378  /// Getter for the type of array items.
379  inline const TypeBase &get_sub_type() const {
380  return *data_->type_of_values_; }
381 
382  /// Checks size of particular array.
383  inline bool match_size(unsigned int size) const {
384  return size >=data_->lower_bound_ && size<=data_->upper_bound_; }
385 
386  /**
387  * @brief Implements @p Type::TypeBase::type_name.
388  *
389  * Name has form \p array_of_'subtype_name'.
390  */
391  string type_name() const override;
392  /// Override @p Type::TypeBase::class_name.
393  string class_name() const override { return "Array"; }
394 
395  /// @brief Implements @p Type::TypeBase::operator== Compares also subtypes.
396  bool operator==(const TypeBase &other) const override;
397 
398  /// Implements @p TypeBase::make_instance.
400 
401  /**
402  * @brief Create deep copy of Array.
403  *
404  * Copy all data stored in shared pointers etc.
405  */
406  Array deep_copy() const;
407 
408 protected:
409 
410  /// Handle to the actual array data.
411  std::shared_ptr<ArrayData> data_;
412 private:
413  /// Forbids default constructor in order to prevent empty data_.
414  Array();
415 };
416 
417 
418 
419 /**
420  * @brief Base of all scalar types.
421  *
422  * @ingroup input_types
423  */
424 class Scalar : public TypeBase {};
425 
426 
427 /**
428  * @brief Class for declaration of the input of type Bool.
429  *
430  * String names of boolean values are \p 'true' and \p 'false'.
431  *
432  * @ingroup input_types
433  */
434 class Bool : public Scalar {
435 public:
436  /// Constructor.
438  {}
439 
440  /// Implements @p TypeBase::content_hash.
441  TypeHash content_hash() const override;
442 
443 
444  /**
445  * @brief Implements @p Type::TypeBase::type_name.
446  *
447  * Name has form \p Bool.
448  */
449  string type_name() const override;
450  /// Override @p Type::TypeBase::class_name.
451  string class_name() const override { return "Bool"; }
452 
453  /// Implements @p TypeBase::make_instance.
455 };
456 
457 
458 /**
459  * @brief Class for declaration of the integral input data.
460  *
461  * The data are stored in an \p signed \p int variable. You can specify bounds for the valid input data.
462  *
463  * @ingroup input_types
464  */
465 class Integer : public Scalar {
466  friend class OutputBase;
467 
468 public:
469  /**
470  * @brief Constructor.
471  *
472  * You can also specify minimum and maximum value.
473  */
474  Integer(int lower_bound=std::numeric_limits<int>::min(), int upper_bound=std::numeric_limits<int>::max())
475  : lower_bound_(lower_bound), upper_bound_(upper_bound)
476  {}
477 
478  /**
479  * @brief Implements @p TypeBase::content_hash.
480  *
481  * Hash is calculated by type name and bounds.
482  */
483  TypeHash content_hash() const override;
484 
485  /**
486  * @brief Check valid value of Integer.
487  *
488  * Returns true if the given integer value conforms to the Type::Integer bounds.
489  */
490  bool match(std::int64_t value) const;
491 
492  /**
493  * @brief Implements @p Type::TypeBase::type_name.
494  *
495  * Name has form \p Integer.
496  */
497  string type_name() const override;
498  /// Override @p Type::TypeBase::class_name.
499  string class_name() const override { return "Integer"; }
500 
501  /// Implements @p TypeBase::make_instance.
503 private:
504 
505  std::int64_t lower_bound_; ///< Minimal value of Integer.
506  std::int64_t upper_bound_; ///< Maximal value of Integer.
507 
508 };
509 
510 
511 /**
512  * @brief Class for declaration of the input data that are floating point numbers.
513  *
514  * The data are stored in an \p double variable. You can specify bounds for the valid input data.
515  *
516  * @ingroup input_types
517  */
518 class Double : public Scalar {
519  friend class OutputBase;
520 
521 public:
522  /**
523  * @brief Constructor.
524  *
525  * You can also specify minimum and maximum value.
526  */
527  Double(double lower_bound= -std::numeric_limits<double>::max(), double upper_bound=std::numeric_limits<double>::max())
528  : lower_bound_(lower_bound), upper_bound_(upper_bound)
529  {}
530 
531  /**
532  * @brief Implements @p TypeBase::content_hash.
533  *
534  * Hash is calculated by type name and bounds.
535  */
536  TypeHash content_hash() const override;
537 
538  /// Returns true if the given integer value conforms to the Type::Double bounds.
539  bool match(double value) const;
540 
541  /**
542  * @brief Implements @p Type::TypeBase::type_name.
543  *
544  * Name has form \p Double.
545  */
546  string type_name() const override;
547  /// Override @p Type::TypeBase::class_name.
548  string class_name() const override { return "Double"; }
549 
550  /// Implements @p TypeBase::make_instance.
552 private:
553 
554  double lower_bound_; ///< Minimal value of Integer.
555  double upper_bound_; ///< Maximal value of Integer.
556 
557 };
558 
559 
560 
561 /**
562  * @brief Class for declaration of the input data that are in string format.
563  *
564  * Just for consistency, but is essentially same as Scalar.
565  *
566  * @ingroup input_types
567  */
568 class String : public Scalar {
569 public:
570  /**
571  * @brief Implements @p Type::TypeBase::type_name.
572  *
573  * Name has form \p String.
574  */
575  virtual string type_name() const override;
576  /// Override @p Type::TypeBase::class_name.
577  string class_name() const override { return "String"; }
578 
579  /// Implements @p TypeBase::content_hash.
580  TypeHash content_hash() const override;
581 
582  /// Particular descendants can check validity of the string.
583  virtual bool match(const string &value) const;
584 
585  /// Implements @p TypeBase::make_instance.
586  virtual MakeInstanceReturnType make_instance(std::vector<ParameterPair> vec = std::vector<ParameterPair>()) override;
587 };
588 
589 
590 /**
591  * @brief Class for declaration of the input data that are file names.
592  *
593  * We strictly distinguish filenames for input and output files.
594  *
595  * @ingroup input_types
596  */
597 class FileName : public String {
598 public:
599 
600  /// Implements @p TypeBase::content_hash.
601  TypeHash content_hash() const override;
602 
603  /**
604  * @brief The factory function for declaring type FileName for input files.
605  */
606  static FileName input()
607  { return FileName(::FilePath::input_file); }
608 
609  /**
610  * @brief The factory function for declaring type FileName for input files.
611  */
612  static FileName output()
613  { return FileName(::FilePath::output_file); }
614 
615  /**
616  * @brief Implements @p Type::TypeBase::type_name.
617  *
618  * Name has form \p FileName_input or \p FileName_output
619  */
620  string type_name() const override;
621  /// Override @p Type::TypeBase::class_name.
622  string class_name() const override { return "FileName"; }
623 
624  /// Comparison of types.
625  bool operator==(const TypeBase &other) const
626  { return typeid(*this) == typeid(other) &&
627  (type_== static_cast<const FileName *>(&other)->get_file_type() );
628  }
629 
630  /// Checks relative output paths.
631  bool match(const string &str) const;
632 
633 
634  /**
635  * @brief Returns type of the file input/output.
636  */
638  return type_;
639  }
640 
641  /// Implements @p TypeBase::make_instance.
643 
644 
645 
646 private:
647  /// The type of file (input or output).
649 
650  /// Forbids default constructor.
651  FileName() {}
652 
653  /// Forbids direct construction.
654  FileName(enum ::FilePath::FileType type)
655  : type_(type)
656  {}
657 
658 };
659 
660 } // closing namespace Type
661 } // closing namespace Input
662 
663 
664 
665 
666 
667 #endif /* TYPE_BASE_HH_ */
Bool()
Constructor.
Definition: type_base.hh:437
string class_name() const override
Override Type::TypeBase::class_name.
Definition: type_base.hh:622
string class_name() const override
Override Type::TypeBase::class_name.
Definition: type_base.hh:577
std::int64_t lower_bound_
Minimal value of Integer.
Definition: type_base.hh:505
Base of classes for declaring structure of the input data.
Definition: type_base.hh:79
string class_name() const override
Override Type::TypeBase::class_name.
Definition: type_base.hh:499
virtual bool finish(bool is_generic=false)
Finish method. Finalize construction of "Lazy types": Record, Selection, Abstract and generic type...
Definition: type_base.hh:182
bool is_root_of_generic_subtree()
Indicates if type is marked with flag root_of_generic_subtree_.
Definition: type_base.hh:214
virtual bool is_closed() const
Returns true if the type is closed.
Definition: type_base.hh:112
virtual bool operator==(const TypeBase &other) const
Comparison of types.
Definition: type_base.hh:147
bool operator==(const TypeBase &other) const
Comparison of types.
Definition: type_base.hh:625
std::string hash_str() const
Format the hash of this type.
Definition: type_base.hh:202
bool root_of_generic_subtree_
flag is true if type should be root of generic subtree
Definition: type_base.hh:283
virtual string class_name() const
Returns an identification of the class. Useful for output of the documentation.
Definition: type_base.hh:118
TYPEDEF_ERR_INFO(EI_KeyName, const string)
Class for declaration of the input of type Bool.
Definition: type_base.hh:434
FileType
Possible types of file.
Definition: file_path.hh:60
std::pair< std::shared_ptr< TypeBase >, ParameterMap > MakeInstanceReturnType
Return type of make_instance methods, contains instance of generic type and map of used parameters...
Definition: type_base.hh:97
string class_name() const override
Override Type::TypeBase::class_name.
Definition: type_base.hh:451
virtual bool is_finished() const
Returns true if the type is fully specified and ready for read access.
Definition: type_base.hh:106
unsigned int upper_bound_
Maximal size of Array.
Definition: type_base.hh:343
::FilePath::FileType type_
The type of file (input or output).
Definition: type_base.hh:648
Base abstract class for output description of the Input::Type tree.
Definition: type_output.hh:58
Double(double lower_bound=-std::numeric_limits< double >::max(), double upper_bound=std::numeric_limits< double >::max())
Constructor.
Definition: type_base.hh:527
Base of all scalar types.
Definition: type_base.hh:424
static KeyHash key_hash(const string &str)
Hash function.
Definition: type_base.hh:243
virtual string type_name() const
Returns an identification of the type. Useful for error messages.
Definition: type_base.hh:116
Class for declaration of the input data that are file names.
Definition: type_base.hh:597
std::shared_ptr< attribute_map > attributes_
map of type attributes (e. g. input_type, name etc.)
Definition: type_base.hh:280
Class for declaration of the integral input data.
Definition: type_base.hh:465
ArrayData(unsigned int min_size, unsigned int max_size)
Constructor.
Definition: type_base.hh:333
Class for declaration of inputs sequences.
Definition: type_base.hh:321
double upper_bound_
Maximal value of Integer.
Definition: type_base.hh:555
ParameterMap parameter_map_
map of parameters if type is part of generic subtree
Definition: type_base.hh:289
string KeyHash
The type of hash values used in associative array that translates key names to indices in Record and ...
Definition: type_base.hh:240
std::shared_ptr< ArrayData > data_
Handle to the actual array data.
Definition: type_base.hh:411
bool operator==(const Null &, const Null &)
Global macros to enhance readability and debugging, general constants.
Class for declaration of the input data that are floating point numbers.
Definition: type_base.hh:518
static FileName input()
The factory function for declaring type FileName for input files.
Definition: type_base.hh:606
std::map< std::string, TypeHash > ParameterMap
Defines map of used parameters.
Definition: type_base.hh:95
std::int64_t upper_bound_
Maximal value of Integer.
Definition: type_base.hh:506
std::map< std::string, json_string > attribute_map
Defines map of Input::Type attributes.
Definition: type_base.hh:87
bool match_size(unsigned int size) const
Checks size of particular array.
Definition: type_base.hh:383
std::pair< std::string, std::shared_ptr< TypeBase > > ParameterPair
Defines pairs of (name, Input::Type), that are used for replace of parameters in generic types...
Definition: type_base.hh:90
bool is_finished() const override
Override Type::TypeBase::is_finished.
Definition: type_base.hh:375
bool operator!=(const TypeBase &other) const
Comparison of types.
Definition: type_base.hh:151
FileName()
Forbids default constructor.
Definition: type_base.hh:651
TypeHash generic_type_hash_
hash string of generic type if type is derived, or empty string
Definition: type_base.hh:286
::FilePath::FileType get_file_type() const
Returns type of the file input/output.
Definition: type_base.hh:637
static FileName output()
The factory function for declaring type FileName for input files.
Definition: type_base.hh:612
std::shared_ptr< TypeBase > type_of_values_
Type of Array.
Definition: type_base.hh:339
Actual data of the Array.
Definition: type_base.hh:329
const TypeBase & get_sub_type() const
Getter for the type of array items.
Definition: type_base.hh:379
DECLARE_EXCEPTION(ExcWrongDefaultJSON,<< "Consistency Error: Not valid JSON of Default value "<< EI_DefaultStr::qval<< " of type "<< EI_TypeName::qval<< ";\n"<< "During declaration of the key: "<< EI_KeyName::qval)
double lower_bound_
Minimal value of Integer.
Definition: type_base.hh:554
std::string json_string
String stored in JSON format.
Definition: type_base.hh:85
std::ostream & operator<<(std::ostream &stream, const TypeBase &type)
For convenience we provide also redirection operator for output documentation of Input:Type classes...
Definition: type_base.cc:169
bool finished
Flag specified if Array is finished.
Definition: type_base.hh:345
Record type proxy class.
Definition: type_record.hh:171
string class_name() const override
Override Type::TypeBase::class_name.
Definition: type_base.hh:548
string class_name() const override
Override Type::TypeBase::class_name.
Definition: type_base.hh:393
Integer(int lower_bound=std::numeric_limits< int >::min(), int upper_bound=std::numeric_limits< int >::max())
Constructor.
Definition: type_base.hh:474
unsigned int lower_bound_
Minimal size of Array.
Definition: type_base.hh:341
Class for declaration of the input data that are in string format.
Definition: type_base.hh:568
std::size_t TypeHash
Type returned by content_hash methods.
Definition: type_base.hh:82
std::vector< ParameterPair > ParameterVector
Define vector of parameters passed to the overloaded make_instance method.
Definition: type_base.hh:92
Template for classes storing finite set of named values.
FileName(enum::FilePath::FileType type)
Forbids direct construction.
Definition: type_base.hh:654