Mantid
|
TableRow represents a row in a TableWorkspace. More...
#include <TableRow.h>
Public Member Functions | |
Boolean & | Bool (size_t col) |
Returns a reference to the element in position col if its type is bool. More... | |
template<class T > | |
T & | cell (size_t col) |
Templated method to access the element col in the row. More... | |
double & | Double (size_t col) |
Returns a reference to the element in position col if its type is double. More... | |
int & | Int (size_t col) |
Returns a reference to the element in position col if its type is int. More... | |
bool | next () |
Steps to the next row in the TableWorkspace if there is one. More... | |
TableRow & | operator<< (bool t) |
Special case of bool. More... | |
TableRow & | operator<< (const char *t) |
Special case of char*. More... | |
template<class T > | |
TableRow & | operator<< (const T &t) |
Input streaming operator. More... | |
const TableRow & | operator>> (bool &t) const |
Special case of bool. More... | |
template<class T > | |
const TableRow & | operator>> (T &t) const |
Output streaming operator. More... | |
bool | prev () |
Steps to the previous row in the TableWorkspace if there is one. More... | |
size_t | row () const |
Returns the row number of the TableRow. More... | |
void | row (size_t i) |
Makes the TableRow point to i-th row in the TableWorkspace. More... | |
void | sep (const std::string &s) |
Sets a new separator character(s) between elements in a text output. More... | |
size_t | size () const |
Returns the number of rows in the TableWorkspace. More... | |
std::string & | String (size_t col) |
Returns a reference to the element in position col if its type is std::string. More... | |
TableRow (const TableRowHelper &trh) | |
Constructor. More... | |
Private Attributes | |
size_t | m_col |
Current column number (for streaming operations) More... | |
std::vector< Column_sptr > | m_columns |
Pointers to the columns in the ITableWorkspace. More... | |
size_t | m_nrows |
Number of rows in the TableWorkspace. More... | |
size_t | m_row |
Row number in the TableWorkspace. More... | |
std::string | m_sep |
Separator character(s) between elements in a text output. More... | |
Friends | |
MANTID_API_DLL std::ostream & | operator<< (std::ostream &s, const TableRow &row) |
Output stream operator. More... | |
TableRow represents a row in a TableWorkspace.
The elements in the row can be accessed through a) tmplated cell method b) streaming operators (<< & >>) c) specialized access function: Int(c), Double(c), Bool(c), String(c)
Definition at line 39 of file TableRow.h.
Mantid::API::TableRow::TableRow | ( | const TableRowHelper & | trh | ) |
Constructor.
trh | :: TableRowHelper returned by TableWorkspace::getRow |
Definition at line 15 of file TableRow.cpp.
References Mantid::API::ITableWorkspace::columnCount(), Mantid::API::ITableWorkspace::getColumn(), m_columns, m_nrows, Mantid::API::TableRowHelper::m_workspace, and size().
|
inline |
Returns a reference to the element in position col if its type is bool.
col | :: Position of the element |
Definition at line 143 of file TableRow.h.
|
inline |
Templated method to access the element col in the row.
The internal pointer moves to point to the element after col.
col | :: Element's position in the row |
Definition at line 115 of file TableRow.h.
Referenced by Mantid::DataHandling::SaveTBL::findGroups(), and Mantid::DataHandling::LoadDiffCal::makeCalWorkspace().
|
inline |
Returns a reference to the element in position col if its type is double.
col | :: Position of the element |
Definition at line 137 of file TableRow.h.
Referenced by Mantid::Algorithms::addRowFromGroupedCalibration(), Mantid::Algorithms::CombineDiffCal::exec(), Mantid::Algorithms::CreateUserDefinedBackground::extendBackgroundToData(), MantidQt::MantidWidgets::SequentialFitDialog::getFitResults(), and Mantid::DataHandling::SaveDiffFittingAscii::writeData().
|
inline |
Returns a reference to the element in position col if its type is int.
col | :: Position of the element |
Definition at line 131 of file TableRow.h.
Referenced by Mantid::Algorithms::addRowFromGroupedCalibration(), Mantid::Algorithms::binarySearchForRow(), Mantid::Algorithms::FilterEvents::createOutputWorkspacesSplitters(), and Mantid::Algorithms::CombineDiffCal::exec().
bool Mantid::API::TableRow::next | ( | ) |
Steps to the next row in the TableWorkspace if there is one.
Definition at line 40 of file TableRow.cpp.
References m_col, m_nrows, and m_row.
Referenced by Mantid::Algorithms::CombineDiffCal::exec().
|
inline |
Special case of bool.
Definition at line 81 of file TableRow.h.
References operator<<().
Referenced by operator<<().
|
inline |
Special case of char*.
Definition at line 79 of file TableRow.h.
References operator<<().
Referenced by operator<<().
|
inline |
Input streaming operator.
Makes TableRow look like a standard input stream. Every << operatr moves an internal pointer to the next element in the row. If the types of the input value and the current element don't match an exception is thrown.
t | :: Input value |
Definition at line 61 of file TableRow.h.
References size().
const TableRow & Mantid::API::TableRow::operator>> | ( | bool & | t | ) | const |
|
inline |
Output streaming operator.
Makes TableRow look like a standard output stream. Every >> operatr moves an internal pointer to the next element in the row. If the types of the receiving variable and the current element don't match an exception is thrown.
t | :: Variable for output |
Definition at line 92 of file TableRow.h.
References size().
Referenced by operator>>().
bool Mantid::API::TableRow::prev | ( | ) |
Steps to the previous row in the TableWorkspace if there is one.
Definition at line 53 of file TableRow.cpp.
|
inline |
Returns the row number of the TableRow.
Definition at line 43 of file TableRow.h.
Referenced by Mantid::Algorithms::populateTable().
void Mantid::API::TableRow::row | ( | size_t | i | ) |
|
inline |
Sets a new separator character(s) between elements in a text output.
Definition at line 50 of file TableRow.h.
|
inline |
Returns the number of rows in the TableWorkspace.
Definition at line 45 of file TableRow.h.
Referenced by operator<<(), operator>>(), Mantid::DataHandling::SaveGSASInstrumentFile::parseProfileTableWorkspace(), and TableRow().
|
inline |
Returns a reference to the element in position col if its type is std::string.
col | :: Position of the element |
Definition at line 150 of file TableRow.h.
Referenced by Mantid::Algorithms::FilterEvents::createOutputWorkspacesSplitters(), and Mantid::DataHandling::SaveTBL::exec().
|
friend |
Output stream operator.
s | :: Output stream |
row | :: The TableRow |
Definition at line 75 of file TableRow.cpp.
|
mutableprivate |
Current column number (for streaming operations)
Definition at line 156 of file TableRow.h.
|
private |
Pointers to the columns in the ITableWorkspace.
Definition at line 154 of file TableRow.h.
Referenced by TableRow().
|
private |
Number of rows in the TableWorkspace.
Definition at line 157 of file TableRow.h.
Referenced by next(), row(), and TableRow().
|
private |
Row number in the TableWorkspace.
Definition at line 155 of file TableRow.h.
|
private |
Separator character(s) between elements in a text output.
Definition at line 158 of file TableRow.h.