Flow123d  SM_CI_GNU_Integration_tests-46bf8c3
Public Member Functions | Protected Member Functions | List of all members
Input::ReaderInternalBase Class Referenceabstract

Internal part of IST reader. More...

#include <reader_internal_base.hh>

Inheritance diagram for Input::ReaderInternalBase:
Inheritance graph
[legend]

Public Member Functions

 TYPEDEF_ERR_INFO (EI_InputType, string)
 
 TYPEDEF_ERR_INFO (EI_File, const string)
 
 TYPEDEF_ERR_INFO (EI_Specification, const string)
 
 TYPEDEF_ERR_INFO (EI_Format, const string)
 
 TYPEDEF_ERR_INFO (EI_JSON_Type, const string)
 
 TYPEDEF_ERR_INFO (EI_ErrorAddress, string)
 
 TYPEDEF_ERR_INFO (EI_TransposeIndex, unsigned int)
 
 TYPEDEF_ERR_INFO (EI_TransposeAddress, string)
 
 TYPEDEF_ERR_INFO (EI_JSONLine, unsigned int)
 
 TYPEDEF_ERR_INFO (EI_JSONColumn, unsigned int)
 
 TYPEDEF_ERR_INFO (EI_JSONReason, string)
 
 TYPEDEF_ERR_INFO (EI_InputErrorMessage, const string)
 
 TYPEDEF_ERR_INFO (EI_RecordName, const string)
 
 TYPEDEF_ERR_INFO (EI_Tag, string)
 
 TYPEDEF_ERR_INFO (EI_TokenizerMsg, std::string)
 
 TYPEDEF_ERR_INFO (EI_ColumnIndex, unsigned int)
 
 DECLARE_INPUT_EXCEPTION (ExcInputError,<< "Error in input file: "<< EI_File::qval<< " at address: "<< EI_ErrorAddress::qval<< "\n"<< EI_Specification::val<< "\n"<< EI_Format::val<< " type: "<< EI_JSON_Type::qval<< "\n"<< "Expected type:\n"<< EI_InputType::val)
 General exception during conversion from JSON/YAML tree to storage. More...
 
 DECLARE_INPUT_EXCEPTION (ExcNotJSONFormat,<< "Not valid JSON file "<< EI_File::qval<< ". Error at line "<< EI_JSONLine::val<< " : col "<< EI_JSONColumn::val<< " ; reason: "<< EI_JSONReason::val<< "\n")
 
 DECLARE_INPUT_EXCEPTION (ExcAutomaticConversionError,<< "Error during automatic conversion of "<< EI_RecordName::val<< " record.\n "<< EI_InputErrorMessage::val<< "\n")
 
 DECLARE_INPUT_EXCEPTION (ExcForbiddenTag,<< "Tag "<< EI_Tag::qval<< " "<< EI_Specification::val<< "\n")
 
 DECLARE_INPUT_EXCEPTION (ExcDuplicitTag,<< "Error in input file: "<< EI_File::qval<< " at address: "<< EI_ErrorAddress::qval<< "\n"<< "Duplicit Tag: "<< EI_Tag::qval<< "\n")
 
 DECLARE_INPUT_EXCEPTION (ExcWrongCsvFormat,<< EI_Specification::val<< ",\n"<< EI_TokenizerMsg::val<< "\n")
 
 DECLARE_INPUT_EXCEPTION (ExcMultipleDefinitionCsvColumn,<< "Multiple definition of column with index "<< EI_ColumnIndex::qval<< " in included CSV file:\n"<< EI_File::val<< ",\n")
 
 ReaderInternalBase ()
 Constructor. More...
 

Protected Member Functions

StorageBasemake_storage (PathBase &p, const Type::TypeBase *type)
 Create storage of given type. More...
 
StorageBasemake_sub_storage (PathBase &p, const Type::Record *record)
 Create storage of Type::Record type. Common method of all descendants. More...
 
StorageBasemake_sub_storage (PathBase &p, const Type::Tuple *tuple)
 Create storage of Type::Tuple type. Common method of all descendants. More...
 
StorageBasemake_sub_storage (PathBase &p, const Type::Abstract *abstr_rec)
 Create storage of Type::Abstract type. Common method of all descendants. More...
 
virtual StorageBasemake_sub_storage (PathBase &p, const Type::Array *array)=0
 Create storage of Type::Array type. More...
 
