Table class.
More...
#include <LArFormattingHelper.h>
|
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.
- Parameters
-
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.
Math::BigFloat precision(-16)
std::stringstream m_stringstream
The stringstream to print objects to.
const unsigned int m_precision
The number of significant figures to use when displaying number types.
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
std::vector< unsigned int > m_widths
The widths of each column (in units of number of characters)
template<typename T >
void lar_content::LArFormattingHelper::Table::AddElement |
( |
const T & |
value, |
|
|
const Style |
style = REGULAR , |
|
|
const Color |
color = DEFAULT |
|
) |
| |
|
inline |
Add an element to the table into the next (non-separator) column.
- Parameters
-
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.
222 throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);
pandora::StringVector m_format
The formatting of each table element.
static std::string GetFormatCharacter(const unsigned int code)
Get a formatting character.
std::stringstream m_stringstream
The stringstream to print objects to.
pandora::StringVector m_elements
The vector of flattened table elements.
void CheckAndSetSeparatorColumn()
Check if the next table cell is in a separator column, if so add a blank element. ...
void UpdateColumnWidth()
Update the width of the last column in which an element was added.
void lar_content::LArFormattingHelper::Table::CheckAndSetSeparatorColumn |
( |
| ) |
|
|
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.
pandora::StringVector m_format
The formatting of each table element.
pandora::StringVector m_elements
The vector of flattened table elements.
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
bool lar_content::LArFormattingHelper::Table::IsSeparatorColumn |
( |
const unsigned int |
column | ) |
const |
|
private |
If the supplied column is a separator (vertical rule)
- Parameters
-
column | the column index to check |
- Returns
- true/false
Definition at line 111 of file LArFormattingHelper.cc.
114 throw StatusCodeException(STATUS_CODE_OUT_OF_RANGE);
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
void lar_content::LArFormattingHelper::Table::Print |
( |
| ) |
const |
Print the table.
Definition at line 133 of file LArFormattingHelper.cc.
void PrintTableElements() const
Print the table elements.
void PrintHorizontalLine() const
Print a horizontal line.
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
void PrintColumnTitles() const
Print the column titles.
void lar_content::LArFormattingHelper::Table::PrintColumnTitles |
( |
| ) |
const |
|
private |
Print the column titles.
- Parameters
-
widths | a vector of the number of characters to include in each column |
Definition at line 145 of file LArFormattingHelper.cc.
147 for (
unsigned int i = 0, nColumns =
m_columnTitles.size(); i < nColumns; ++i)
void PrintTableCell(const std::string &value, const std::string &format, const unsigned int index) const
Print a table cell.
static std::string GetFormatCharacter(const unsigned int code)
Get a formatting character.
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
void lar_content::LArFormattingHelper::Table::PrintHorizontalLine |
( |
| ) |
const |
|
private |
Print a horizontal line.
- Parameters
-
widths | a vector of the number of characters to include in each column |
Definition at line 153 of file LArFormattingHelper.cc.
155 for (
unsigned int i = 0, nColumns =
m_columnTitles.size(); i < nColumns; ++i)
void PrintTableCell(const std::string &value, const std::string &format, const unsigned int index) const
Print a table cell.
static std::string GetFormatCharacter(const unsigned int code)
Get a formatting character.
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
std::vector< unsigned int > m_widths
The widths of each column (in units of number of characters)
void lar_content::LArFormattingHelper::Table::PrintTableCell |
( |
const std::string & |
value, |
|
|
const std::string & |
format, |
|
|
const unsigned int |
index |
|
) |
| const |
|
private |
Print a table cell.
- Parameters
-
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.
185 const unsigned int column(index %
m_widths.size());
189 << std::resetiosflags(std::ios::adjustfield);
static std::string format(PyObject *obj, unsigned int pos, unsigned int indent, unsigned int maxlen, unsigned int depth)
bool IsSeparatorColumn(const unsigned int column) const
If the supplied column is a separator (vertical rule)
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
std::vector< unsigned int > m_widths
The widths of each column (in units of number of characters)
static void ResetStyle(std::ostream &stream=std::cout)
Reset the style of the standard output stream.
BEGIN_PROLOG could also be cout
void lar_content::LArFormattingHelper::Table::PrintTableElements |
( |
| ) |
const |
|
private |
Print the table elements.
- Parameters
-
widths | a vector of the number of characters to include in each column |
Definition at line 161 of file LArFormattingHelper.cc.
170 std::cout <<
"LArFormattingHelper::Table::PrintTableElements - Error: Number of table elements added doesn't fill a whole row" << std::endl;
171 throw StatusCodeException(STATUS_CODE_OUT_OF_RANGE);
174 for (
unsigned int i = 0; i < nRows * nColumns; i++)
void PrintTableCell(const std::string &value, const std::string &format, const unsigned int index) const
Print a table cell.
pandora::StringVector m_format
The formatting of each table element.
pandora::StringVector m_elements
The vector of flattened table elements.
const pandora::StringVector m_columnTitles
The vector of columns titles in the table.
BEGIN_PROLOG could also be cout
void lar_content::LArFormattingHelper::Table::UpdateColumnWidth |
( |
| ) |
|
|
private |
Update the width of the last column in which an element was added.
Definition at line 121 of file LArFormattingHelper.cc.
124 throw StatusCodeException(STATUS_CODE_OUT_OF_RANGE);
126 const unsigned int currentElementIndex(
m_elements.size() - 1);
127 const unsigned int column(currentElementIndex %
m_widths.size());
128 m_widths[column] = std::max(static_cast<unsigned int>(
m_elements[currentElementIndex].length()), m_widths[column]);
pandora::StringVector m_elements
The vector of flattened table elements.
std::vector< unsigned int > m_widths
The widths of each column (in units of number of characters)
const pandora::StringVector lar_content::LArFormattingHelper::Table::m_columnTitles |
|
private |
pandora::StringVector lar_content::LArFormattingHelper::Table::m_elements |
|
private |
pandora::StringVector lar_content::LArFormattingHelper::Table::m_format |
|
private |
const unsigned int lar_content::LArFormattingHelper::Table::m_precision |
|
private |
The number of significant figures to use when displaying number types.
Definition at line 206 of file LArFormattingHelper.h.
std::stringstream lar_content::LArFormattingHelper::Table::m_stringstream |
|
private |
std::vector<unsigned int> lar_content::LArFormattingHelper::Table::m_widths |
|
private |
The documentation for this class was generated from the following files: