Flow123d
release_2.2.0-36-g163dc99
|
Class for declaration of inputs sequences. More...
#include <type_base.hh>
Classes | |
class | ArrayData |
Actual data of the Array. More... | |
Public Member Functions | |
template<class ValueType > | |
Array (const ValueType &type, unsigned int min_size=0, unsigned int max_size=std::numeric_limits< unsigned int >::max()) | |
Constructor with a type of array items given as pure reference. More... | |
Array (std::shared_ptr< TypeBase > type, unsigned int min_size=0, unsigned int max_size=std::numeric_limits< unsigned int >::max()) | |
Constructor with a shared pointer type of array. More... | |
TypeHash | content_hash () const override |
Implements TypeBase::content_hash . More... | |
FinishStatus | finish (FinishStatus finish_type=FinishStatus::regular_) override |
Finishes initialization of the Array type because of lazy evaluation of type_of_values. More... | |
FinishStatus | finish_status () const override |
Override Type::TypeBase::finish_status . More... | |
bool | is_finished () const override |
Override Type::TypeBase::is_finished . More... | |
const TypeBase & | get_sub_type () const |
Getter for the type of array items. More... | |
bool | match_size (unsigned int size) const |
Checks size of particular array. More... | |
string | type_name () const override |
Implements Type::TypeBase::type_name . More... | |
string | class_name () const override |
Override Type::TypeBase::class_name . More... | |
bool | operator== (const TypeBase &other) const override |
Implements Type::TypeBase::operator== Compares also subtypes. More... | |
MakeInstanceReturnType | make_instance (std::vector< ParameterPair > vec=std::vector< ParameterPair >()) override |
Implements TypeBase::make_instance . More... | |
Array | deep_copy () const |
Create deep copy of Array. More... | |
Public Member Functions inherited from Input::Type::TypeBase | |
virtual bool | is_closed () const |
Returns true if the type is closed. More... | |
string | desc () const |
Returns string with Type extensive documentation. More... | |
bool | operator!= (const TypeBase &other) const |
Comparison of types. More... | |
virtual | ~TypeBase () |
Destructor. More... | |
std::string | hash_str () const |
Format the hash of this type. More... | |
virtual MakeInstanceReturnType | make_instance (ParameterVector vec=ParameterVector())=0 |
bool | is_root_of_generic_subtree () |
Indicates if type is marked with flag root_of_generic_subtree_ . More... | |
Protected Attributes | |
std::shared_ptr< ArrayData > | data_ |
Handle to the actual array data. More... | |
Protected Attributes inherited from Input::Type::TypeBase | |
std::shared_ptr< attribute_map > | attributes_ |
map of type attributes (e. g. input_type, name etc.) More... | |
bool | root_of_generic_subtree_ |
flag is true if type should be root of generic subtree More... | |
TypeHash | generic_type_hash_ |
hash string of generic type if type is derived, or empty string More... | |
ParameterMap | parameter_map_ |
map of parameters if type is part of generic subtree More... | |
Private Member Functions | |
Array () | |
Forbids default constructor in order to prevent empty data_. More... | |
Friends | |
class | OutputBase |
Additional Inherited Members | |
Public Types inherited from Input::Type::TypeBase | |
typedef std::size_t | TypeHash |
Type returned by content_hash methods. More... | |
typedef std::string | json_string |
String stored in JSON format. More... | |
typedef std::map< std::string, json_string > | attribute_map |
Defines map of Input::Type attributes. More... | |
typedef 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. More... | |
typedef std::vector< ParameterPair > | ParameterVector |
Define vector of parameters passed to the overloaded make_instance method. More... | |
typedef std::map< std::string, TypeHash > | ParameterMap |
Defines map of used parameters. More... | |
typedef std::pair< std::shared_ptr< TypeBase >, ParameterMap > | MakeInstanceReturnType |
Return type of make_instance methods, contains instance of generic type and map of used parameters. More... | |
Static Public Member Functions inherited from Input::Type::TypeBase | |
static void | delete_unfinished_types () |
Finishes and marks all types registered in type repositories and unused in IST. More... | |
static std::string | hash_str (TypeHash hash) |
Format given hash for output. More... | |
Protected Types inherited from Input::Type::TypeBase | |
typedef string | KeyHash |
The type of hash values used in associative array that translates key names to indices in Record and Selection. More... | |
Protected Member Functions inherited from Input::Type::TypeBase | |
TypeBase () | |
The default constructor. More... | |
TypeBase (const TypeBase &other) | |
Copy constructor. More... | |
void | add_attribute_ (std::string name, json_string val) |
Add attribute of given name to attribute map. More... | |
bool | validate_json (json_string str) const |
Check if str is valid JSON string. More... | |
json_string | print_parameter_map_to_json (ParameterMap parameter_map) const |
Create JSON output from parameter_map formatted as value of attribute. More... | |
json_string | print_parameter_map_keys_to_json (ParameterMap param_map) const |
void | set_generic_attributes (ParameterMap param_map) |
void | copy_attributes (attribute_map other_attributes) |
Static Protected Member Functions inherited from Input::Type::TypeBase | |
static KeyHash | key_hash (const string &str) |
Hash function. More... | |
static bool | is_valid_identifier (const string &key) |
Check that a key is valid identifier. More... | |
Class for declaration of inputs sequences.
The type is fully specified after its constructor is called. All elements of the Array has same type, however you can use elements of Abstract.
If you not disallow Array size 1, the input reader will try to convert any other type on input into array with one element, e.g.
Definition at line 345 of file type_base.hh.
Input::Type::Array::Array | ( | const ValueType & | type, |
unsigned int | min_size = 0 , |
||
unsigned int | max_size = std::numeric_limits<unsigned int>::max() |
||
) |
Constructor with a type
of array items given as pure reference.
In this case type
has to by descendant of TypeBase
different from 'complex' types Record
and Selection
. You can also specify minimum and maximum size of the array.
Definition at line 371 of file type_base.cc.
Input::Type::Array::Array | ( | std::shared_ptr< TypeBase > | type, |
unsigned int | min_size = 0 , |
||
unsigned int | max_size = std::numeric_limits<unsigned int>::max() |
||
) |
Constructor with a shared pointer type
of array.
Definition at line 346 of file type_base.cc.
|
private |
Forbids default constructor in order to prevent empty data_.
|
overridevirtual |
Override Type::TypeBase::class_name
.
Reimplemented from Input::Type::TypeBase.
Definition at line 305 of file type_base.cc.
|
overridevirtual |
Implements TypeBase::content_hash
.
Hash is calculated by type name, bounds, hash of stored type and hash of attributes.
Implements Input::Type::TypeBase.
Definition at line 250 of file type_base.cc.
Array Input::Type::Array::deep_copy | ( | ) | const |
Create deep copy of Array.
Copy all data stored in shared pointers etc.
Definition at line 338 of file type_base.cc.
|
overridevirtual |
Finishes initialization of the Array type because of lazy evaluation of type_of_values.
Reimplemented from Input::Type::TypeBase.
Definition at line 261 of file type_base.cc.
|
overridevirtual |
Override Type::TypeBase::finish_status
.
Reimplemented from Input::Type::TypeBase.
Definition at line 357 of file type_base.cc.
|
inline |
Getter for the type of array items.
Definition at line 403 of file type_base.hh.
|
overridevirtual |
Override Type::TypeBase::is_finished
.
Reimplemented from Input::Type::TypeBase.
Definition at line 361 of file type_base.cc.
|
override |
Implements TypeBase::make_instance
.
Definition at line 318 of file type_base.cc.
|
inline |
Checks size of particular array.
Definition at line 407 of file type_base.hh.
|
overridevirtual |
Implements Type::TypeBase::operator==
Compares also subtypes.
Reimplemented from Input::Type::TypeBase.
Definition at line 311 of file type_base.cc.
|
overridevirtual |
Implements Type::TypeBase::type_name
.
Name has form array_of_'subtype_name'
.
Reimplemented from Input::Type::TypeBase.
Definition at line 299 of file type_base.cc.
|
friend |
Definition at line 346 of file type_base.hh.
|
protected |
Handle to the actual array data.
Definition at line 435 of file type_base.hh.