Flow123d  DF_mechanic_bench-4968b1b
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Input::PathYAML Class Reference

Class used by ReaderToStorage class to iterate over the YAML tree provided by yaml-cpp library. More...

#include <path_yaml.hh>

Inheritance diagram for Input::PathYAML:
Inheritance graph
[legend]
Collaboration diagram for Input::PathYAML:
Collaboration graph
[legend]

Public Types

typedef YAML::Node Node
 Definition of YAML-cpp node. More...
 

Public Member Functions

 PathYAML (std::istream &in)
 Constructor. More...
 
 ~PathYAML () override
 Destructor. More...
 
int level () const
 Returns level of actual path. More...
 
bool down (unsigned int index) override
 Dive into yaml-cpp hierarchy. More...
 
bool down (const std::string &key, int index=-1) override
 Dive into yaml-cpp hierarchy. More...
 
void up () override
 Return one level up in the hierarchy. More...
 
bool is_null_type () const override
 Implements PathBase::is_null_type. More...
 
bool get_bool_value () const override
 Implements PathBase::get_bool_value. More...
 
std::int64_t get_int_value () const override
 Implements PathBase::get_int_value. More...
 
double get_double_value () const override
 Implements PathBase::get_double_value. More...
 
std::string get_string_value () const override
 Implements PathBase::get_string_value. More...
 
unsigned int get_node_type_index () const override
 Implements PathBase::get_node_type_index. More...
 
bool get_record_key_set (std::set< std::string > &) const override
 Implements PathBase::get_record_key_set. More...
 
bool is_effectively_null () const override
 Implements PathBase::is_effectively_null. More...
 
int get_array_size () const override
 Implements PathBase::get_array_size. More...
 
bool is_record_type () const override
 Implements PathBase::is_record_type. More...
 
bool is_array_type () const override
 Implements PathBase::is_array_type. More...
 
PathYAMLclone () const override
 Implements PathBase::clone. More...
 
PathBasefind_ref_node () override
 Implements reading of reference keys, and check of cyclic references. More...
 
std::string get_record_tag () const override
 Implements PathBase::get_record_tag. More...
 
- Public Member Functions inherited from Input::PathBase
 TYPEDEF_ERR_INFO (EI_ErrorAddress, std::string)
 
 TYPEDEF_ERR_INFO (EI_RefAddress, std::string)
 
 TYPEDEF_ERR_INFO (EI_JsonFile, std::string)
 
 TYPEDEF_ERR_INFO (EI_RefStr, std::string)
 
 TYPEDEF_ERR_INFO (EI_Specification, std::string)
 
 DECLARE_INPUT_EXCEPTION (ExcRefOfWrongType,<< "Reference at address "<< EI_ErrorAddress::qval<< " has wrong type, should by string.")
 
 DECLARE_INPUT_EXCEPTION (ExcReferenceNotFound,<< "Error in input file: "<< EI_JsonFile::qval<< "\nReference {REF=\""<< EI_RefStr::val<< "\"} at address "<< EI_RefAddress::qval<< " not found.\n"<< "failed to follow at address: "<< EI_ErrorAddress::qval<< " because "<< EI_Specification::val)
 
virtual ~PathBase ()
 Must have virtual destructor to call the right one form child. More...
 
void output (std::ostream &stream) const
 Output to the given stream. More...
 
std::string get_node_type (unsigned int type_idx) const
 Get short string description of node type, method is used for printout of messages. More...
 
void go_to_root ()
 Move to root node. More...
 
std::string as_string () const
 Returns string address of current position. More...
 

Protected Member Functions

const Nodehead () const
 Pointer to YAML Value object at current path. More...
 
- Protected Member Functions inherited from Input::PathBase
 PathBase ()
 Forbid default constructor. More...
 

Protected Attributes

std::vector< Nodenodes_
 
- Protected Attributes inherited from Input::PathBase
std::vector< std::pair< int, std::string > > path_
 One level of the path_ is either index (nonnegative int) in array or string key in a json object. More...
 
std::vector< std::string > json_type_names
 Names of all possible node types in parsed input tree. More...
 

Detailed Description

Class used by ReaderToStorage class to iterate over the YAML tree provided by yaml-cpp library.

This class keeps whole path from the root of the YAML tree to the current node. We store nodes along path in nodes_ and address of the node in path_.

The class also contains methods for processing of special tags for 'TYPE' key. Class doesn't need special methods for work with references. YAML tree used own native references.

Definition at line 46 of file path_yaml.hh.

Member Typedef Documentation

◆ Node

typedef YAML::Node Input::PathYAML::Node

Definition of YAML-cpp node.

Definition at line 49 of file path_yaml.hh.

Constructor & Destructor Documentation

◆ PathYAML()

