Flow123d  JS_before_hm-1788-g649f0a9d1
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Input::Type::OutputBase Class Referenceabstract

Base abstract class for output description of the Input::Type tree. More...

#include <type_output.hh>

Inheritance diagram for Input::Type::OutputBase:
Inheritance graph
[legend]

Public Member Functions

virtual ostream & print (ostream &stream)=0
 Performs output of the documentation into given stream. More...
 

Protected Types

enum  DocumentationType { key_record, full_record }
 Types of documentation output. More...
 

Protected Member Functions

 OutputBase ()
 Constructor. More...
 
virtual ~OutputBase ()
 Destructor. More...
 
void get_array_sizes (Array array, unsigned int &lower, unsigned int &upper)
 Gets range of array. More...
 
const string & get_record_description (const Record *rec)
 Gets description of the given record type. More...
 
const string & get_abstract_description (const Abstract *a_rec)
 Gets description of the given abstract type. More...
 
void get_integer_bounds (Integer integer, int &lower, int &upper)
 Gets range of integer. More...
 
void get_double_bounds (Double dbl, double &lower, double &upper)
 Gets range of double. More...
 
void get_parent_vec (Record rec, std::vector< std::shared_ptr< Abstract > > &parent_vec)
 Gets pointer of parent Abstract for given Record. More...
 
void get_array_type (Array array, std::shared_ptr< TypeBase > &arr_type)
 Gets pointer of inner type for given Array. More...
 
void get_default (Record::KeyIter it, string &type, string &value)
 Gets values of default for given record key. More...
 
const string & get_selection_description (const Selection *sel)
 Gets description of the given selection type. More...
 
void get_adhoc_parent_name (const AdHocAbstract *a_rec, string &parent_name)
 Gets ancestor_.type_name of the given AdHocAbstract type. More...
 
Abstract::ChildDataIter get_adhoc_parent_data (const AdHocAbstract *a_rec)
 Gets iterator to begin of ancestor_.child_data_ of the given AdHocAbstract type. More...
 
void get_attr_and_param_data (const TypeBase *type, TypeBase::attribute_map &attr_map, TypeBase::TypeHash &generic_type_hash, TypeBase::json_string &parameter_map_to_json)
 Gets data of attributes and parameters of the given type. More...
 
template<class T >
void print_generic (ostream &stream, const TypeBase *type)
 
void print_base (ostream &stream, const TypeBase *type)
 Perform resolution according to actual type (using typeid) and call particular print_impl method. More...
 
virtual void print_impl (ostream &stream, const Record *type)=0
 Implements printout of Record type. More...
 
virtual void print_impl (ostream &stream, const Array *type)=0
 Implements printout of Array type. More...
 
virtual void print_impl (ostream &stream, const Abstract *type)=0
 Implements printout of Abstract type. More...
 
virtual void print_impl (ostream &stream, const AdHocAbstract *type)=0
 Implements printout of AdHocAbstract type. More...
 
virtual void print_impl (ostream &stream, const Selection *type)=0
 Implements printout of Selection type. More...
 
virtual void print_impl (ostream &stream, const Integer *type)=0
 Implements printout of Integer type. More...
 
virtual void print_impl (ostream &stream, const Double *type)=0
 Implements printout of Double type. More...
 
virtual void print_impl (ostream &stream, const Bool *type)=0
 Implements printout of Bool type. More...
 
virtual void print_impl (ostream &stream, const String *type)=0
 Implements printout of String type. More...
 
virtual void print_impl (ostream &stream, const FileName *type)=0
 Implements printout of FileName type. More...
 
virtual void print_impl (ostream &stream, const Parameter *type)=0
 Implements printout of FileName type. More...
 
void write_description (std::ostream &stream, const string &str, unsigned int padding, unsigned int hash_count=1)
 Write out a string with given padding of every new line. More...
 
void write_default_value (std::ostream &stream, Default dft)
 Write value stored in dft. More...
 
void clear_processed_types ()
 Clear all data of processed types. More...
 
bool was_written (std::size_t hash)
 Returns true if the type was printed out. More...
 

Protected Attributes

DocumentationType doc_type_
 Type of documentation output. More...
 
unsigned int size_setw_
 temporary value for printout of description (used in std::setw function) More...
 
std::set< std::size_t > processed_types_hash_
 Set of hashes of outputed types. Should replace keys. More...
 
TypeBase::TypeHash full_hash_
 Content hash of full IST, value is used for key IST_hash. More...
 

Static Protected Attributes

static const unsigned int padding_size = 4
 Padding of new level of printout, used where we use indentation. More...
 

Detailed Description

Base abstract class for output description of the Input::Type tree.

Output into various formats is implemented by derived classes:

Usage example:

cout << OutputText( &my_record) << endl;

Definition at line 65 of file type_output.hh.

Member Enumeration Documentation

◆ DocumentationType

Types of documentation output.

Used in print_impl methods for basic and full printout of Input::Type

Enumerator
key_record 

Printout only basic data.

full_record 

Printout full documentation.

Definition at line 82 of file type_output.hh.

Constructor & Destructor Documentation

◆ OutputBase()

Input::Type::OutputBase::OutputBase ( )
protected

Constructor.

Definition at line 48 of file type_output.cc.

◆ ~OutputBase()

Input::Type::OutputBase::~OutputBase ( )
protectedvirtual

Destructor.

Definition at line 44 of file type_output.cc.

Member Function Documentation

◆ clear_processed_types()

void Input::Type::OutputBase::clear_processed_types ( )
protected

Clear all data of processed types.

Definition at line 213 of file type_output.cc.

Here is the caller graph for this function:

◆ get_abstract_description()

const string & Input::Type::OutputBase::get_abstract_description ( const Abstract a_rec)
protected

Gets description of the given abstract type.

Definition at line 86 of file type_output.cc.

Here is the caller graph for this function:

◆ get_adhoc_parent_data()

Abstract::ChildDataIter Input::Type::OutputBase::get_adhoc_parent_data ( const AdHocAbstract a_rec)
protected

Gets iterator to begin of ancestor_.child_data_ of the given AdHocAbstract type.

Definition at line 123 of file type_output.cc.

◆ get_adhoc_parent_name()

void Input::Type::OutputBase::get_adhoc_parent_name ( const AdHocAbstract a_rec,
string &  parent_name 
)
protected

Gets ancestor_.type_name of the given AdHocAbstract type.

Definition at line 118 of file type_output.cc.

Here is the caller graph for this function:

◆ get_array_sizes()

void Input::Type::OutputBase::get_array_sizes ( Array  array,
unsigned int &  lower,
unsigned int &  upper 
)
protected

Gets range of array.

Definition at line 67 of file type_output.cc.

Here is the caller graph for this function:

◆ get_array_type()

void Input::Type::OutputBase::get_array_type ( Array  array,
std::shared_ptr< TypeBase > &  arr_type 
)
protected

Gets pointer of inner type for given Array.

Definition at line 74 of file type_output.cc.

Here is the caller graph for this function:

◆ get_attr_and_param_data()

void Input::Type::OutputBase::get_attr_and_param_data ( const TypeBase type,
TypeBase::attribute_map attr_map,
TypeBase::TypeHash generic_type_hash,
TypeBase::json_string parameter_map_to_json 
)
protected

Gets data of attributes and parameters of the given type.

Definition at line 226 of file type_output.cc.

Here is the caller graph for this function:

◆ get_default()

void Input::Type::OutputBase::get_default ( Record::KeyIter  it,
string &  type,
string &  value 
)
protected

Gets values of default for given record key.

Definition at line 98 of file type_output.cc.

Here is the caller graph for this function:

◆ get_double_bounds()

void Input::Type::OutputBase::get_double_bounds ( Double  dbl,
double &  lower,
double &  upper 
)
protected

Gets range of double.

Definition at line 60 of file type_output.cc.

Here is the caller graph for this function:

◆ get_integer_bounds()

void Input::Type::OutputBase::get_integer_bounds ( Integer  integer,
int &  lower,
int &  upper 
)
protected

Gets range of integer.

Definition at line 53 of file type_output.cc.

Here is the caller graph for this function:

◆ get_parent_vec()

void Input::Type::OutputBase::get_parent_vec ( Record  rec,
std::vector< std::shared_ptr< Abstract > > &  parent_vec 
)
protected

Gets pointer of parent Abstract for given Record.

Definition at line 92 of file type_output.cc.

Here is the caller graph for this function:

◆ get_record_description()

const string & Input::Type::OutputBase::get_record_description ( const Record rec)
protected

Gets description of the given record type.

Definition at line 80 of file type_output.cc.

Here is the caller graph for this function:

◆ get_selection_description()

const string & Input::Type::OutputBase::get_selection_description ( const Selection sel)
protected

Gets description of the given selection type.

Definition at line 113 of file type_output.cc.

Here is the caller graph for this function:

◆ print()

virtual ostream& Input::Type::OutputBase::print ( ostream &  stream)
pure virtual

Performs output of the documentation into given stream.

The same effect has the reloaded operator '<<'. Returns reference to the same stream.

Implemented in Input::Type::OutputJSONMachine, and Input::Type::OutputText.

◆ print_base()

void Input::Type::OutputBase::print_base ( ostream &  stream,
const TypeBase type 
)
protected

Perform resolution according to actual type (using typeid) and call particular print_impl method.

Definition at line 136 of file type_output.cc.

Here is the caller graph for this function:

◆ print_generic()

template<class T >
void Input::Type::OutputBase::print_generic ( ostream &  stream,
const TypeBase type 
)
protected

Definition at line 128 of file type_output.cc.

◆ print_impl() [1/11]

