CbmRoot
Loading...
Searching...
No Matches
cbm::qa::report::Table Class Reference

Table element in the report. More...

#include <CbmQaReportTable.h>

Inheritance diagram for cbm::qa::report::Table:
[legend]
Collaboration diagram for cbm::qa::report::Table:
[legend]

Public Member Functions

 Table (std::string_view label, std::string_view title="")
 Constructor.
 
 Table (std::string_view label, int nRows, int nCols, std::string_view title="")
 Constructor.
 
virtual ~Table ()
 Destructor.
 
const std::string & operator() (int iRow, int iCol) const
 Cell access operator.
 
std::string & operator() (int iRow, int iCol)
 Cell access operator.
 
std::string GetBody (const Engine &engine) const override
 Gets body of the element.
 
const std::string & GetCaption () const
 Gets caption.
 
const std::string & GetCell (int iRow, int iCol) const
 Gets cell.
 
const std::string & GetColumnTitle (int iCol) const
 Gets column title.
 
int GetNofRows () const
 Gets number of rows.
 
int GetNofCols () const
 Gets number of columns.
 
void SetCaption (std::string_view caption)
 Sets caption.
 
void Set (const CbmQaTable *pQaTable, const std::string &cellFormat=std::string(kDefaultFormat))
 Sets a table from CbmQaTable.
 
void SetCell (int iRow, int iCol, std::string_view cell)
 Sets cell.
 
void SetColumnTitle (int iCol, std::string_view title)
 Sets column title.
 
const std::string & GetLabel () const
 Gets label.
 
const std::string & GetTitle () const
 Gets name.
 
void SetLabel (std::string_view label)
 Sets label.
 
void SetTitle (std::string_view title)
 Sets name.
 
const ElementGetMother () const
 Gets mother element.
 

Protected Member Functions

int GetIndex (int iRow, int iCol) const
 Gets index of cell in the table vector.
 

Private Member Functions

void AssignMother (const Element *pMother)
 

Private Attributes

std::vector< std::string > fvsTable
 
std::vector< std::string > fvsTableHeader
 
std::string fsCaption = ""
 
int fNofRows = 0
 
int fNofCols = 0
 
const ElementfpMother = nullptr
 Mother element.
 
std::string fsLabel = ""
 Label for referencing.
 
std::string fsTitle = ""
 Title of the element.
 

Static Private Attributes

static constexpr std::string_view kDefaultFormat = "{:.3}"
 Default format of double entries.
 

Detailed Description

Table element in the report.

Definition at line 21 of file CbmQaReportTable.h.

Constructor & Destructor Documentation

◆ Table() [1/2]

Table::Table ( std::string_view label,
std::string_view title = "" )
explicit

Constructor.

Parameters
labelLabel of the element
titleTitle

Definition at line 22 of file CbmQaReportTable.cxx.

◆ Table() [2/2]

Table::Table ( std::string_view label,
int nRows,
int nCols,
std::string_view title = "" )

Constructor.

Parameters
labelLabel of the element
nRowsNumber of rows
nColsNumber of columns
titleTitle

Definition at line 26 of file CbmQaReportTable.cxx.

References fNofCols, fNofRows, fvsTable, and fvsTableHeader.

◆ ~Table()

virtual cbm::qa::report::Table::~Table ( )
inlinevirtual

Destructor.

Definition at line 39 of file CbmQaReportTable.h.

Member Function Documentation

◆ AssignMother()

void cbm::qa::report::Element::AssignMother ( const Element * pMother)
inlineprivateinherited

Definition at line 60 of file CbmQaReportElement.h.

References cbm::qa::report::Element::fpMother.

◆ GetBody()

std::string cbm::qa::report::Table::GetBody ( const Engine & engine) const
inlineoverridevirtual

Gets body of the element.

Parameters
engineA concrete implementation of the Engine to get the element body

Implements cbm::qa::report::Element.

Definition at line 53 of file CbmQaReportTable.h.

References cbm::qa::report::Engine::TableBody().

◆ GetCaption()

const std::string & cbm::qa::report::Table::GetCaption ( ) const
inline

◆ GetCell()

const std::string & cbm::qa::report::Table::GetCell ( int iRow,
int iCol ) const
inline

Gets cell.

Parameters
iRowIndex of row
iColIndex of column

Definition at line 61 of file CbmQaReportTable.h.

References fvsTable, and GetIndex().

◆ GetColumnTitle()

const std::string & cbm::qa::report::Table::GetColumnTitle ( int iCol) const
inline

Gets column title.

Parameters
iColIndex of column

Definition at line 65 of file CbmQaReportTable.h.

References fvsTableHeader.

Referenced by cbm::qa::report::BeamerEngine::TableBody(), cbm::qa::report::HtmlEngine::TableBody(), and cbm::qa::report::LatexEngine::TableBody().

◆ GetIndex()

int cbm::qa::report::Table::GetIndex ( int iRow,
int iCol ) const
inlineprotected

Gets index of cell in the table vector.

Definition at line 102 of file CbmQaReportTable.h.

References fNofCols.

Referenced by GetCell(), operator()(), operator()(), and SetCell().

◆ GetLabel()

◆ GetMother()

const Element * cbm::qa::report::Element::GetMother ( ) const
inlineinherited

◆ GetNofCols()

int cbm::qa::report::Table::GetNofCols ( ) const
inline

