Flow123d  JS_before_hm-1728-g5d7ebd453
Classes | Public Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
Input::Type::Array Class Reference

Class for declaration of inputs sequences. More...

#include <type_base.hh>

Inheritance diagram for Input::Type::Array:
Inheritance graph
[legend]
Collaboration diagram for Input::Type::Array:
Collaboration graph
[legend]

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 TypeBaseget_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 () const
 Indicates if type is marked with flag root_of_generic_subtree_. More...
 

Protected Attributes

std::shared_ptr< ArrayDatadata_
 Handle to the actual array data. More...
 
- Protected Attributes inherited from Input::Type::TypeBase
std::shared_ptr< attribute_mapattributes_
 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_stringattribute_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< ParameterPairParameterVector
 Define vector of parameters passed to the overloaded make_instance method. More...
 
typedef std::map< std::string, TypeHashParameterMap
 Defines map of used parameters. More...
 
typedef std::pair< std::shared_ptr< TypeBase >, ParameterMapMakeInstanceReturnType
 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...
 
- Static Public Attributes inherited from Input::Type::TypeBase
const static TypeHash none_hash = std::numeric_limits<TypeHash>::max()
 
- 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...
 

Detailed Description

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.

int_array=1 # is equivalent to
int_array=[ 1 ]

Definition at line 339 of file type_base.hh.

Constructor & Destructor Documentation

◆ Array() [1/3]

template<class ValueType >
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 370 of file type_base.cc.

◆ Array() [2/3]

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 345 of file type_base.cc.

◆ Array() [3/3]

Input::Type::Array::Array ( )
private

Forbids default constructor in order to prevent empty data_.

Here is the caller graph for this function:

Member Function Documentation

◆ class_name()

string Input::Type::Array::class_name ( ) const
overridevirtual

Override Type::TypeBase::class_name.

Reimplemented from Input::Type::TypeBase.

Definition at line 304 of file type_base.cc.

◆ content_hash()

TypeBase::TypeHash Input::Type::Array::content_hash ( ) const
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 249 of file type_base.cc.

Here is the caller graph for this function:

◆ deep_copy()

Array Input::Type::Array::deep_copy ( ) const

Create deep copy of Array.

Copy all data stored in shared pointers etc.

Definition at line 337 of file type_base.cc.

Here is the caller graph for this function:

◆ finish()

FinishStatus Input::Type::Array::finish ( FinishStatus  finish_type = FinishStatus::regular_)
overridevirtual

Finishes initialization of the Array type because of lazy evaluation of type_of_values.

Reimplemented from Input::Type::TypeBase.

Definition at line 260 of file type_base.cc.

◆ finish_status()

FinishStatus Input::Type::Array::finish_status ( ) const
overridevirtual

Override Type::TypeBase::finish_status.

Reimplemented from Input::Type::TypeBase.

Definition at line 356 of file type_base.cc.

Here is the caller graph for this function:

◆ get_sub_type()

const TypeBase& Input::Type::Array::get_sub_type ( ) const
inline

Getter for the type of array items.

Definition at line 397 of file type_base.hh.

Here is the caller graph for this function:

◆ is_finished()

bool Input::Type::Array::is_finished ( ) const
overridevirtual

Override Type::TypeBase::is_finished.

Reimplemented from Input::Type::TypeBase.

Definition at line 360 of file type_base.cc.

◆ make_instance()

TypeBase::MakeInstanceReturnType Input::Type::Array::make_instance ( std::vector< ParameterPair vec = std::vector<ParameterPair>())
override

Implements TypeBase::make_instance.

Definition at line 317 of file type_base.cc.

◆ match_size()

bool Input::Type::Array::match_size ( unsigned int  size) const
inline

Checks size of particular array.

Definition at line 401 of file type_base.hh.

◆ operator==()

bool Input::Type::Array::operator== ( const TypeBase other) const
overridevirtual

Implements Type::TypeBase::operator== Compares also subtypes.

Reimplemented from Input::Type::TypeBase.

Definition at line 310 of file type_base.cc.

◆ type_name()

string Input::Type::Array::type_name ( ) const
overridevirtual

Implements Type::TypeBase::type_name.

Name has form array_of_'subtype_name'.

Reimplemented from Input::Type::TypeBase.

Definition at line 298 of file type_base.cc.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ OutputBase

friend class OutputBase
friend

Definition at line 340 of file type_base.hh.

Member Data Documentation

◆ data_

std::shared_ptr<ArrayData> Input::Type::Array::data_
protected

Handle to the actual array data.

Definition at line 429 of file type_base.hh.


The documentation for this class was generated from the following files: