PandA-2024.02
Public Member Functions | Private Member Functions | Private Attributes
IndentedOutputStream Class Reference

Class to print indented code. More...

#include <indented_output_stream.hpp>

Public Member Functions

 IndentedOutputStream (char o='{', char c='}', unsigned int d=3)
 constructor More...
 
 ~IndentedOutputStream ()
 destructor More...
 
void Append (const std::string &str)
 Append a string to the output. More...
 
void AppendIndented (const std::string &str)
 Append a pre-indented string to the output. More...
 
void Indent ()
 Manually increase the indenting of the code. More...
 
void Deindent ()
 Manually reduce the indenting of the code. More...
 
const std::string WriteString ()
 Write the indented output on a string. More...
 
void WriteFile (const std::string &file_name)
 Write the indented output on a file. More...
 

Private Member Functions

void AppendIndent ()
 Append the indent spaces. More...
 
void AppendChar (const char &c)
 Append the current char. More...
 

Private Attributes

std::ostringstream output_stream
 The actual stream. More...
 
unsigned int indent_spaces
 number of spaces used to indent after a new line print More...
 
char opening_char
 char that increments the indent space by a delta More...
 
char closing_char
 char that increments the indent space by a delta More...
 
unsigned int delta
 delta indent space More...
 
bool is_line_start
 

Detailed Description

Class to print indented code.

Definition at line 63 of file indented_output_stream.hpp.

Constructor & Destructor Documentation

◆ IndentedOutputStream()

IndentedOutputStream::IndentedOutputStream ( char  o = '{',
char  c = '}',
unsigned int  d = 3 
)

constructor

Parameters
ois the opening character used by simple_indent.
cis the closing character used by simple_indent.
dis the number of characters used to indent the code.

Definition at line 54 of file indented_output_stream.cpp.

◆ ~IndentedOutputStream()

IndentedOutputStream::~IndentedOutputStream ( )

destructor

This corresponds to a THROW_ASSERT, however it is against C++ rules throw an error inside a destructor

Definition at line 59 of file indented_output_stream.cpp.

References indent_spaces, and indentation.

Member Function Documentation

◆ Append()

void IndentedOutputStream::Append ( const std::string &  str)

Append a string to the output.

Parameters
stris the string to be printed

Specified whether the first character of the string we are going to write must be indented or not

Definition at line 70 of file indented_output_stream.cpp.

References AppendChar(), AppendIndent(), closing_char, Deindent(), delta, indent_spaces, is_line_start, opening_char, output_stream, STD_CLOSING_CHAR, STD_OPENING_CHAR, THROW_UNREACHABLE, and WriteFile().

Referenced by CWriter::compute_phi_nodes(), CreateAddressTranslation::ComputeAddress(), HLSInstructionWriter::declareFunction(), InstructionWriter::declareFunction(), DiscrepancyAnalysisCWriter::DeclareLocalVariables(), CWriter::DeclareType(), CWriter::DeclareVariable(), CWriter::EndFunctionBody(), CreateAddressTranslation::Exec(), CBackend::Exec(), MemoryInitializationCWriter::FinalizeFileInit(), BasicBlocksProfilingCWriter::print_edge(), MemoryInitializationCWriter::Process(), CWriter::StartFunctionBody(), InstructionWriter::write(), language_writer::write(), verilog_writer::write_assign(), verilog_writer::write_comment(), VHDL_writer::write_comment(), VHDL_writer::write_component_declaration(), verilog_writer::write_header(), VHDL_writer::write_header(), VHDL_writer::write_io_signal_post_fix(), verilog_writer::write_io_signal_post_fix(), VHDL_writer::write_io_signal_post_fix_vector(), verilog_writer::write_io_signal_post_fix_vector(), VHDL_writer::write_library_declaration(), verilog_writer::write_library_declaration(), VHDL_writer::write_module_declaration(), verilog_writer::write_module_declaration(), VHDL_writer::write_module_definition_begin(), verilog_writer::write_module_definition_begin(), VHDL_writer::write_module_definition_end(), verilog_writer::write_module_definition_end(), VHDL_writer::write_module_instance_begin(), verilog_writer::write_module_instance_begin(), VHDL_writer::write_module_instance_end(), verilog_writer::write_module_instance_end(), VHDL_writer::write_module_internal_declaration(), VHDL_writer::write_module_parametrization(), verilog_writer::write_module_parametrization(), VHDL_writer::write_module_parametrization_decl(), verilog_writer::write_module_parametrization_decl(), system_verilog_writer::write_NP_functionalities(), VHDL_writer::write_NP_functionalities(), verilog_writer::write_NP_functionalities(), VHDL_writer::write_port_binding(), verilog_writer::write_port_binding(), VHDL_writer::write_port_decl_header(), VHDL_writer::write_port_decl_tail(), VHDL_writer::write_port_declaration(), verilog_writer::write_port_declaration(), VHDL_writer::write_present_state_update(), verilog_writer::write_present_state_update(), VHDL_writer::write_signal_declaration(), verilog_writer::write_signal_declaration(), VHDL_writer::write_state_declaration(), verilog_writer::write_state_declaration(), VHDL_writer::write_transition_output_functions(), verilog_writer::write_transition_output_functions(), VHDL_writer::write_vector_port_binding(), verilog_writer::write_vector_port_binding(), DiscrepancyAnalysisCWriter::WriteBBHeader(), VHDL_writer::WriteBuiltin(), verilog_writer::WriteBuiltin(), CWriter::WriteBuiltinWaitCall(), InstructionWriter::WriteComment(), DiscrepancyAnalysisCWriter::WriteExtraCodeBeforeEveryMainCall(), DiscrepancyAnalysisCWriter::WriteExtraInitCode(), CWriter::WriteFunctionDeclaration(), DiscrepancyAnalysisCWriter::WriteGlobalDeclarations(), BasicBlocksProfilingCWriter::WriteGlobalDeclarations(), CBackend::WriteGlobalDeclarations(), CWriter::WriteGlobalDeclarations(), CWriter::WriteHashTableImplementation(), HLSCWriter::WriteHeader(), EdgeCWriter::WriteHeader(), CWriter::WriteHeader(), CWriter::writeInclude(), HLSCWriter::WriteMainTestbench(), DiscrepancyAnalysisCWriter::WriteMainTestbench(), HLSCWriter::WriteParamDecl(), HLSCWriter::WriteParamInitialization(), DiscrepancyAnalysisCWriter::writePostInstructionInfo(), DiscrepancyAnalysisCWriter::writePreInstructionInfo(), EdgeCWriter::writeRoutineInstructions(), CWriter::writeRoutineInstructions(), EdgeCWriter::writeRoutineInstructions_rec(), CWriter::writeRoutineInstructions_rec(), HLSCWriter::WriteSimulatorInitMemory(), HLSCWriter::WriteTestbenchFunctionCall(), and DiscrepancyAnalysisCWriter::WriteTestbenchHelperFunctions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppendChar()

void IndentedOutputStream::AppendChar ( const char &  c)
private

Append the current char.

Definition at line 160 of file indented_output_stream.cpp.

References output_stream.

Referenced by Append().

Here is the caller graph for this function:

◆ AppendIndent()

void IndentedOutputStream::AppendIndent ( )
private

Append the indent spaces.

Definition at line 152 of file indented_output_stream.cpp.

References indent_spaces, and output_stream.

Referenced by Append().

Here is the caller graph for this function:

◆ AppendIndented()

void IndentedOutputStream::AppendIndented ( const std::string &  str)

Append a pre-indented string to the output.

Parameters
stris the string to be printed

Definition at line 147 of file indented_output_stream.cpp.

References output_stream, and str.

Referenced by HLSCWriter::WriteMainTestbench().

Here is the caller graph for this function:

◆ Deindent()

void IndentedOutputStream::Deindent ( )

◆ Indent()

void IndentedOutputStream::Indent ( )

◆ WriteFile()

void IndentedOutputStream::WriteFile ( const std::string &  file_name)

Write the indented output on a file.

Parameters
file_nameis the name of the file

Definition at line 183 of file indented_output_stream.cpp.

References output_stream.

Referenced by Append(), CreateAddressTranslation::Exec(), HLSCWriter::WriteFile(), language_writer::WriteFile(), and CWriter::WriteFile().

Here is the caller graph for this function:

◆ WriteString()

const std::string IndentedOutputStream::WriteString ( )

Write the indented output on a string.

Definition at line 176 of file indented_output_stream.cpp.

References output_stream.

Referenced by language_writer::WriteString().

Here is the caller graph for this function:

Field Documentation

◆ closing_char

char IndentedOutputStream::closing_char
private

char that increments the indent space by a delta

Definition at line 76 of file indented_output_stream.hpp.

Referenced by Append().

◆ delta

unsigned int IndentedOutputStream::delta
private

delta indent space

Definition at line 79 of file indented_output_stream.hpp.

Referenced by Append(), Deindent(), and Indent().

◆ indent_spaces

unsigned int IndentedOutputStream::indent_spaces
private

number of spaces used to indent after a new line print

Definition at line 70 of file indented_output_stream.hpp.

Referenced by Append(), AppendIndent(), Deindent(), Indent(), and ~IndentedOutputStream().

◆ is_line_start

bool IndentedOutputStream::is_line_start
private

Definition at line 81 of file indented_output_stream.hpp.

Referenced by Append().

◆ opening_char

char IndentedOutputStream::opening_char
private

char that increments the indent space by a delta

Definition at line 73 of file indented_output_stream.hpp.

Referenced by Append().

◆ output_stream

std::ostringstream IndentedOutputStream::output_stream
private

The actual stream.

Definition at line 67 of file indented_output_stream.hpp.

Referenced by Append(), AppendChar(), AppendIndent(), AppendIndented(), WriteFile(), and WriteString().


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

Generated on Mon Feb 12 2024 13:03:55 for PandA-2024.02 by doxygen 1.8.13