◆ GetNofRows()

int cbm::qa::report::Table::GetNofRows ( ) const
inline

◆ GetTitle()

◆ operator()() [1/2]

std::string & cbm::qa::report::Table::operator() ( int iRow,
int iCol )
inline

Cell access operator.

Parameters
iRowIndex of row
iColIndex of column

Definition at line 49 of file CbmQaReportTable.h.

References fvsTable, and GetIndex().

◆ operator()() [2/2]

const std::string & cbm::qa::report::Table::operator() ( int iRow,
int iCol ) const
inline

Cell access operator.

Parameters
iRowIndex of row
iColIndex of column

Definition at line 44 of file CbmQaReportTable.h.

References fvsTable, and GetIndex().

◆ Set()

void Table::Set ( const CbmQaTable * pQaTable,
const std::string & cellFormat = std::string(kDefaultFormat) )

Sets a table from CbmQaTable.

Parameters
pQaTablePointer to the QA-table object
cellFormatDefines format of the rows in fmt::format formating scheme

The parameter format provides ether a common format for all cells of the CbmQaTabl, or individual formats for each column (excluding the first row, if it is defined with the QA-table row names). For latter one have to pass a sequence of the formats, separated by the bar symbol: "<format_0>|<format_1>|<...>|<format_n>". Each of the <format_i> entries represents a fmt::format formatting line. For example, "{:.2}" formats a double into two digits after floating point, "{:.2e}" converts the number in the scientific format.

Definition at line 39 of file CbmQaReportTable.cxx.

References fNofCols, fNofRows, fsCaption, fvsTable, fvsTableHeader, CbmQaTable::GetCell(), cbm::qa::report::Element::GetLabel(), CbmQaTable::GetNcols(), CbmQaTable::GetNrows(), kDefaultFormat, SetCell(), and SetColumnTitle().

◆ SetCaption()

void cbm::qa::report::Table::SetCaption ( std::string_view caption)
inline

Sets caption.

Parameters
captionTable caption

Definition at line 75 of file CbmQaReportTable.h.

References fsCaption.

◆ SetCell()

void cbm::qa::report::Table::SetCell ( int iRow,
int iCol,
std::string_view cell )
inline

Sets cell.

Parameters
iRowIndex of row
iColIndex of column
cellCell

Definition at line 94 of file CbmQaReportTable.h.

References fvsTable, and GetIndex().

Referenced by Set().

◆ SetColumnTitle()

void cbm::qa::report::Table::SetColumnTitle ( int iCol,
std::string_view title )
inline

Sets column title.

Parameters
iColIndex of column

Definition at line 98 of file CbmQaReportTable.h.

References fvsTableHeader.

Referenced by Set().

◆ SetLabel()

void cbm::qa::report::Element::SetLabel ( std::string_view label)
inlineinherited

Sets label.

Definition at line 51 of file CbmQaReportElement.h.

References cbm::qa::report::Element::fsLabel.

◆ SetTitle()

void cbm::qa::report::Element::SetTitle ( std::string_view title)
inlineinherited

Sets name.

Definition at line 54 of file CbmQaReportElement.h.

References cbm::qa::report::Element::fsTitle.

Member Data Documentation

◆ fNofCols

int cbm::qa::report::Table::fNofCols = 0
private

Definition at line 109 of file CbmQaReportTable.h.

Referenced by GetIndex(), GetNofCols(), Set(), and Table().

◆ fNofRows

int cbm::qa::report::Table::fNofRows = 0
private

Definition at line 108 of file CbmQaReportTable.h.

Referenced by GetNofRows(), Set(), and Table().

◆ fpMother

const Element* cbm::qa::report::Element::fpMother = nullptr
privateinherited

Mother element.

Definition at line 63 of file CbmQaReportElement.h.

Referenced by cbm::qa::report::Element::AssignMother(), and cbm::qa::report::Element::GetMother().

◆ fsCaption

std::string cbm::qa::report::Table::fsCaption = ""
private

Definition at line 107 of file CbmQaReportTable.h.

Referenced by GetCaption(), Set(), and SetCaption().

◆ fsLabel

std::string cbm::qa::report::Element::fsLabel = ""
privateinherited

Label for referencing.

Definition at line 64 of file CbmQaReportElement.h.

Referenced by cbm::qa::report::Element::GetLabel(), and cbm::qa::report::Element::SetLabel().

◆ fsTitle

std::string cbm::qa::report::Element::fsTitle = ""
privateinherited

Title of the element.

Definition at line 65 of file CbmQaReportElement.h.

Referenced by cbm::qa::report::Element::GetTitle(), and cbm::qa::report::Element::SetTitle().

◆ fvsTable

std::vector<std::string> cbm::qa::report::Table::fvsTable
private

Definition at line 105 of file CbmQaReportTable.h.

Referenced by GetCell(), operator()(), operator()(), Set(), SetCell(), and Table().

◆ fvsTableHeader

std::vector<std::string> cbm::qa::report::Table::fvsTableHeader
private

Definition at line 106 of file CbmQaReportTable.h.

Referenced by GetColumnTitle(), Set(), SetColumnTitle(), and Table().

◆ kDefaultFormat

std::string_view cbm::qa::report::Table::kDefaultFormat = "{:.3}"
staticconstexprprivate

Default format of double entries.

Definition at line 23 of file CbmQaReportTable.h.

Referenced by Set().


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