Flow123d  release_2.2.0-914-gf1a3a4f
Public Member Functions | List of all members
Input::Type::Tuple Class Reference

Tuple type proxy class. More...

#include <type_tuple.hh>

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

Public Member Functions

 TYPEDEF_ERR_INFO (EI_TupleName, const string)
 
 DECLARE_EXCEPTION (ExcTupleWrongKeysOrder,<< "Incorrect order of obligatory and non-obligatory keys in Tuple: "<< EI_TupleName::qval)
 
 Tuple ()
 Default constructor. Empty handle. More...
 
 Tuple (const Tuple &other)
 Copy constructor. More...
 
 Tuple (const string &type_name_in, const string &description)
 Basic constructor. More...
 
TypeHash content_hash () const override
 
string class_name () const override
 Override Type::TypeBase::class_name. More...
 
Tupleallow_auto_conversion (const string &from_key) override
 Override Record::allow_auto_conversion. More...
 
bool operator== (const TypeBase &other) const override
 Class comparison and Tuple type name comparison. More...
 
const Tupleclose () const
 Close the Tuple for further declarations of keys. More...
 
FinishStatus finish (FinishStatus finish_type=FinishStatus::regular_) override
 Finish declaration of the Tuple type. More...
 
Tuplederive_from (Abstract &parent) override
 Override Record::derive_from. More...
 
unsigned int obligatory_keys_count () const
 Return count of obligatory keys. More...
 
MakeInstanceReturnType make_instance (std::vector< ParameterPair > vec=std::vector< ParameterPair >()) override
 Implements TypeBase::make_instance. More...
 
Tuple deep_copy () const
 Overrides Record::deep_copy. More...
 
Tupleroot_of_generic_subtree () override
 Overrides Record::root_of_generic_subtree. More...
 
Tupledeclare_key (const string &key, std::shared_ptr< TypeBase > type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes=TypeBase::attribute_map())
 Overrides Record::declare_key(const string &, std::shared_ptr<TypeBase>, const Default &, const string &) More...
 
template<class KeyType >
Tupledeclare_key (const string &key, const KeyType &type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes=TypeBase::attribute_map())
 Overrides Record::declare_key(const string &, const KeyType &, const Default &, const string &) More...
 
template<class KeyType >
Tupledeclare_key (const string &key, const KeyType &type, const string &description, TypeBase::attribute_map key_attributes=TypeBase::attribute_map())
 Overrides Record::declare_key(const string &, const KeyType &, const string &) More...
 
- Public Member Functions inherited from Input::Type::Record
 TYPEDEF_ERR_INFO (EI_Record, Record)
 
 TYPEDEF_ERR_INFO (EI_RecordName, const string)
 
 DECLARE_EXCEPTION (ExcRecordKeyNotFound,<< "Key "<< EI_KeyName::qval<<" not found in Record:\n"<< EI_Record::val)
 
 Record ()
 Default constructor. Empty handle. More...
 
 Record (const Record &other)
 Copy constructor. More...
 
 Record (const string &type_name_in, const string &description)
 Basic constructor. More...
 
Recordcopy_keys (const Record &other)
 Copy keys from other record. More...
 
Recorddeclare_key (const string &key, std::shared_ptr< TypeBase > type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes=TypeBase::attribute_map())
 Declares a new key of the Record. More...
 
template<class KeyType >
Recorddeclare_key (const string &key, const KeyType &type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes=TypeBase::attribute_map())
 Declares a new key of the Record. More...
 
template<class KeyType >
Recorddeclare_key (const string &key, const KeyType &type, const string &description, TypeBase::attribute_map key_attributes=TypeBase::attribute_map())
 Declares a new key of the Record. More...
 
Recordclose () const
 Close the Record for further declarations of keys. More...
 
FinishStatus finish_status () const override
 Implements TypeBase::finish_status. More...
 
bool is_finished () const override
 Implements TypeBase::is_finished. More...
 
bool is_closed () const override
 Returns true if data_ is closed. More...
 
string type_name () const override
 Implements Type::TypeBase::type_name. More...
 
unsigned int key_index (const string &key) const
 Interface to mapping key -> index in record. More...
 
KeyIter key_iterator (const string &key) const
 Returns iterator to the key struct for given key string. More...
 
KeyIter auto_conversion_key_iter () const
 Returns iterator to auto-conversion key. More...
 
bool has_key_iterator (const string &key, KeyIter &it) const
 Returns iterator to the key struct for given key string. More...
 
KeyIter begin () const
 Container-like access to the keys of the Record. More...
 
KeyIter end () const
 Container-like access to the keys of the Record. More...
 
bool has_key (const string &key) const
 Returns true if the Record contains key with given name. More...
 
unsigned int size () const
 Returns number of keys in the Record. More...
 
Recordadd_attribute (std::string key, TypeBase::json_string value)
 Add TYPE key as obligatory. More...
 
Record deep_copy () const
 Create deep copy of Record (copy all data stored in shared pointers etc.) More...
 
- Public Member Functions inherited from Input::Type::TypeBase
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...
 

Additional Inherited Members

- Public Types inherited from Input::Type::Record
typedef std::vector< struct Key >::const_iterator KeyIter
 Public typedef of constant iterator into array of keys. More...
 
- 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...
 
- 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::Record
void finished_check () const
 Assertion for finished Type::Record. More...
 
