|
Flow123d
last_with_con_2.0.0-2-g938dee8
|
Class for declaration of polymorphic Record. More...
#include <type_abstract.hh>


Classes | |
| class | ChildData |
| Actual data of the abstract record. More... | |
Public Types | |
| typedef std::vector< Record >::const_iterator | ChildDataIter |
| 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_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... | |
Public Member Functions | |
| Abstract () | |
| Default constructor. More... | |
| Abstract (const Abstract &other) | |
| Copy constructor. More... | |
| Abstract (const string &type_name_in, const string &description) | |
| Basic constructor. More... | |
| TypeHash | content_hash () const override |
Implements TypeBase::content_hash. More... | |
| Abstract & | allow_auto_conversion (const string &type_default) |
| Allows shorter input of the Abstract providing the default value to the "TYPE" key. More... | |
| Abstract & | close () |
| Can be used to close the Abstract for further declarations of keys. More... | |
| Abstract & | root_of_generic_subtree () |
| Abstract & | add_attribute (std::string key, TypeBase::json_string value) |
| Frontend to TypeBase::add_attribute_. More... | |
| bool | finish (bool is_generic=false) override |
| Finish declaration of the Abstract type. More... | |
| const Record & | get_descendant (const string &name) const |
| Returns reference to the inherited Record with given name. More... | |
| const Record * | get_default_descendant () const |
| Returns default descendant. More... | |
| const Selection & | get_type_selection () const |
| Returns reference to Selection type of the implicit key TYPE. More... | |
| unsigned int | child_size () const |
| Returns number of descendants in the child_data_. More... | |
| virtual bool | is_finished () const override |
Implements TypeBase::is_finished. More... | |
| virtual bool | is_closed () const override |
Returns true if data_ is closed. More... | |
| virtual string | type_name () const override |
Implements Type::TypeBase::type_name. More... | |
| string | class_name () const override |
Override Type::TypeBase::class_name. More... | |
| ChildDataIter | begin_child_data () const |
| Container-like access to the descendants of the Abstract. More... | |
| ChildDataIter | end_child_data () const |
| Container-like access to the descendants of the Abstract. More... | |
| int | add_child (const Record &subrec) |
| Add inherited Record. More... | |
| Default & | get_selection_default () const |
| virtual MakeInstanceReturnType | make_instance (std::vector< ParameterPair > vec=std::vector< ParameterPair >()) override |
Public Member Functions inherited from Input::Type::TypeBase | |
| string | desc () const |
| Returns string with Type extensive documentation. More... | |
| virtual bool | operator== (const TypeBase &other) const |
| Comparison of types. 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 Member Functions | |
| Abstract | deep_copy () const |
| Create deep copy of Abstract (copy all data stored in shared pointers etc.) More... | |
| bool | have_default_descendant () const |
| Check if type has set value of default descendants. 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) |
Protected Attributes | |
| std::shared_ptr< ChildData > | child_data_ |
| Actual data of the Abstract. 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... | |
Friends | |
| class | OutputBase |
| class | AdHocAbstract |
| class | Record |
Additional Inherited Members | |
Static Public Member Functions inherited from Input::Type::TypeBase | |
| static void | lazy_finish () |
| Finishes all types registered in type repositories. 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... | |
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 polymorphic Record.
Like the Record class this is only proxy class. It allows add Record as descendants, but further there is method no_more_descendants to close adding them. After this you can not derive any Record from this Abstract.
A static method (typically part of an abstract class) for construction of an AbstractType can look like:
Definition at line 53 of file type_abstract.hh.
| typedef std::vector< Record >::const_iterator Input::Type::Abstract::ChildDataIter |
Public typedef of constant iterator into array of keys.
Definition at line 121 of file type_abstract.hh.
| Input::Type::Abstract::Abstract | ( | ) |
Default constructor.
Definition at line 36 of file type_abstract.cc.

| Input::Type::Abstract::Abstract | ( | const Abstract & | other | ) |
| Input::Type::Abstract::Abstract | ( | const string & | type_name_in, |
| const string & | description | ||
| ) |
Basic constructor.
You has to provide type_name of the new declared Abstract type and its description.
Definition at line 51 of file type_abstract.cc.
| Abstract & Input::Type::Abstract::add_attribute | ( | std::string | key, |
| TypeBase::json_string | value | ||
| ) |
Frontend to TypeBase::add_attribute_.
Definition at line 243 of file type_abstract.cc.