Input::PathYAML::PathYAML ( std::istream &  in)

Constructor.

Definition at line 30 of file path_yaml.cc.

Here is the caller graph for this function:

◆ ~PathYAML()

Input::PathYAML::~PathYAML ( )
override

Destructor.

Clean nodes_.

Definition at line 46 of file path_yaml.cc.

Member Function Documentation

◆ clone()

PathYAML * Input::PathYAML::clone ( ) const
overridevirtual

Implements PathBase::clone.

Implements Input::PathBase.

Definition at line 197 of file path_yaml.cc.

◆ down() [1/2]

bool Input::PathYAML::down ( const std::string &  key,
int  index = -1 
)
overridevirtual

Dive into yaml-cpp hierarchy.

Implements PathBase::down(const std::string&)

Implements Input::PathBase.

◆ down() [2/2]

bool Input::PathYAML::down ( unsigned int  index)
overridevirtual

Dive into yaml-cpp hierarchy.

Implements PathBase::down(unsigned int)

Implements Input::PathBase.

Definition at line 52 of file path_yaml.cc.

◆ find_ref_node()

PathBase * Input::PathYAML::find_ref_node ( )
overridevirtual

Implements reading of reference keys, and check of cyclic references.

Implements Input::PathBase.

Definition at line 202 of file path_yaml.cc.

◆ get_array_size()

int Input::PathYAML::get_array_size ( ) const
overridevirtual

Implements PathBase::get_array_size.

Implements Input::PathBase.

Definition at line 179 of file path_yaml.cc.

◆ get_bool_value()

bool Input::PathYAML::get_bool_value ( ) const
overridevirtual

Implements PathBase::get_bool_value.

Implements Input::PathBase.

Definition at line 93 of file path_yaml.cc.

◆ get_double_value()

double Input::PathYAML::get_double_value ( ) const
overridevirtual

Implements PathBase::get_double_value.

Implements Input::PathBase.

Definition at line 121 of file path_yaml.cc.

◆ get_int_value()

std::int64_t Input::PathYAML::get_int_value ( ) const
overridevirtual

Implements PathBase::get_int_value.

Implements Input::PathBase.

Definition at line 107 of file path_yaml.cc.

◆ get_node_type_index()

unsigned int Input::PathYAML::get_node_type_index ( ) const
overridevirtual

Implements PathBase::get_node_type_index.

Implements Input::PathBase.

Definition at line 149 of file path_yaml.cc.

◆ get_record_key_set()

bool Input::PathYAML::get_record_key_set ( std::set< std::string > &  keys_list) const
overridevirtual

Implements PathBase::get_record_key_set.

Implements Input::PathBase.

Definition at line 160 of file path_yaml.cc.

◆ get_record_tag()

std::string Input::PathYAML::get_record_tag ( ) const
overridevirtual

Implements PathBase::get_record_tag.

Implements Input::PathBase.

Definition at line 209 of file path_yaml.cc.

◆ get_string_value()

std::string Input::PathYAML::get_string_value ( ) const
overridevirtual

Implements PathBase::get_string_value.

Implements Input::PathBase.

Definition at line 135 of file path_yaml.cc.

◆ head()

const Node& Input::PathYAML::head ( ) const
inlineprotected

Pointer to YAML Value object at current path.

Definition at line 110 of file path_yaml.hh.

Here is the caller graph for this function:

◆ is_array_type()

bool Input::PathYAML::is_array_type ( ) const
overridevirtual

Implements PathBase::is_array_type.

Implements Input::PathBase.

Definition at line 192 of file path_yaml.cc.

◆ is_effectively_null()

bool Input::PathYAML::is_effectively_null ( ) const
overridevirtual

Implements PathBase::is_effectively_null.

Implements Input::PathBase.

Definition at line 220 of file path_yaml.cc.

◆ is_null_type()

bool Input::PathYAML::is_null_type ( ) const
overridevirtual

Implements PathBase::is_null_type.

Implements Input::PathBase.

Definition at line 88 of file path_yaml.cc.

◆ is_record_type()

bool Input::PathYAML::is_record_type ( ) const
overridevirtual

Implements PathBase::is_record_type.

Implements Input::PathBase.

Definition at line 187 of file path_yaml.cc.

◆ level()

int Input::PathYAML::level ( ) const
inlinevirtual

Returns level of actual path.

Root has level == 0.

Implements Input::PathBase.

Definition at line 66 of file path_yaml.hh.

◆ up()

void Input::PathYAML::up ( )
overridevirtual

Return one level up in the hierarchy.

Implements Input::PathBase.

Definition at line 80 of file path_yaml.cc.

Member Data Documentation

◆ nodes_

std::vector<Node> Input::PathYAML::nodes_
protected

Definition at line 114 of file path_yaml.hh.


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