Flow123d  release_2.2.0-20-gb8056ca
type_base.cc
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.cc
15  * @brief
16  */
17 
18 #include <limits>
19 #include <ios>
20 #include <map>
21 #include <vector>
22 #include <string>
23 #include <iomanip>
24 
25 #include "system/system.hh"
26 
27 #include <boost/type_traits.hpp>
28 #include <boost/tokenizer.hpp>
29 #include <boost/algorithm/string.hpp>
30 #include <boost/functional/hash.hpp>
31 #include <boost/pointer_cast.hpp>
32 
33 
34 #include "input_type.hh"
35 #include "type_output.hh"
36 #include "type_repository.hh"
37 #include "attribute_lib.hh"
39 
40 #include <stdint.h> // for int64_t
41 #include <boost/algorithm/string.hpp>
42 #include <boost/exception/detail/error_info_impl.hpp> // for error_info
43 #include <boost/exception/info.hpp> // for operator<<
44 #include <boost/functional/hash/hash.hpp> // for hash_com...
45 #include <boost/static_assert.hpp> // for BOOST_ST...
46 #include <boost/type_traits/is_base_of.hpp> // for is_base_of
47 #include <memory> // for shared_ptr
48 #include <ostream> // for operator<<
49 #include <typeinfo> // for type_info
50 #include <utility> // for make_pair
51 #include "input/json_spirit/json_spirit_error_position.h" // for Error_po...
52 #include "input/json_spirit/json_spirit_reader.h" // for read_or_...
53 #include "input/json_spirit/json_spirit_value.h" // for mValue
54 #include "input/type_base.hh" // for TypeBase
55 #include "input/type_generic.hh" // for ExcGener...
56 #include "system/asserts.hh" // for Assert
57 #include "system/exceptions.hh" // for ExcGener...
58 #include "system/file_path.hh" // for FilePath
59 namespace Input { namespace Type { class Abstract; } }
60 namespace Input { namespace Type { class Record; } }
61 namespace Input { namespace Type { class Selection; } }
62 namespace Input { namespace Type { class Tuple; } }
63 
64 
65 
66 namespace Input {
67 namespace Type {
68 
69 using namespace std;
70 
71 
72 
73 /*******************************************************************
74  * implementation of TypeBase
75  */
76 
77 
78 
80 : attributes_( std::make_shared<attribute_map>() ), root_of_generic_subtree_(false),
81  generic_type_hash_(0) {}
82 
83 
84 
88 
89 
90 
92 
93 
94 bool TypeBase::is_valid_identifier(const string& key) {
95  namespace ba = boost::algorithm;
96  return ba::all( key, ba::is_lower() || ba::is_digit() || ba::is_any_of("_") );
97 }
98 
99 
100 string TypeBase::desc() const {
101  stringstream ss;
102  ss << OutputText(this);
103  return ss.str();
104 }
105 
106 
107 
109  // mark unfinished types as deleted
115 
116  // check and remove deleted types
122 }
123 
124 
125 
126  std::string TypeBase::hash_str(TypeHash hash) {
127  stringstream ss;
128  ss << "\"" << std::hex << hash << "\"";
129  return ss.str();
130 }
131 
132 
133 
134 
135 void TypeBase::add_attribute_(std::string name, json_string val) {
136  ASSERT(validate_json(val))(name)(val).error("Invalid JSON format of attribute");
137  (*attributes_)[name] = val;
138 }
139 
140 
142  try {
143  json_spirit::mValue node;
144  json_spirit::read_or_throw( str, node);
145  return true;
146  } catch (json_spirit::Error_position &e ) {
147  return false;
148  }
149 }
150 
151 
153  std::stringstream ss;
154  ss << "{";
155  for (ParameterMap::iterator it=parameter_map.begin(); it!=parameter_map.end(); it++) {
156  if (it != parameter_map.begin()) ss << "," << endl;
157  ss << "\"" << (*it).first << "\" : " << TypeBase::hash_str( (*it).second );
158  }
159  ss << "}";
160  return ss.str();
161 }
162 
164  stringstream ss;
165  ss << "[ ";
166  for (ParameterMap::iterator it=parameter_map.begin(); it!=parameter_map.end(); it++) {
167  if (it != parameter_map.begin()) ss << ", ";
168  ss << "\"" << it->first << "\"";
169  }
170  ss << " ]";
171  return ss.str();
172 }
173 
175  // check if the type is really generic (it may be non-generic even if part of a generic subtree)
176  if (parameter_map.size() > 0)
180 }
181 
182 
183 void TypeBase::copy_attributes(attribute_map other_attributes) {
184  attributes_->clear();
185  for(auto &item : other_attributes) {
186  if (item.first[0] != '_') // not internal attribute
187  attributes_->insert(item);
188  }
189 }
190 
191 
193  return FinishStatus::regular_;
194 }
195 
196 
197 bool TypeBase::is_finished() const {
198  return true;
199 }
200 
201 
202 bool TypeBase::is_closed() const {
203  return true;
204 }
205 
206 
207 string TypeBase::type_name() const {
208  return "TypeBase";
209 }
210 
211 
212 string TypeBase::class_name() const {
213  return "TypeBase";
214 }
215 
216 
218  ASSERT((finish_type != FinishStatus::none_) && (finish_type != FinishStatus::in_perform_)).error();
219  return finish_type;
220 }
221 
222 
223 bool TypeBase::operator==(const TypeBase &other) const {
224  return typeid(*this) == typeid(other);
225 }
226 
227 bool TypeBase::operator!=(const TypeBase & other) const {
228  return ! (*this == other);
229 }
230 
231 
232 
233 
234 
235 
236 
237 
238 
239 
240 std::ostream& operator<<(std::ostream& stream, const TypeBase& type) {
241  return ( stream << OutputText(&type) );
242 }
243 
244 
245 
246 /**********************************************************************************
247  * implementation of Type::Array
248  */
249 
251 {
252  TypeHash seed=0;
253  boost::hash_combine(seed, type_name());
254  boost::hash_combine(seed, data_->lower_bound_);
255  boost::hash_combine(seed, data_->upper_bound_);
256  boost::hash_combine(seed, data_->type_of_values_->content_hash() );
257  return seed;
258 }
259 
260 
262  return data_->finish(finish_type);
263 }
264 
265 
266 
267 Array::ArrayData::ArrayData(unsigned int min_size, unsigned int max_size)
268 : lower_bound_(min_size), upper_bound_(max_size), finish_status(FinishStatus::none_)
269 {}
270 
271 
273 {
274  ASSERT(finish_type != FinishStatus::none_).error();
275  ASSERT(finish_type != FinishStatus::in_perform_).error();
276  ASSERT(finish_status != FinishStatus::in_perform_).error("Recursion in the IST element: array_of_" + type_of_values_->type_name());
277 
279 
280 
282 
283  if (typeid( *(type_of_values_.get()) ) == typeid(Instance)) {
284  type_of_values_->finish(FinishStatus::generic_); // finish Instance object
285  type_of_values_ = type_of_values_->make_instance().first;
286  }
287  if ((finish_type != FinishStatus::generic_) && type_of_values_->is_root_of_generic_subtree())
288  THROW( ExcGenericWithoutInstance() << EI_Object(type_of_values_->type_name()) );
289 
290  type_of_values_->finish(finish_type);
291  ASSERT(type_of_values_->is_finished()).error();
292  if (finish_type == FinishStatus::delete_) type_of_values_.reset();
293  finish_status = finish_type;
294  return (finish_status);
295 }
296 
297 
298 
299 string Array::type_name() const {
300  return "array_of_" + data_->type_of_values_->type_name();
301 }
302 
303 
304 
305 string Array::class_name() const {
306  return "Array";
307 }
308 
309 
310 
311 bool Array::operator==(const TypeBase &other) const {
312  return typeid(*this) == typeid(other) &&
313  (*data_->type_of_values_ == static_cast<const Array *>(&other)->get_sub_type() );
314 }
315 
316 
317 
319  // Create copy of array, we can't set type from parameter vector directly (it's TypeBase that is not allowed)
320  Array arr = this->deep_copy();
321  // Replace parameter stored in type_of_values_
322  MakeInstanceReturnType inst = arr.data_->type_of_values_->make_instance(vec);
323  arr.data_->type_of_values_ = inst.first;
324  ParameterMap parameter_map = inst.second;
325  // Copy attributes
327 
328  // Set parameters as attribute
329  json_string val = this->print_parameter_map_to_json(parameter_map);
330  ASSERT(this->validate_json(val))(val).error("Invalid JSON format of attribute 'parameters'.");
331  arr.parameter_map_ = parameter_map;
332  arr.generic_type_hash_ = this->content_hash();
333 
334  return std::make_pair( std::make_shared<Array>(arr), parameter_map );
335 }
336 
337 
339  Array arr = Array(Integer()); // Type integer will be overwritten
340  arr.data_ = std::make_shared<Array::ArrayData>(*this->data_);
341  arr.data_->finish_status = FinishStatus::none_;
342  return arr;
343 }
344 
345 
346 Array::Array(std::shared_ptr<TypeBase> type, unsigned int min_size, unsigned int max_size)
347 : data_(std::make_shared<ArrayData>(min_size, max_size))
348 {
349  ASSERT_LE(min_size, max_size).error("Wrong limits for size of Input::Type::Array");
350  ASSERT(type->is_closed()).error();
351 
352  data_->type_of_values_ = type;
353 }
354 
355 
356 /// Override @p Type::TypeBase::finish_status.
358  return data_->finish_status; }
359 
360 
361 bool Array::is_finished() const {
362  return (data_->finish_status != FinishStatus::none_) && (data_->finish_status != FinishStatus::in_perform_);
363 }
364 
365 
366 /**********************************************************************************
367  * implementation and explicit instantiation of Array constructor template
368  */
369 
370 template <class ValueType>
371 Array::Array(const ValueType &type, unsigned int min_size, unsigned int max_size)
372 : Array(std::static_pointer_cast<TypeBase>( std::make_shared<ValueType>(type) ), min_size, max_size)
373 {
374  // ASSERT MESSAGE: The type of declared keys has to be a class derived from TypeBase.
375  BOOST_STATIC_ASSERT( (boost::is_base_of<TypeBase, ValueType >::value) );
376 }
377 
378 // explicit instantiation
379 
380 #define ARRAY_CONSTRUCT(TYPE) \
381 template Array::Array(const TYPE &type, unsigned int min_size, unsigned int max_size)
382 
383 ARRAY_CONSTRUCT(String);
384 ARRAY_CONSTRUCT(Integer);
385 ARRAY_CONSTRUCT(Double);
386 ARRAY_CONSTRUCT(Bool);
387 ARRAY_CONSTRUCT(FileName);
388 ARRAY_CONSTRUCT(Selection);
391 ARRAY_CONSTRUCT(Tuple);
392 ARRAY_CONSTRUCT(Abstract);
393 ARRAY_CONSTRUCT(Parameter);
394 ARRAY_CONSTRUCT(Instance);
395 
396 
397 /**********************************************************************************
398  * implementation of Type::Scalar ... and descendants.
399  */
400 
401 /**********************************************************************************
402  * implementation of Type::Bool
403  */
404 
405 
407 {
408  TypeHash seed=0;
409  boost::hash_combine(seed, type_name());
410  return seed;
411 }
412 
413 
414 string Bool::type_name() const {
415  return "Bool";
416 }
417 
418 
419 string Bool::class_name() const {
420  return "Bool";
421 }
422 
423 
425  return std::make_pair( std::make_shared<Bool>(*this), ParameterMap() );
426 }
427 
428 /**********************************************************************************
429  * implementation of Type::Integer
430  */
431 
432 Integer::Integer(int lower_bound, int upper_bound)
433 : lower_bound_(lower_bound), upper_bound_(upper_bound)
434 {}
435 
436 
437 
439 {
440  TypeHash seed=0;
441  boost::hash_combine(seed, type_name());
442  boost::hash_combine(seed, lower_bound_);
443  boost::hash_combine(seed, upper_bound_);
444  return seed;
445 }
446 
447 
448 
449 bool Integer::match(std::int64_t value) const {
450  return ( value >=lower_bound_ && value <= upper_bound_);
451 }
452 
453 
454 
455 string Integer::type_name() const {
456  return "Integer";
457 }
458 
459 
460 string Integer::class_name() const {
461  return "Integer";
462 }
463 
464 
466  return std::make_pair( std::make_shared<Integer>(*this), ParameterMap() );
467 }
468 
469 
470 /**********************************************************************************
471  * implementation of Type::Double
472  */
473 
474 
475 Double::Double(double lower_bound, double upper_bound)
476 : lower_bound_(lower_bound), upper_bound_(upper_bound)
477 {}
478 
479 
481 {
482  TypeHash seed=0;
483  boost::hash_combine(seed, type_name());
484  boost::hash_combine(seed, lower_bound_);
485  boost::hash_combine(seed, upper_bound_);
486  return seed;
487 }
488 
489 
490 
491 bool Double::match(double value) const {
492  return ( value >=lower_bound_ && value <= upper_bound_);
493 }
494 
495 
496 
497 string Double::type_name() const {
498  return "Double";
499 }
500 
501 
502 string Double::class_name() const {
503  return "Double";
504 }
505 
506 
508  return std::make_pair( std::make_shared<Double>(*this), ParameterMap() );
509 }
510 
511 
512 /**********************************************************************************
513  * implementation of Type::FileName
514  */
515 
517 
518 
519 
520 FileName::FileName(enum ::FilePath::FileType type)
521 : type_(type)
522 {}
523 
524 
525 
527 {
528  return FileName(::FilePath::input_file);
529 }
530 
531 
532 
534 {
536 }
537 
538 
539 
541 {
542  TypeHash seed=0;
543  boost::hash_combine(seed, type_name());
544  boost::hash_combine(seed, type_);
545  return seed;
546 }
547 
548 
549 
550 
551 
552 string FileName::type_name() const {
553  switch (type_) {
554  case ::FilePath::input_file:
555  return "FileName_input";
556  case ::FilePath::output_file:
557  return "FileName_output";
558  default:
559  return "FileName";
560  }
561 }
562 
563 
564 string FileName::class_name() const {
565  return "FileName";
566 }
567 
568 
569 
570 bool FileName::match(const string &str) const {
571  return (type_ == ::FilePath::input_file) || (str[0] != DIR_DELIMITER); // output files can not be absolute
572 }
573 
574 
575 
577  return std::make_pair( std::make_shared<FileName>(*this), ParameterMap() );
578 }
579 
580 
581 
583  return type_;
584 }
585 
586 
587 
588 
589 bool FileName::operator==(const TypeBase &other) const
590 {
591  return typeid(*this) == typeid(other) &&
592  (type_== static_cast<const FileName *>(&other)->get_file_type() );
593 }
594 
595 
596 /**********************************************************************************
597  * implementation of Type::String
598  */
599 
600 
602 {
603  TypeHash seed=0;
604  boost::hash_combine(seed, type_name());
605  return seed;
606 }
607 
608 
609 
610 string String::type_name() const {
611  return "String";
612 }
613 
614 
615 
616 string String::class_name() const {
617  return "String";
618 }
619 
620 
621 
622 bool String::match(const string &str) const {
623  return true;
624 }
625 
626 
627 
629  return std::make_pair( std::make_shared<String>(*this), ParameterMap() );
630 }
631 
632 
633 
634 } // closing namespace Type
635 } // closing namespace Input
636 
637 
638 
bool operator==(const TypeBase &other) const override
Implements Type::TypeBase::operator== Compares also subtypes.
Definition: type_base.cc:311
bool validate_json(json_string str) const
Check if str is valid JSON string.
Definition: type_base.cc:141
MakeInstanceReturnType make_instance(std::vector< ParameterPair > vec=std::vector< ParameterPair >()) override
Implements TypeBase::make_instance.
Definition: type_base.cc:576
static bool is_valid_identifier(const string &key)
Check that a key is valid identifier.
Definition: type_base.cc:94
std::int64_t lower_bound_
Minimal value of Integer.
Definition: type_base.hh:527
Base of classes for declaring structure of the input data.
Definition: type_base.hh:99
void set_generic_attributes(ParameterMap param_map)
Definition: type_base.cc:174
MakeInstanceReturnType make_instance(std::vector< ParameterPair > vec=std::vector< ParameterPair >()) override
Implements TypeBase::make_instance.
Definition: type_base.cc:465
bool is_root_of_generic_subtree()
Indicates if type is marked with flag root_of_generic_subtree_.
Definition: type_base.hh:238
virtual string type_name() const override
Implements Type::TypeBase::type_name.
Definition: type_base.cc:610
void copy_attributes(attribute_map other_attributes)
Definition: type_base.cc:183
static string generic_parameters()
FinishStatus finish_status
Flag specified if Array is finished.
Definition: type_base.hh:367
std::string hash_str() const
Format the hash of this type.
Definition: type_base.hh:226
bool root_of_generic_subtree_
flag is true if type should be root of generic subtree
Definition: type_base.hh:307
virtual FinishStatus finish_status() const
Returns true if the type is fully specified and ready for read access.
Definition: type_base.cc:192
string desc() const
Returns string with Type extensive documentation.
Definition: type_base.cc:100
TypeHash content_hash() const override
Implements TypeBase::content_hash.
Definition: type_base.cc:406
IntFormatSpec< int, TypeSpec<'x'> > hex(int value)
string type_name() const override
Implements Type::TypeBase::type_name.
Definition: type_base.cc:497
virtual bool operator==(const TypeBase &other) const
Comparison of types.
Definition: type_base.cc:223
FinishStatus finish(FinishStatus finish_type=FinishStatus::regular_)
Finishes initialization of the ArrayData.
Definition: type_base.cc:272
virtual FinishStatus finish(FinishStatus finish_type=FinishStatus::regular_)
Finish method. Finalize construction of "Lazy types": Record, Selection, Abstract and generic type...
Definition: type_base.cc:217
TypeHash content_hash() const override
Implements TypeBase::content_hash.
Definition: type_base.cc:601
FileType
Possible types of file.
Definition: file_path.hh:67
virtual string class_name() const
Returns an identification of the class. Useful for output of the documentation.
Definition: type_base.cc:212
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:117
virtual bool is_finished() const
Definition: type_base.cc:197
string type_name() const override
Implements Type::TypeBase::type_name.
Definition: type_base.cc:552
::FilePath::FileType type_
The type of file (input or output).
Definition: type_base.hh:661
Double(double lower_bound=-std::numeric_limits< double >::max(), double upper_bound=std::numeric_limits< double >::max())
Constructor.
Definition: type_base.cc:475
Definitions of ASSERTS.
Helper class that stores data of generic types.
Definition: type_generic.hh:89
#define ASSERT_LE(a, b)
Definition of comparative assert macro (Less or Equal)
Definition: asserts.hh:303
TypeHash content_hash() const override
Implements TypeBase::content_hash.
Definition: type_base.cc:250
string type_name() const override
Implements Type::TypeBase::type_name.
Definition: type_base.cc:414
Class for declaration of the input data that are file names.
Definition: type_base.hh:617
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
Definition: asserts.hh:346
string class_name() const override
Override Type::TypeBase::class_name.
Definition: type_base.cc:616
std::shared_ptr< attribute_map > attributes_
map of type attributes (e. g. input_type, name etc.)
Definition: type_base.hh:304
Class for declaration of the integral input data.
Definition: type_base.hh:489
void add_attribute_(std::string name, json_string val)
Add attribute of given name to attribute map.
Definition: type_base.cc:135
ArrayData(unsigned int min_size, unsigned int max_size)
Constructor.
Definition: type_base.cc:267
Class for declaration of inputs sequences.
Definition: type_base.hh:345
void read_or_throw(const std::string &s, mValue &value)
double upper_bound_
Maximal value of Integer.
Definition: type_base.hh:575
static constexpr bool value
Definition: json.hpp:87
static TypeRepository & get_instance()
Return singleton instance of class.
ParameterMap parameter_map_
map of parameters if type is part of generic subtree
Definition: type_base.hh:313
std::shared_ptr< ArrayData > data_
Handle to the actual array data.
Definition: type_base.hh:435
bool match(std::int64_t value) const
Check valid value of Integer.
Definition: type_base.cc:449
std::map< std::string, TypeHash > ParameterMap
Defines map of used parameters.
Definition: type_base.hh:115
void reset_deleted_types()
Reset and remove types marked as deleted during finish.
std::int64_t upper_bound_
Maximal value of Integer.
Definition: type_base.hh:528
TypeBase()
The default constructor.
Definition: type_base.cc:79
static FileName input()
The factory function for declaring type FileName for input files.
Definition: type_base.cc:526
bool match(double value) const
Returns true if the given integer value conforms to the Type::Double bounds.
Definition: type_base.cc:491
static string root_of_generic_subtree()
TypeHash content_hash() const override
Implements TypeBase::content_hash.
Definition: type_base.cc:438
string type_name() const override
Implements Type::TypeBase::type_name.
Definition: type_base.cc:455
MakeInstanceReturnType make_instance(std::vector< ParameterPair > vec=std::vector< ParameterPair >()) override
Implements TypeBase::make_instance.
Definition: type_base.cc:318
FinishStatus finish(FinishStatus finish_type=FinishStatus::regular_) override
Finishes initialization of the Array type because of lazy evaluation of type_of_values.
Definition: type_base.cc:261
::FilePath::FileType get_file_type() const
Returns type of the file input/output.
Definition: type_base.cc:582
virtual bool is_closed() const
Returns true if the type is closed.
Definition: type_base.cc:202
bool operator!=(const TypeBase &other) const
Comparison of types.
Definition: type_base.cc:227
TypeHash content_hash() const override
Implements TypeBase::content_hash.
Definition: type_base.cc:540
virtual MakeInstanceReturnType make_instance(std::vector< ParameterPair > vec=std::vector< ParameterPair >()) override
Implements TypeBase::make_instance.
Definition: type_base.cc:628
bool match(const string &str) const override
Checks relative output paths.
Definition: type_base.cc:570
string class_name() const override
Override Type::TypeBase::class_name.
Definition: type_base.cc:564
FileName()
Forbids default constructor.
Definition: type_base.cc:516
virtual bool match(const string &value) const
Particular descendants can check validity of the string.
Definition: type_base.cc:622
TypeHash generic_type_hash_
hash string of generic type if type is derived, or empty string
Definition: type_base.hh:310
json_string print_parameter_map_to_json(ParameterMap parameter_map) const
Create JSON output from parameter_map formatted as value of attribute.
Definition: type_base.cc:152
bool is_finished() const override
Override Type::TypeBase::is_finished.
Definition: type_base.cc:361
std::shared_ptr< TypeBase > type_of_values_
Type of Array.
Definition: type_base.hh:361
virtual string type_name() const
Returns an identification of the type. Useful for error messages.
Definition: type_base.cc:207
Actual data of the Array.
Definition: type_base.hh:353
#define DIR_DELIMITER
Definition: system.hh:49
double lower_bound_
Minimal value of Integer.
Definition: type_base.hh:574
std::string json_string
String stored in JSON format.
Definition: type_base.hh:105
MakeInstanceReturnType make_instance(std::vector< ParameterPair > vec=std::vector< ParameterPair >()) override
Implements TypeBase::make_instance.
Definition: type_base.cc:424
string class_name() const override
Override Type::TypeBase::class_name.
Definition: type_base.cc:460
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:240
bool operator==(const TypeBase &other) const override
Comparison of types.
Definition: type_base.cc:589
string class_name() const override
Override Type::TypeBase::class_name.
Definition: type_base.cc:502
static void delete_unfinished_types()
Finishes and marks all types registered in type repositories and unused in IST.
Definition: type_base.cc:108
TypeHash content_hash() const override
Implements TypeBase::content_hash.
Definition: type_base.cc:480
Class for create text documentation.
Definition: type_output.hh:208
ARRAY_CONSTRUCT(String)
string type_name() const override
Implements Type::TypeBase::type_name.
Definition: type_base.cc:299
virtual ~TypeBase()
Destructor.
Definition: type_base.cc:91
Array deep_copy() const
Create deep copy of Array.
Definition: type_base.cc:338
Integer(int lower_bound=std::numeric_limits< int >::min(), int upper_bound=std::numeric_limits< int >::max())
Constructor.
Definition: type_base.cc:432
static FileName output()
The factory function for declaring type FileName for input files.
Definition: type_base.cc:533
string class_name() const override
Override Type::TypeBase::class_name.
Definition: type_base.cc:305
json_string print_parameter_map_keys_to_json(ParameterMap param_map) const
Definition: type_base.cc:163
std::size_t TypeHash
Type returned by content_hash methods.
Definition: type_base.hh:102
Array()
Forbids default constructor in order to prevent empty data_.
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Definition: exceptions.hh:53
FinishStatus finish_status() const override
Override Type::TypeBase::finish_status.
Definition: type_base.cc:357
friend class Record
Definition: type_base.hh:316
MakeInstanceReturnType make_instance(std::vector< ParameterPair > vec=std::vector< ParameterPair >()) override
Implements TypeBase::make_instance.
Definition: type_base.cc:507
void finish(Type::FinishStatus finish_type)
Finish all stored types.
string class_name() const override
Override Type::TypeBase::class_name.
Definition: type_base.cc:419