User Guide
nmodl::utils::TableData Class Reference

Class to construct and pretty-print tabular data. More...

Detailed Description

Class to construct and pretty-print tabular data.

This class is used to construct and print tables (like nmodl::symtab::SymbolTable and performance tables).

Definition at line 36 of file table_data.hpp.

#include <table_data.hpp>

Public Types

using TableRowType = std::vector< std::string >
 

Public Member Functions

void print (int indent=0) const
 
void print (std::ostream &stream, int indent=0) const
 Print table data in below shown format: title as first row (centrally aligned), second row is header for individual column (centrally aligned) and then all data rows (with associated alignments). More...
 

Public Attributes

std::string title
 title of the table More...
 
TableRowType headers
 top header/keys More...
 
std::vector< TableRowTyperows
 data More...
 
std::vector< stringutils::text_alignmentalignments
 alignment for every column of data rows More...
 

Member Typedef Documentation

◆ TableRowType

using nmodl::utils::TableData::TableRowType = std::vector<std::string>

Definition at line 37 of file table_data.hpp.

Member Function Documentation

◆ print() [1/2]

void nmodl::utils::TableData::print ( int  indent = 0) const

Definition at line 127 of file table_data.cpp.

◆ print() [2/2]

void nmodl::utils::TableData::print ( std::ostream &  stream,
int  indent = 0 
) const

Print table data in below shown format: title as first row (centrally aligned), second row is header for individual column (centrally aligned) and then all data rows (with associated alignments).


| mBetaf [FunctionBlock IN NMODL_GLOBAL] POSITION : 109.1-8 SCOPE : LOCAL |

| NAME | PROPERTIES | LOCATION | # READS | # WRITES |

| v | argument | 109.17 | 0 | 0 |

not necessary to print empty table

based on indentation level, spaces to prefix

alignment is optional, so fill remaining with right alignment

calculate space required for each column

if title is larger than headers then every column width needs to be scaled

check length of columns in each row to find max length required

title row

header row

data rows

bottom separator line

Definition at line 32 of file table_data.cpp.

Member Data Documentation

◆ alignments

std::vector<stringutils::text_alignment> nmodl::utils::TableData::alignments

alignment for every column of data rows

Definition at line 49 of file table_data.hpp.

◆ headers

TableRowType nmodl::utils::TableData::headers

top header/keys

Definition at line 43 of file table_data.hpp.

◆ rows

std::vector<TableRowType> nmodl::utils::TableData::rows

data

Definition at line 46 of file table_data.hpp.

◆ title

std::string nmodl::utils::TableData::title

title of the table

Definition at line 40 of file table_data.hpp.


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