| int Input::Type::Abstract::add_child | ( | const Record & | subrec | ) |
Add inherited Record.
This method is used primarily in combination with registration variable.
Example of usage:
Definition at line 113 of file type_abstract.cc.

| Abstract & Input::Type::Abstract::allow_auto_conversion | ( | const string & | type_default | ) |
Allows shorter input of the Abstract providing the default value to the "TYPE" key.
If the input reader come across the Abstract in the declaration tree and the input is not 'record-like' with specified value for TYPE, it tries to use the descendant Record specified by type_default parameter of this method. Further auto conversion of such Record may be possible.
Definition at line 76 of file type_abstract.cc.

| Abstract::ChildDataIter Input::Type::Abstract::begin_child_data | ( | ) | const |
Container-like access to the descendants of the Abstract.
Returns iterator to the first data.
Definition at line 256 of file type_abstract.cc.

| unsigned int Input::Type::Abstract::child_size | ( | ) | const |
Returns number of descendants in the child_data_.
Definition at line 108 of file type_abstract.cc.

|
inlineoverridevirtual |
Override Type::TypeBase::class_name.
Reimplemented from Input::Type::TypeBase.
Reimplemented in Input::Type::AdHocAbstract.
Definition at line 207 of file type_abstract.hh.
| Abstract & Input::Type::Abstract::close | ( | ) |
Can be used to close the Abstract for further declarations of keys.
Definition at line 159 of file type_abstract.cc.

|
overridevirtual |
Implements TypeBase::content_hash.
Hash is calculated by type name, description and hash of attributes.
Implements Input::Type::TypeBase.
Reimplemented in Input::Type::AdHocAbstract.
Definition at line 56 of file type_abstract.cc.

|
protected |
Create deep copy of Abstract (copy all data stored in shared pointers etc.)
Definition at line 222 of file type_abstract.cc.

| Abstract::ChildDataIter Input::Type::Abstract::end_child_data | ( | ) | const |
Container-like access to the descendants of the Abstract.
Returns iterator to the last data.
Definition at line 260 of file type_abstract.cc.

|
overridevirtual |
Finish declaration of the Abstract type.
Set Abstract as parent of derived Records (for mechanism of set parent and descendant see Record::derive_from)
Reimplemented from Input::Type::TypeBase.
Reimplemented in Input::Type::AdHocAbstract.
Definition at line 126 of file type_abstract.cc.

| const Record * Input::Type::Abstract::get_default_descendant | ( | ) | const |
Returns default descendant.
Returns only if TYPE key has default value, otherwise returns empty Record.
Definition at line 92 of file type_abstract.cc.

| const Record & Input::Type::Abstract::get_descendant | ( | const string & | name | ) | const |
Returns reference to the inherited Record with given name.
Definition at line 84 of file type_abstract.cc.

| Default & Input::Type::Abstract::get_selection_default | ( | ) | const |
| const Selection & Input::Type::Abstract::get_type_selection | ( | ) | const |
Returns reference to Selection type of the implicit key TYPE.
Definition at line 102 of file type_abstract.cc.

|
protected |
Check if type has set value of default descendants.
Definition at line 184 of file type_abstract.cc.

|
overridevirtual |
Returns true if data_ is closed.
Reimplemented from Input::Type::TypeBase.
Definition at line 170 of file type_abstract.cc.

|
overridevirtual |
Implements TypeBase::is_finished.
Reimplemented from Input::Type::TypeBase.
Definition at line 165 of file type_abstract.cc.
|
overridevirtual |
| Abstract & Input::Type::Abstract::root_of_generic_subtree | ( | ) |
Mark the type to be root of a generic subtree. Such type can not appear in IST directly but only as the internal type of the Instance auxiliary object.
Definition at line 237 of file type_abstract.cc.

|
overridevirtual |
Implements Type::TypeBase::type_name.
Name corresponds to data_->type_name_.
Reimplemented from Input::Type::TypeBase.
Definition at line 175 of file type_abstract.cc.

|
friend |
Definition at line 56 of file type_abstract.hh.
|
friend |
Definition at line 54 of file type_abstract.hh.
|
friend |
Definition at line 276 of file type_abstract.hh.
|
protected |
Actual data of the Abstract.
Definition at line 274 of file type_abstract.hh.
1.8.11