Flow123d
JS_before_hm-2205-g8c1b58980
|
Go to the documentation of this file.
27 #include <type_traits>
28 #include <boost/tokenizer.hpp>
29 #include <boost/algorithm/string.hpp>
30 #include <boost/functional/hash.hpp>
31 #include <boost/pointer_cast.hpp>
41 #include <boost/algorithm/string.hpp>
44 #include <boost/functional/hash/hash.hpp>
58 namespace Input {
namespace Type {
class Abstract; } }
59 namespace Input {
namespace Type {
class Record; } }
60 namespace Input {
namespace Type {
class Selection; } }
61 namespace Input {
namespace Type {
class Tuple; } }
79 : attributes_(
std::make_shared<
attribute_map>() ), root_of_generic_subtree_(false),
80 generic_type_hash_(
TypeBase::none_hash) {}
85 : attributes_(other.attributes_), root_of_generic_subtree_(other.root_of_generic_subtree_),
86 generic_type_hash_(other.generic_type_hash_), parameter_map_(other.parameter_map_) {}
94 namespace ba = boost::algorithm;
95 return ba::all( key, ba::is_lower() || ba::is_digit() || ba::is_any_of(
"_") );
127 ss <<
"\"" <<
std::hex << hash <<
"\"";
136 (*attributes_)[name] = val;
152 std::stringstream ss;
154 for (ParameterMap::iterator
it=parameter_map.begin();
it!=parameter_map.end();
it++) {
155 if (
it != parameter_map.begin()) ss <<
"," << endl;
165 for (ParameterMap::iterator
it=parameter_map.begin();
it!=parameter_map.end();
it++) {
166 if (
it != parameter_map.begin()) ss <<
", ";
167 ss <<
"\"" <<
it->first <<
"\"";
175 if (parameter_map.size() > 0)
184 for(
auto &item : other_attributes) {
185 if (item.first[0] !=
'_')
223 return typeid(*this) ==
typeid(other);
227 return ! (*
this == other);
253 boost::hash_combine(seed,
data_->lower_bound_);
254 boost::hash_combine(seed,
data_->upper_bound_);
255 boost::hash_combine(seed,
data_->type_of_values_->content_hash() );
261 return data_->finish(finish_type);
267 : lower_bound_(min_size), upper_bound_(max_size), finish_status(
FinishStatus::
none_)
282 if (
typeid( *(type_of_values_.get()) ) ==
typeid(
Instance)) {
284 type_of_values_ = type_of_values_->make_instance().first;
287 THROW( ExcGenericWithoutInstance() << EI_Object(type_of_values_->type_name()) );
289 type_of_values_->finish(finish_type);
290 ASSERT(type_of_values_->is_finished()).error();
299 return "array_of_" +
data_->type_of_values_->type_name();
311 return typeid(*this) ==
typeid(other) &&
322 arr.
data_->type_of_values_ = inst.first;
329 ASSERT(this->
validate_json(val))(val).error(
"Invalid JSON format of attribute 'parameters'.");
333 return std::make_pair( std::make_shared<Array>(arr), parameter_map );
339 arr.
data_ = std::make_shared<Array::ArrayData>(*this->
data_);
345 Array::Array(std::shared_ptr<TypeBase> type,
unsigned int min_size,
unsigned int max_size)
348 ASSERT_LE(min_size, max_size).error(
"Wrong limits for size of Input::Type::Array");
349 ASSERT(type->is_closed()).error();
351 data_->type_of_values_ = type;
357 return data_->finish_status; }
369 template <
class ValueType>
370 Array::Array(
const ValueType &type,
unsigned int min_size,
unsigned int max_size)
371 :
Array(
std::static_pointer_cast<
TypeBase>(
std::make_shared<ValueType>(type) ), min_size, max_size)
378 #define ARRAY_CONSTRUCT(TYPE) \
379 template Array::Array(const TYPE &type, unsigned int min_size, unsigned int max_size)
423 return std::make_pair( std::make_shared<Bool>(*
this),
ParameterMap() );
431 : lower_bound_(lower_bound), upper_bound_(upper_bound)
464 return std::make_pair( std::make_shared<Integer>(*
this),
ParameterMap() );
474 : lower_bound_(lower_bound), upper_bound_(upper_bound)
506 return std::make_pair( std::make_shared<Double>(*
this),
ParameterMap() );
542 boost::hash_combine(seed,
type_);
552 case ::FilePath::input_file:
553 return "FileName_input";
554 case ::FilePath::output_file:
555 return "FileName_output";
575 return std::make_pair( std::make_shared<FileName>(*
this),
ParameterMap() );
589 return typeid(*this) ==
typeid(other) &&
627 return std::make_pair( std::make_shared<String>(*
this),
ParameterMap() );
FileType
Possible types of file.
static constexpr bool value
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
void read_or_throw(const std::string &s, mValue &value)
#define ASSERT_LE(a, b)
Definition of comparative assert macro (Less or Equal) only for debug mode.
Class for create text documentation.
IntFormatSpec< int, TypeSpec< 'x'> > hex(int value)