Flow123d
release_3.0.0-955-g4db4b48
|
Class for declaration of polymorphic Record. More...
#include <type_abstract.hh>
Public Member Functions | |
AdHocAbstract (const Abstract &ancestor) | |
Constructor. More... | |
TypeHash | content_hash () const override |
Implements TypeBase::content_hash . More... | |
string | class_name () const override |
Override Type::TypeBase::class_name . More... | |
FinishStatus | finish (FinishStatus finish_type=FinishStatus::regular_) override |
Finish declaration of the AdHocAbstract type. More... | |
AdHocAbstract & | add_child (Record &subrec) |
Add inherited Record. More... | |
Public Member Functions inherited from Input::Type::Abstract | |
Abstract () | |
Default constructor. More... | |
Abstract (const Abstract &other) | |
Copy constructor. More... | |
Abstract (const string &type_name_in, const string &description) | |
Basic constructor. 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 () |
Close the Abstract and add its to type repository (see TypeRepository::add_type ). More... | |
Abstract & | root_of_generic_subtree () |
Abstract & | add_attribute (std::string key, TypeBase::json_string value) |
Frontend to TypeBase::add_attribute_. 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 FinishStatus | finish_status () const override |
Implements TypeBase::finish_status . 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... | |
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 (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 Attributes | |
const Abstract & | ancestor_ |
Reference to ancestor Abstract. More... | |
Protected Attributes inherited from Input::Type::Abstract | |
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 |
Additional Inherited Members | |
Public Types inherited from Input::Type::Abstract | |
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... | |
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 | |
static const 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::Abstract | |
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) |
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.
Abstract extends on list of descendants provided immediately after construction by add_child(). These descendants derive only keys from common AR. AdHocAR has separate instance for every key of this type.
Definition at line 269 of file type_abstract.hh.
Input::Type::AdHocAbstract::AdHocAbstract | ( | const Abstract & | ancestor | ) |
Constructor.
Definition at line 320 of file type_abstract.cc.
AdHocAbstract & Input::Type::AdHocAbstract::add_child | ( | Record & | subrec | ) |
Add inherited Record.
Definition at line 335 of file type_abstract.cc.
|
overridevirtual |
Override Type::TypeBase::class_name
.
Reimplemented from Input::Type::Abstract.
Definition at line 375 of file type_abstract.cc.
|
overridevirtual |
Implements TypeBase::content_hash
.
Hash is calculated by type name, description and name of ancestor.
Reimplemented from Input::Type::Abstract.
Definition at line 364 of file type_abstract.cc.
|
overridevirtual |
Finish declaration of the AdHocAbstract type.
Adds descendants of ancestor Abstract, calls close() and complete keys with non-null pointers to lazy types.
Reimplemented from Input::Type::Abstract.
Definition at line 343 of file type_abstract.cc.
|
friend |
Definition at line 270 of file type_abstract.hh.
|
protected |
Reference to ancestor Abstract.
Definition at line 299 of file type_abstract.hh.