virtual StorageBasemake_sub_storage (PathBase &p, const Type::Selection *selection)=0
 Create storage of Type::Selection type. More...
 
virtual StorageBasemake_sub_storage (PathBase &p, const Type::Bool *bool_type)=0
 Create storage of Type::Bool type. More...
 
virtual StorageBasemake_sub_storage (PathBase &p, const Type::Integer *int_type)=0
 Create storage of Type::Integer type. More...
 
virtual StorageBasemake_sub_storage (PathBase &p, const Type::Double *double_type)=0
 Create storage of Type::Double type. More...
 
virtual StorageBasemake_sub_storage (PathBase &p, const Type::String *string_type)=0
 Create storage of Type::String type. More...
 
StorageBaserecord_automatic_conversion (PathBase &p, const Type::Record *record)
 Apply automatic conversion of Type::Record type. More...
 
StorageBaseabstract_automatic_conversion (PathBase &p, const Type::Abstract *abstr_rec)
 Apply automatic conversion of Type::Abstract type. More...
 
StorageBasemake_array_storage (PathBase &p, const Type::Array *array, int arr_size)
 Create storage of Type::Array with given size. More...
 
StorageBasemake_storage_from_default (const string &dflt_str, std::shared_ptr< Type::TypeBase > type)
 Dispatch according to type and create corresponding storage from the given string. More...
 
StorageBasemake_include_storage (PathBase &p, const Type::TypeBase *type)
 Create storage of included YAML or JSON input file. More...
 
bool read_bool_value (PathBase &p, const Type::TypeBase *type)
 Read boolean value from path. More...
 
std::int64_t read_int_value (PathBase &p, const Type::TypeBase *type)
 Read integer value from path. More...
 
double read_double_value (PathBase &p, const Type::TypeBase *type)
 Read double value from path. More...
 
std::string read_string_value (PathBase &p, const Type::TypeBase *type)
 Read string value from path. More...
 
std::string get_included_file (PathBase &p)
 Helper method. Get string value of included file or throw exception if reading failed. More...
 
void generate_input_error (PathBase &p, const Type::TypeBase *type, std::string spec, bool add_type)
 Generate ExcInputError. More...
 
void complete_input_error (ExcInputError &e, PathBase &p, ValueTypes value_type)
 Complete specification, error address and JSON type error tags to ExcInputError. More...
 

Detailed Description

Internal part of IST reader.

This class defines interface for creating storage. Dispatching of storage is ensured by the non-virtual method read_storage, different for individual descendants.

Definition at line 42 of file reader_internal_base.hh.

Constructor & Destructor Documentation

◆ ReaderInternalBase()

Input::ReaderInternalBase::ReaderInternalBase ( )

Constructor.

Definition at line 35 of file reader_internal_base.cc.

Member Function Documentation

◆ abstract_automatic_conversion()

StorageBase * Input::ReaderInternalBase::abstract_automatic_conversion ( PathBase p,
const Type::Abstract abstr_rec 
)
protected

Apply automatic conversion of Type::Abstract type.

Definition at line 294 of file reader_internal_base.cc.

◆ complete_input_error()

void Input::ReaderInternalBase::complete_input_error ( ExcInputError &  e,
PathBase p,
ValueTypes  value_type 
)
protected

Complete specification, error address and JSON type error tags to ExcInputError.

Definition at line 449 of file reader_internal_base.cc.

◆ DECLARE_INPUT_EXCEPTION() [1/7]

Input::ReaderInternalBase::DECLARE_INPUT_EXCEPTION ( ExcAutomaticConversionError  ,
<< "Error during automatic conversion of "<< EI_RecordName::val<< " record.\n "<< EI_InputErrorMessage::val<< "\n"   
)

◆ DECLARE_INPUT_EXCEPTION() [2/7]

Input::ReaderInternalBase::DECLARE_INPUT_EXCEPTION ( ExcDuplicitTag  ,
<< "Error in input file: "<< EI_File::qval<< " at address: "<< EI_ErrorAddress::qval<< "\n"<< "Duplicit Tag: "<< EI_Tag::qval<< "\n"   
)

◆ DECLARE_INPUT_EXCEPTION() [3/7]

