A table used for printing information.
More...
#include <stf.h>
List of all members.
Public Member Functions |
| Table (std::size_t nRows, std::size_t nCols) |
| Constructor.
|
| Table (const std::map< std::string, double > &map) |
| Constructor.
|
double | at (std::size_t row, std::size_t col) const |
| Range-checked access. Returns a copy. Throws std::out_of_range if out of range.
|
double & | at (std::size_t row, std::size_t col) |
| Range-checked access. Returns a reference. Throws std::out_of_range if out of range.
|
bool | IsEmpty (std::size_t row, std::size_t col) const |
| Check whether a cell is empty.
|
void | SetEmpty (std::size_t row, std::size_t col, bool value=true) |
| Empties or un-empties a cell.
|
void | SetRowLabel (std::size_t row, const std::string &label) |
| Sets the label of a row.
|
void | SetColLabel (std::size_t col, const std::string &label) |
| Sets the label of a column.
|
const std::string & | GetRowLabel (std::size_t row) const |
| Retrieves the label of a row.
|
const std::string & | GetColLabel (std::size_t col) const |
| Retrieves the label of a column.
|
std::size_t | nRows () const |
| Retrieves the number of rows.
|
std::size_t | nCols () const |
| Retrieves the number of columns.
|
void | AppendRows (std::size_t nRows) |
| Appends rows to the table.
|
Detailed Description
A table used for printing information.
Members will throw std::out_of_range if out of range.
Constructor & Destructor Documentation
stf::Table::Table |
( |
std::size_t |
nRows, |
|
|
std::size_t |
nCols |
|
) |
| |
Constructor.
- Parameters:
-
nRows | Initial number of rows. |
nCols | Initial number of columns. |
stf::Table::Table |
( |
const std::map< std::string, double > & |
map | ) |
|
Constructor.
- Parameters:
-
map | A map used to initialise the table. |
Member Function Documentation
void stf::Table::AppendRows |
( |
std::size_t |
nRows | ) |
|
Appends rows to the table.
- Parameters:
-
nRows | The number of rows to be appended. |
double stf::Table::at |
( |
std::size_t |
row, |
|
|
std::size_t |
col |
|
) |
| const |
Range-checked access. Returns a copy. Throws std::out_of_range if out of range.
- Parameters:
-
row | 0-based row index. |
col | 0-based column index. |
- Returns:
- A copy of the double at row, col.
double& stf::Table::at |
( |
std::size_t |
row, |
|
|
std::size_t |
col |
|
) |
| |
Range-checked access. Returns a reference. Throws std::out_of_range if out of range.
- Parameters:
-
row | 0-based row index. |
col | 0-based column index. |
- Returns:
- A reference to the double at row, col.
const std::string& stf::Table::GetColLabel |
( |
std::size_t |
col | ) |
const |
Retrieves the label of a column.
- Parameters:
-
- Returns:
- Column label string.
const std::string& stf::Table::GetRowLabel |
( |
std::size_t |
row | ) |
const |
Retrieves the label of a row.
- Parameters:
-
- Returns:
- Row label string.
bool stf::Table::IsEmpty |
( |
std::size_t |
row, |
|
|
std::size_t |
col |
|
) |
| const |
Check whether a cell is empty.
- Parameters:
-
row | 0-based row index. |
col | 0-based column index. |
- Returns:
- true if empty, false otherwise.
std::size_t stf::Table::nCols |
( |
| ) |
const [inline] |
std::size_t stf::Table::nRows |
( |
| ) |
const [inline] |
void stf::Table::SetColLabel |
( |
std::size_t |
col, |
|
|
const std::string & |
label |
|
) |
| |
Sets the label of a column.
- Parameters:
-
col | 0-based column index. |
label | Column label string. |
void stf::Table::SetEmpty |
( |
std::size_t |
row, |
|
|
std::size_t |
col, |
|
|
bool |
value = true |
|
) |
| |
Empties or un-empties a cell.
- Parameters:
-
row | 0-based row index. |
col | 0-based column index. |
value | true if the cell should be empty, false otherwise. |
void stf::Table::SetRowLabel |
( |
std::size_t |
row, |
|
|
const std::string & |
label |
|
) |
| |
Sets the label of a row.
- Parameters:
-
row | 0-based row index. |
label | Row label string. |
The documentation for this class was generated from the following file: