29 #include <boost/type_traits.hpp> 30 #include <boost/tokenizer.hpp> 31 #include <boost/algorithm/string.hpp> 57 DECLARE_EXCEPTION( ExcWrongDefaultJSON, <<
"Consistency Error: Not valid JSON of Default value " 58 << EI_DefaultStr::qval <<
" of type " << EI_TypeName::qval <<
";\n" 59 <<
"During declaration of the key: " << EI_KeyName::qval );
60 DECLARE_EXCEPTION( ExcWrongDefault, <<
"Consistency Error: " << EI_Desc::val <<
"Default value " 61 << EI_DefaultStr::qval <<
" do not match type: " << EI_TypeName::qval <<
";\n" 62 <<
"During declaration of the key: " << EI_KeyName::qval );
63 DECLARE_EXCEPTION( ExcUnknownDescendant, <<
"Unknown descendant of TypeBase class, name: " << EI_TypeName::qval );
165 {
return typeid(*this) ==
typeid(other); }
169 {
return ! (*
this == other); }
185 static void delete_unfinished_types();
219 virtual TypeHash content_hash()
const =0;
226 static std::string hash_str(TypeHash hash);
230 return hash_str(content_hash());
238 virtual MakeInstanceReturnType make_instance(ParameterVector vec = ParameterVector()) =0;
242 return root_of_generic_subtree_;
258 void add_attribute_(std::string name, json_string val);
270 inline static KeyHash
key_hash(
const string &str) {
280 static bool is_valid_identifier(
const string& key);
283 bool validate_json(json_string str)
const;
286 json_string print_parameter_map_to_json(ParameterMap parameter_map)
const;
292 json_string print_parameter_map_keys_to_json(ParameterMap param_map)
const;
298 void set_generic_attributes(ParameterMap param_map);
303 void copy_attributes(attribute_map other_attributes);
361 : lower_bound_(min_size), upper_bound_(max_size), finish_status(
FinishStatus::
none_)
383 template <
class ValueType>
384 Array(
const ValueType &type,
unsigned int min_size=0,
unsigned int max_size=std::numeric_limits<unsigned int>::max() );
389 Array(std::shared_ptr<TypeBase> type,
unsigned int min_size=0,
unsigned int max_size=std::numeric_limits<unsigned int>::max() );
396 TypeHash content_hash()
const override;
403 return data_->finish_status; }
411 return *data_->type_of_values_; }
415 return size >=data_->lower_bound_ && size<=data_->upper_bound_; }
422 string type_name()
const override;
437 Array deep_copy()
const;
472 TypeHash content_hash()
const override;
480 string type_name()
const override;
505 Integer(
int lower_bound=std::numeric_limits<int>::min(),
int upper_bound=std::numeric_limits<int>::max())
506 : lower_bound_(lower_bound), upper_bound_(upper_bound)
514 TypeHash content_hash()
const override;
521 bool match(std::int64_t
value)
const;
528 string type_name()
const override;
558 Double(
double lower_bound= -std::numeric_limits<double>::max(),
double upper_bound=std::numeric_limits<double>::max())
559 : lower_bound_(lower_bound), upper_bound_(upper_bound)
567 TypeHash content_hash()
const override;
570 bool match(
double value)
const;
577 string type_name()
const override;
606 virtual string type_name()
const override;
611 TypeHash content_hash()
const override;
614 virtual bool match(
const string &
value)
const;
632 TypeHash content_hash()
const override;
651 string type_name()
const override;
659 bool match(
const string &str)
const override;
FileType
Possible types of file.
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
static constexpr bool value
bool operator==(const Null &, const Null &)
Global macros to enhance readability and debugging, general constants.