Input::ReaderInternalBase::DECLARE_INPUT_EXCEPTION ( ExcForbiddenTag  ,
<< "Tag "<< EI_Tag::qval<< " "<< EI_Specification::val<< "\n"   
)

◆ DECLARE_INPUT_EXCEPTION() [4/7]

Input::ReaderInternalBase::DECLARE_INPUT_EXCEPTION ( ExcInputError  ,
<< "Error in input file: "<< EI_File::qval<< " at address: "<< EI_ErrorAddress::qval<< "\n"<< EI_Specification::val<< "\n"<< EI_Format::val<< " type: "<< EI_JSON_Type::qval<< "\n"<< "Expected type:\n"<< EI_InputType::val   
)

General exception during conversion from JSON/YAML tree to storage.

◆ DECLARE_INPUT_EXCEPTION() [5/7]

Input::ReaderInternalBase::DECLARE_INPUT_EXCEPTION ( ExcMultipleDefinitionCsvColumn  ,
<< "Multiple definition of column with index "<< EI_ColumnIndex::qval<< " in included CSV file:\n"<< EI_File::val<< "  ,
\n"   
)

◆ DECLARE_INPUT_EXCEPTION() [6/7]

Input::ReaderInternalBase::DECLARE_INPUT_EXCEPTION ( ExcNotJSONFormat  ,
<< "Not valid JSON file "<< EI_File::qval<< ". Error at line "<< EI_JSONLine::val<< " : col "<< EI_JSONColumn::val<< " ; reason: "<< EI_JSONReason::val<< "\n"   
)

◆ DECLARE_INPUT_EXCEPTION() [7/7]

Input::ReaderInternalBase::DECLARE_INPUT_EXCEPTION ( ExcWrongCsvFormat  ,
<< EI_Specification::val<< "  ,
\n"<< EI_TokenizerMsg::val<< "\n"   
)

◆ generate_input_error()

void Input::ReaderInternalBase::generate_input_error ( PathBase p,
const Type::TypeBase type,
std::string  spec,
bool  add_type 
)
protected

Generate ExcInputError.

Definition at line 439 of file reader_internal_base.cc.

Here is the caller graph for this function:

◆ get_included_file()

std::string Input::ReaderInternalBase::get_included_file ( PathBase p)
protected

Helper method. Get string value of included file or throw exception if reading failed.

Definition at line 427 of file reader_internal_base.cc.

◆ make_array_storage()

StorageBase * Input::ReaderInternalBase::make_array_storage ( PathBase p,
const Type::Array array,
int  arr_size 
)
protected

Create storage of Type::Array with given size.

Definition at line 303 of file reader_internal_base.cc.

Here is the caller graph for this function:

◆ make_include_storage()

StorageBase * Input::ReaderInternalBase::make_include_storage ( PathBase p,
const Type::TypeBase type 
)
protected

Create storage of included YAML or JSON input file.

Definition at line 346 of file reader_internal_base.cc.

◆ make_storage()

StorageBase * Input::ReaderInternalBase::make_storage ( PathBase p,
const Type::TypeBase type 
)
protected

Create storage of given type.

Check correctness of the input given by json_spirit or YAML-cpp node at head() of PathBase p against type specification type. Die on input error (and return NULL). For correct input, creates the storage tree and returns pointer to its root node.

Definition at line 38 of file reader_internal_base.cc.

Here is the caller graph for this function:

◆ make_storage_from_default()

StorageBase * Input::ReaderInternalBase::make_storage_from_default ( const string &  dflt_str,
std::shared_ptr< Type::TypeBase type 
)
protected

Dispatch according to type and create corresponding storage from the given string.

Definition at line 327 of file reader_internal_base.cc.

◆ make_sub_storage() [1/9]

StorageBase * Input::ReaderInternalBase::make_sub_storage ( PathBase p,
const Type::Abstract abstr_rec 
)
protected

Create storage of Type::Abstract type. Common method of all descendants.

Definition at line 231 of file reader_internal_base.cc.

◆ make_sub_storage() [2/9]

virtual StorageBase* Input::ReaderInternalBase::make_sub_storage ( PathBase p,
const Type::Array array 
)
protectedpure virtual

◆ make_sub_storage() [3/9]

virtual StorageBase* Input::ReaderInternalBase::make_sub_storage ( PathBase p,
const Type::Bool bool_type 
)
protectedpure virtual