virtual void Input::Type::OutputBase::print_impl ( ostream &  stream,
const Abstract type 
)
protectedpure virtual

Implements printout of Abstract type.

Implemented in Input::Type::OutputJSONMachine, and Input::Type::OutputText.

◆ print_impl() [2/11]

virtual void Input::Type::OutputBase::print_impl ( ostream &  stream,
const AdHocAbstract type 
)
protectedpure virtual

Implements printout of AdHocAbstract type.

Implemented in Input::Type::OutputJSONMachine, and Input::Type::OutputText.

◆ print_impl() [3/11]

virtual void Input::Type::OutputBase::print_impl ( ostream &  stream,
const Array type 
)
protectedpure virtual

Implements printout of Array type.

Implemented in Input::Type::OutputJSONMachine, and Input::Type::OutputText.

◆ print_impl() [4/11]

virtual void Input::Type::OutputBase::print_impl ( ostream &  stream,
const Bool type 
)
protectedpure virtual

Implements printout of Bool type.

Implemented in Input::Type::OutputJSONMachine, and Input::Type::OutputText.

◆ print_impl() [5/11]

virtual void Input::Type::OutputBase::print_impl ( ostream &  stream,
const Double type 
)
protectedpure virtual

Implements printout of Double type.

Implemented in Input::Type::OutputJSONMachine, and Input::Type::OutputText.

◆ print_impl() [6/11]

virtual void Input::Type::OutputBase::print_impl ( ostream &  stream,
const FileName type 
)
protectedpure virtual

Implements printout of FileName type.

Implemented in Input::Type::OutputJSONMachine, and Input::Type::OutputText.

◆ print_impl() [7/11]

virtual void Input::Type::OutputBase::print_impl ( ostream &  stream,
const Integer type 
)
protectedpure virtual

Implements printout of Integer type.

Implemented in Input::Type::OutputJSONMachine, and Input::Type::OutputText.

◆ print_impl() [8/11]

virtual void Input::Type::OutputBase::print_impl ( ostream &  stream,
const Parameter type 
)
protectedpure virtual

Implements printout of FileName type.

Implemented in Input::Type::OutputJSONMachine, and Input::Type::OutputText.

◆ print_impl() [9/11]

virtual void Input::Type::OutputBase::print_impl ( ostream &  stream,
const Record type 
)
protectedpure virtual

Implements printout of Record type.

Implemented in Input::Type::OutputJSONMachine, and Input::Type::OutputText.

◆ print_impl() [10/11]

virtual void Input::Type::OutputBase::print_impl ( ostream &  stream,
const Selection type 
)
protectedpure virtual

Implements printout of Selection type.

Implemented in Input::Type::OutputJSONMachine, and Input::Type::OutputText.

◆ print_impl() [11/11]

virtual void Input::Type::OutputBase::print_impl ( ostream &  stream,
const String type 
)
protectedpure virtual

Implements printout of String type.

Implemented in Input::Type::OutputJSONMachine, and Input::Type::OutputText.

◆ was_written()

bool Input::Type::OutputBase::was_written ( std::size_t  hash)
protected

Returns true if the type was printed out.

Checks if the processed_types_hash_ contains hash of given type.

Definition at line 219 of file type_output.cc.

Here is the caller graph for this function:

◆ write_default_value()

void Input::Type::OutputBase::write_default_value ( std::ostream &  stream,
Default  dft 
)
protected

Write value stored in dft.

Enclose value in quotes if it's needed or write info that value is optional or obligatory.

Definition at line 188 of file type_output.cc.

◆ write_description()

void Input::Type::OutputBase::write_description ( std::ostream &  stream,
const string &  str,
unsigned int  padding,
unsigned int  hash_count = 1 
)
protected

Write out a string with given padding of every new line.

Parameters
streamOutput stream
strPrinted description
paddingNumber of spaces added from left
hash_countCount of '#' chars in description

Definition at line 196 of file type_output.cc.

Member Data Documentation

◆ doc_type_

DocumentationType Input::Type::OutputBase::doc_type_
protected

Type of documentation output.

Definition at line 182 of file type_output.hh.

◆ full_hash_

TypeBase::TypeHash Input::Type::OutputBase::full_hash_
protected

Content hash of full IST, value is used for key IST_hash.

Definition at line 189 of file type_output.hh.

◆ padding_size

const unsigned int Input::Type::OutputBase::padding_size = 4
staticprotected

Padding of new level of printout, used where we use indentation.

Definition at line 180 of file type_output.hh.

◆ processed_types_hash_

std::set<std::size_t> Input::Type::OutputBase::processed_types_hash_
protected

Set of hashes of outputed types. Should replace keys.

Definition at line 187 of file type_output.hh.

◆ size_setw_

unsigned int Input::Type::OutputBase::size_setw_
protected

temporary value for printout of description (used in std::setw function)

Definition at line 184 of file type_output.hh.


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