void make_copy_keys (Record &origin)
 Auxiliary method that actually makes the copy of keys. More...
 
void set_instance_data (Record &rec, ParameterMap &parameter_map, std::vector< ParameterPair > vec)
 Declares a TYPE key of the Record. 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...
 
- Protected Attributes inherited from Input::Type::Record
std::shared_ptr< RecordDatadata_
 Data handle. 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...
 

Detailed Description

Tuple type proxy class.

Class is used for small data items, which are repeated several times. Declaration is same as for the Record. Allows two possibilities of declaration:

In declaration, obligatory keys must be given as first, optional and default at read time keys follows. Correct order is checked in finish method. Auto conversion is allowed for the first key.

Tuple type can't be descendant of Abstract.

Definition at line 45 of file type_tuple.hh.

Constructor & Destructor Documentation

Input::Type::Tuple::Tuple ( )

Default constructor. Empty handle.

Definition at line 29 of file type_tuple.cc.

Here is the caller graph for this function:

Input::Type::Tuple::Tuple ( const Tuple other)

Copy constructor.

We allow only copies of non-empty tuples.

Definition at line 33 of file type_tuple.cc.

Input::Type::Tuple::Tuple ( const string &  type_name_in,
const string &  description 
)

Basic constructor.

You have to provide type_name of the new declared Record type and its description.

Definition at line 37 of file type_tuple.cc.

Member Function Documentation

Tuple & Input::Type::Tuple::allow_auto_conversion ( const string &  from_key)
overridevirtual

Override Record::allow_auto_conversion.

Forbids setting of auto conversion key. Tuple type can have auto convertible the first key.

Reimplemented from Input::Type::Record.

Definition at line 57 of file type_tuple.cc.

Here is the caller graph for this function:

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

Override Type::TypeBase::class_name.

Reimplemented from Input::Type::Record.

Definition at line 52 of file type_tuple.cc.

const Tuple & Input::Type::Tuple::close ( ) const

Close the Tuple for further declarations of keys.

See also
Record::close

Definition at line 70 of file type_tuple.cc.

Here is the caller graph for this function:

TypeBase::TypeHash Input::Type::Tuple::content_hash ( ) const
overridevirtual

Implements TypeBase::content_hash.

Hash is calculated by type name, description, hash of keys and attributes.

Reimplemented from Input::Type::Record.

Definition at line 43 of file type_tuple.cc.

Input::Type::Tuple::DECLARE_EXCEPTION ( ExcTupleWrongKeysOrder  ,
<< "Incorrect order of obligatory and non-obligatory keys in Tuple: "<< EI_TupleName::qval   
)
Tuple & Input::Type::Tuple::declare_key ( const string &  key,
std::shared_ptr< TypeBase type,
const Default default_value,
const string &  description,
TypeBase::attribute_map  key_attributes = TypeBase::attribute_map() 
)

Overrides Record::declare_key(const string &, std::shared_ptr<TypeBase>, const Default &, const string &)

Definition at line 171 of file type_tuple.cc.

Here is the caller graph for this function:

template<class KeyType >
Tuple & Input::Type::Tuple::declare_key ( const string &  key,
const KeyType &  type,
const Default default_value,
const string &  description,
TypeBase::attribute_map  key_attributes = TypeBase::attribute_map() 
)

Overrides Record::declare_key(const string &, const KeyType &, const Default &, const string &)

Definition at line 181 of file type_tuple.cc.

template<class KeyType >
Tuple & Input::Type::Tuple::declare_key ( const string &  key,
const KeyType &  type,
const string &  description,
TypeBase::attribute_map  key_attributes = TypeBase::attribute_map() 
)

Overrides Record::declare_key(const string &, const KeyType &, const string &)

Definition at line 192 of file type_tuple.cc.

Tuple Input::Type::Tuple::deep_copy ( ) const

Overrides Record::deep_copy.

Definition at line 153 of file type_tuple.cc.

Here is the caller graph for this function:

Tuple & Input::Type::Tuple::derive_from ( Abstract parent)
overridevirtual

Override Record::derive_from.

Deriving of Tuple type is forbidden. Type is determined for small simple data.

Reimplemented from Input::Type::Record.

Definition at line 128 of file type_tuple.cc.

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

Finish declaration of the Tuple type.

Completes Tuple (check auto convertible key, parameters of generic types etc).

Reimplemented from Input::Type::Record.

Definition at line 76 of file type_tuple.cc.

TypeBase::MakeInstanceReturnType Input::Type::Tuple::make_instance ( std::vector< ParameterPair vec = std::vector<ParameterPair>())
overridevirtual

Implements TypeBase::make_instance.

Reimplemented from Input::Type::Record.

Definition at line 144 of file type_tuple.cc.

unsigned int Input::Type::Tuple::obligatory_keys_count ( ) const

Return count of obligatory keys.

Needs in exceptions.

Definition at line 135 of file type_tuple.cc.

Here is the caller graph for this function:

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

Class comparison and Tuple type name comparison.

Reimplemented from Input::Type::Record.

Definition at line 64 of file type_tuple.cc.

Tuple & Input::Type::Tuple::root_of_generic_subtree ( )
overridevirtual

Overrides Record::root_of_generic_subtree.

Reimplemented from Input::Type::Record.

Definition at line 165 of file type_tuple.cc.

Input::Type::Tuple::TYPEDEF_ERR_INFO ( EI_TupleName  ,
const string   
)

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