◆ make_sub_storage() [4/9]

virtual StorageBase* Input::ReaderInternalBase::make_sub_storage ( PathBase p,
const Type::Double double_type 
)
protectedpure virtual

◆ make_sub_storage() [5/9]

virtual StorageBase* Input::ReaderInternalBase::make_sub_storage ( PathBase p,
const Type::Integer int_type 
)
protectedpure virtual

◆ make_sub_storage() [6/9]

StorageBase * Input::ReaderInternalBase::make_sub_storage ( PathBase p,
const Type::Record record 
)
protected

Create storage of Type::Record type. Common method of all descendants.

Definition at line 95 of file reader_internal_base.cc.

◆ make_sub_storage() [7/9]

virtual StorageBase* Input::ReaderInternalBase::make_sub_storage ( PathBase p,
const Type::Selection selection 
)
protectedpure virtual

◆ make_sub_storage() [8/9]

virtual StorageBase* Input::ReaderInternalBase::make_sub_storage ( PathBase p,
const Type::String string_type 
)
protectedpure virtual

◆ make_sub_storage() [9/9]

StorageBase * Input::ReaderInternalBase::make_sub_storage ( PathBase p,
const Type::Tuple tuple 
)
protected

Create storage of Type::Tuple type. Common method of all descendants.

Definition at line 185 of file reader_internal_base.cc.

◆ read_bool_value()

bool Input::ReaderInternalBase::read_bool_value ( PathBase p,
const Type::TypeBase type 
)
protected

Read boolean value from path.

Definition at line 368 of file reader_internal_base.cc.

Here is the caller graph for this function:

◆ read_double_value()

double Input::ReaderInternalBase::read_double_value ( PathBase p,
const Type::TypeBase type 
)
protected

Read double value from path.

Definition at line 398 of file reader_internal_base.cc.

Here is the caller graph for this function:

◆ read_int_value()

std::int64_t Input::ReaderInternalBase::read_int_value ( PathBase p,
const Type::TypeBase type 
)
protected

Read integer value from path.

Definition at line 383 of file reader_internal_base.cc.

Here is the caller graph for this function:

◆ read_string_value()

std::string Input::ReaderInternalBase::read_string_value ( PathBase p,
const Type::TypeBase type 
)
protected

Read string value from path.

Definition at line 413 of file reader_internal_base.cc.

Here is the caller graph for this function:

◆ record_automatic_conversion()

StorageBase * Input::ReaderInternalBase::record_automatic_conversion ( PathBase p,
const Type::Record record 
)
protected

Apply automatic conversion of Type::Record type.

Definition at line 260 of file reader_internal_base.cc.

◆ TYPEDEF_ERR_INFO() [1/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_ColumnIndex  ,
unsigned int   
)

◆ TYPEDEF_ERR_INFO() [2/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_ErrorAddress  ,
string   
)

◆ TYPEDEF_ERR_INFO() [3/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_File  ,
const  string 
)

◆ TYPEDEF_ERR_INFO() [4/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_Format  ,
const  string 
)

◆ TYPEDEF_ERR_INFO() [5/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_InputErrorMessage  ,
const  string 
)

◆ TYPEDEF_ERR_INFO() [6/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_InputType  ,
string   
)

◆ TYPEDEF_ERR_INFO() [7/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_JSON_Type  ,
const  string 
)

◆ TYPEDEF_ERR_INFO() [8/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_JSONColumn  ,
unsigned int   
)

◆ TYPEDEF_ERR_INFO() [9/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_JSONLine  ,
unsigned int   
)

◆ TYPEDEF_ERR_INFO() [10/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_JSONReason  ,
string   
)

◆ TYPEDEF_ERR_INFO() [11/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_RecordName  ,
const  string 
)

◆ TYPEDEF_ERR_INFO() [12/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_Specification  ,
const  string 
)

◆ TYPEDEF_ERR_INFO() [13/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_Tag  ,
string   
)

◆ TYPEDEF_ERR_INFO() [14/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_TokenizerMsg  ,
std::string   
)

◆ TYPEDEF_ERR_INFO() [15/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_TransposeAddress  ,
string   
)

◆ TYPEDEF_ERR_INFO() [16/16]

Input::ReaderInternalBase::TYPEDEF_ERR_INFO ( EI_TransposeIndex  ,
unsigned int   
)

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