#include <DataTable.h>
Public Member Functions | |
| DataTable (const bool columnLabels=true, const bool rowLabels=false) | |
| enum DataTableResult | Read (const std::string fileName) |
| void | SetWidth (const std::string s) |
| Type | Value (const unsigned row, const unsigned col) const |
| void | SetValue (const unsigned row, const unsigned col, const Type value) |
| std::string | ColumnLabel (const unsigned index) const |
| std::string | RowLabel (const unsigned index) const |
| std::vector< Type > | RowVector (const unsigned row) const |
| std::vector< Type > | ColumnVector (const unsigned col) const |
| void | PrintTable (std::ostream &out=std::cout) |
| void | Flush (void) |
| unsigned | Rows (void) const |
| unsigned | Columns (void) const |
| unsigned | ColumnLabels (void) const |
| void | SetZero (void) |
The DataTable class reads homogeneous tabular data, i.e., numerical data that is either all of type Type or that can be converted to Type using standard conversions. Rows or columns or both can be labeled, but labels are not required. A simple method for stream output of errors is also provided.
Definition at line 99 of file DataTable.h.
| DataTable< Type >::DataTable | ( | const bool | columnLabels = true, |
|
| const bool | rowLabels = false | |||
| ) | [inline] |
Constructor -- no default constructor is provided.
| columnLabels | Are columns labeled? | |
| rowLabels | Are rows labeled? |
Definition at line 113 of file DataTable.h.
| enum DataTableResult DataTable< Type >::Read | ( | const std::string | fileName | ) | [inline] |
Read data from a file.
| fileName | The name of the file from which data is to be read |
labelError If there is an error reading column labels
valueError If there is an error reading values
openError If filename could not be opened for reading
readSuccess If everything works
Definition at line 129 of file DataTable.h.
| void DataTable< Type >::SetWidth | ( | const std::string | s | ) | [inline] |
Sets width of output based on length of string
| s | The string used to set the width |
Definition at line 152 of file DataTable.h.
| Type DataTable< Type >::Value | ( | const unsigned | row, | |
| const unsigned | col | |||
| ) | const [inline] |
Value of the data at specified row and column
| row | Index of the data row | |
| col | Index of the data column |
Definition at line 165 of file DataTable.h.
References argCheck_.
Referenced by DataTable< Type >::ColumnVector().
| void DataTable< Type >::SetValue | ( | const unsigned | row, | |
| const unsigned | col, | |||
| const Type | value | |||
| ) | [inline] |
Set value of the data at specified row and column
| row | Index of the data row | |
| col | Index of the data column | |
| value | Value to be inserted |
Definition at line 177 of file DataTable.h.
References argCheck_.
| std::string DataTable< Type >::ColumnLabel | ( | const unsigned | index | ) | const [inline] |
Label associated with a particular column index
| index | column index |
Definition at line 189 of file DataTable.h.
References argCheck_.
| std::string DataTable< Type >::RowLabel | ( | const unsigned | index | ) | const [inline] |
Label associated with a particular row index
| index | row index |
Definition at line 199 of file DataTable.h.
References argCheck_.
Referenced by DataTable< Type >::PrintTable().
| std::vector<Type> DataTable< Type >::RowVector | ( | const unsigned | row | ) | const [inline] |
An entire row of the data matrix
| row | Index of the data row |
Definition at line 208 of file DataTable.h.
References argCheck_.
| std::vector<Type> DataTable< Type >::ColumnVector | ( | const unsigned | col | ) | const [inline] |
An entire column of the data matrix
| col | Index of the data column |
Definition at line 217 of file DataTable.h.
References argCheck_, and DataTable< Type >::Value().
| void DataTable< Type >::PrintTable | ( | std::ostream & | out = std::cout |
) | [inline] |
Print the table to the specified stream
| out | The stream for output (defaults to std::cout) |
Definition at line 230 of file DataTable.h.
References DataTable< Type >::RowLabel().
| void DataTable< Type >::Flush | ( | void | ) | [inline] |
Re-initialize internal data structures.
Definition at line 244 of file DataTable.h.
| unsigned DataTable< Type >::Rows | ( | void | ) | const [inline] |
Number of rows in the data
Definition at line 253 of file DataTable.h.
| unsigned DataTable< Type >::Columns | ( | void | ) | const [inline] |
Number of columns in the data
Definition at line 259 of file DataTable.h.
| unsigned DataTable< Type >::ColumnLabels | ( | void | ) | const [inline] |
Number of column labels
Definition at line 265 of file DataTable.h.
| void DataTable< Type >::SetZero | ( | void | ) | [inline] |
Set all data elements to zero
Definition at line 271 of file DataTable.h.
1.5.1