LArSoft
v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
|
#include "LArFormattingHelper.h"
Public Member Functions | |
Table (const pandora::StringVector &columnTitles, const unsigned int precision=3) | |
Table constructor. More... | |
void | Print () const |
Print the table. More... | |
template<typename T > | |
void | AddElement (const T &value, const Style style=REGULAR, const Color color=DEFAULT) |
Add an element to the table into the next (non-separator) column. More... | |
Private Member Functions | |
bool | IsSeparatorColumn (const unsigned int column) const |
If the supplied column is a separator (vertical rule) More... | |
void | PrintColumnTitles () const |
Print the column titles. More... | |
void | PrintHorizontalLine () const |
Print a horizontal line. More... | |
void | PrintTableElements () const |
Print the table elements. More... | |
void | PrintTableCell (const std::string &value, const std::string &format, const unsigned int index) const |
Print a table cell. More... | |
void | CheckAndSetSeparatorColumn () |
Check if the next table cell is in a separator column, if so add a blank element. More... | |
void | UpdateColumnWidth () |
Update the width of the last column in which an element was added. More... | |
Private Attributes | |
const pandora::StringVector | m_columnTitles |
The vector of columns titles in the table. More... | |
const unsigned int | m_precision |
The number of significant figures to use when displaying number types. More... | |
pandora::StringVector | m_elements |
The vector of flattened table elements. More... | |
pandora::StringVector | m_format |
The formatting of each table element. More... | |
std::vector< unsigned int > | m_widths |
The widths of each column (in units of number of characters) More... | |
std::stringstream | m_stringstream |
The stringstream to print objects to. More... | |
Table class.
Definition at line 128 of file LArFormattingHelper.h.
lar_content::LArFormattingHelper::Table::Table | ( | const pandora::StringVector & | columnTitles, |
const unsigned int | precision = 3 |
||
) |
Table constructor.
columnTitles | the string columns titles use empty string for a separator column |
precision | the number of significant figures to display for number type table elements |
Definition at line 88 of file LArFormattingHelper.cc.
References m_columnTitles, m_precision, m_stringstream, and m_widths.
|
inline |
Add an element to the table into the next (non-separator) column.
value | the element to add to the table |
style | the style of the element |
color | the color of the element |
Definition at line 217 of file LArFormattingHelper.h.
References CheckAndSetSeparatorColumn(), lar_content::LArFormattingHelper::GetFormatCharacter(), m_elements, m_format, m_stringstream, and UpdateColumnWidth().
Referenced by lar_content::LArMonitoringHelper::PrintMatchingTable().
|
private |
Check if the next table cell is in a separator column, if so add a blank element.
Definition at line 100 of file LArFormattingHelper.cc.
References m_columnTitles, m_elements, and m_format.
Referenced by AddElement().
|
private |
If the supplied column is a separator (vertical rule)
column | the column index to check |
Definition at line 111 of file LArFormattingHelper.cc.
References m_columnTitles.
Referenced by PrintTableCell().
void lar_content::LArFormattingHelper::Table::Print | ( | ) | const |
Print the table.
Definition at line 133 of file LArFormattingHelper.cc.
References m_columnTitles, PrintColumnTitles(), PrintHorizontalLine(), and PrintTableElements().
Referenced by lar_content::LArMonitoringHelper::PrintMatchingTable().
|
private |
Print the column titles.
widths | a vector of the number of characters to include in each column |
Definition at line 145 of file LArFormattingHelper.cc.
References lar_content::LArFormattingHelper::BOLD, lar_content::LArFormattingHelper::GetFormatCharacter(), m_columnTitles, and PrintTableCell().
Referenced by Print().
|
private |
Print a horizontal line.
widths | a vector of the number of characters to include in each column |
Definition at line 153 of file LArFormattingHelper.cc.
References lar_content::LArFormattingHelper::GetFormatCharacter(), m_columnTitles, m_widths, PrintTableCell(), and lar_content::LArFormattingHelper::REGULAR.
Referenced by Print().
|
private |
Print a table cell.
value | the string to print in the cell |
format | a formatting string (see GetFormatCharacter(...)) |
index | the index of the table cell (0 –> number of elements) used to find the column |
widths | a vector of the number of characters to include in each column |
Definition at line 180 of file LArFormattingHelper.cc.
References IsSeparatorColumn(), m_columnTitles, m_widths, and lar_content::LArFormattingHelper::ResetStyle().
Referenced by PrintColumnTitles(), PrintHorizontalLine(), and PrintTableElements().
|
private |
Print the table elements.
widths | a vector of the number of characters to include in each column |
Definition at line 161 of file LArFormattingHelper.cc.
References m_columnTitles, m_elements, m_format, and PrintTableCell().
Referenced by Print().
|
private |
Update the width of the last column in which an element was added.
Definition at line 121 of file LArFormattingHelper.cc.
References m_elements, m_widths, and max.
Referenced by AddElement().
|
private |
The vector of columns titles in the table.
Definition at line 205 of file LArFormattingHelper.h.
Referenced by CheckAndSetSeparatorColumn(), IsSeparatorColumn(), Print(), PrintColumnTitles(), PrintHorizontalLine(), PrintTableCell(), PrintTableElements(), and Table().
|
private |
The vector of flattened table elements.
Definition at line 207 of file LArFormattingHelper.h.
Referenced by AddElement(), CheckAndSetSeparatorColumn(), PrintTableElements(), and UpdateColumnWidth().
|
private |
The formatting of each table element.
Definition at line 208 of file LArFormattingHelper.h.
Referenced by AddElement(), CheckAndSetSeparatorColumn(), and PrintTableElements().
|
private |
The number of significant figures to use when displaying number types.
Definition at line 206 of file LArFormattingHelper.h.
Referenced by Table().
|
private |
The stringstream to print objects to.
Definition at line 210 of file LArFormattingHelper.h.
Referenced by AddElement(), and Table().
|
private |
The widths of each column (in units of number of characters)
Definition at line 209 of file LArFormattingHelper.h.
Referenced by PrintHorizontalLine(), PrintTableCell(), Table(), and UpdateColumnWidth().