Mantid
|
ITableWorkspace is an implementation of Workspace in which the data are organised in columns of same size. More...
#include <ITableWorkspace.h>
Public Member Functions | |
virtual Column_sptr | addColumn (const std::string &type, const std::string &name)=0 |
Creates a new column. More... | |
virtual bool | addColumns (const std::string &type, const std::string &name, size_t n) |
Creates n new columns of the same type. More... | |
TableRowHelper | appendRow () |
Appends a row. More... | |
Boolean & | Bool (size_t row, size_t col) |
Get the reference to the element in row row and column col if its type is bool . More... | |
template<class T > | |
T & | cell (size_t row, size_t col) |
Get the reference to the element in row row and column col . More... | |
ITableWorkspace_uptr | clone () const |
Returns a clone of the workspace. More... | |
ITableWorkspace_uptr | cloneColumns (const std::vector< std::string > &colNames) const |
Returns a clone of the workspace. More... | |
ITableWorkspace_uptr | cloneEmpty () const |
Returns a default-initialized clone of the workspace. More... | |
virtual size_t | columnCount () const =0 |
Number of columns in the workspace. More... | |
virtual bool | customSort () const |
Does this type of TableWorkspace need a custom sorting call (e.g. More... | |
double & | Double (size_t row, size_t col) |
Get the reference to the element in row row and column col if its type is double . More... | |
virtual void | find (API::Boolean value, size_t &row, size_t col)=0 |
find method to get the index of API::Boolean value cell in a table workspace More... | |
virtual void | find (const Mantid::Kernel::V3D &value, size_t &row, size_t col)=0 |
find method to get the index of Mantid::Kernel::V3D cell value in a table workspace More... | |
virtual void | find (const std::string &value, size_t &row, size_t col)=0 |
find method to get the index of cellstd::string value in a table workspace More... | |
virtual void | find (double value, size_t &row, size_t col)=0 |
find method to get the index of double cell value in a table workspace More... | |
virtual void | find (float value, size_t &row, size_t col)=0 |
find method to get the index of float cell value in a table workspace More... | |
virtual void | find (size_t value, size_t &row, size_t col)=0 |
find method to get the index of integer cell value in a table workspace More... | |
virtual Column_const_sptr | getColumn (const std::string &name) const =0 |
Gets the shared pointer to a column by name. More... | |
virtual Column_sptr | getColumn (const std::string &name)=0 |
Gets the shared pointer to a column by name. More... | |
virtual Column_const_sptr | getColumn (size_t index) const =0 |
Gets the shared pointer to a column by index - return none-modifyable column. More... | |
virtual Column_sptr | getColumn (size_t index)=0 |
Gets the shared pointer to a column by index. More... | |
virtual std::vector< std::string > | getColumnNames () const =0 |
Returns a vector of all column names. More... | |
TableRowHelper | getFirstRow () |
Creates a TableRow object for the first row (row == 0). More... | |
virtual API::LogManager_const_sptr | getLogs () const =0 |
Get constant access to shared pointer containing workspace properties. More... | |
template<class T > | |
T & | getRef (const std::string &name, size_t index) |
Get a reference to a data element. More... | |
TableRowHelper | getRow (size_t row) |
Creates a TableRow object for row row. More... | |
TableColumnHelper | getVector (const std::string &name) |
Access the column with name name trough a ColumnVector object. More... | |
TableConstColumnHelper | getVector (const std::string &name) const |
Access the column with name name trough a ColumnVector object. More... | |
const std::string | id () const override |
Return the workspace typeID. More... | |
virtual size_t | insertRow (size_t index)=0 |
Inserts a row before row pointed to by index and fills it with default vales. More... | |
int & | Int (size_t row, size_t col) |
Get the reference to the element in row row and column col if its type is int . More... | |
ITableWorkspace () | |
Constructor. More... | |
virtual API::LogManager_sptr | logs ()=0 |
Get access to shared pointer containing workspace properties. More... | |
void | modified () |
If the workspace is the AnalysisDataService sends AfterReplaceNotification. More... | |
ITableWorkspace & | operator= (const ITableWorkspace &)=delete |
virtual void | removeColumn (const std::string &name)=0 |
Removes a column. More... | |
virtual void | removeRow (size_t index)=0 |
Delets a row if it exists. More... | |
virtual size_t | rowCount () const =0 |
Number of rows in the workspace. More... | |
virtual void | setRowCount (size_t count)=0 |
Resizes the workspace. More... | |
virtual void | sort (std::vector< std::pair< std::string, bool > > &criteria) |
Overridable method to custom-sort the workspace. More... | |
std::string & | String (size_t row, size_t col) |
Get the reference to the element in row row and column col if its type is std::string . More... | |
const std::string | toString () const override |
Serializes the object to a string. More... | |
Public Member Functions inherited from Mantid::API::Workspace | |
Workspace_uptr | clone () const |
Returns a clone (copy) of the workspace with covariant return type in all derived classes. More... | |
Workspace_uptr | cloneEmpty () const |
Returns a default-initialized clone of the workspace. More... | |
const std::string & | getComment () const |
Get the workspace comment. More... | |
const WorkspaceHistory & | getHistory () const |
Returns a reference to the WorkspaceHistory const. More... | |
virtual size_t | getMemorySize () const =0 |
Get the footprint in memory in bytes. More... | |
std::string | getMemorySizeAsStr () const |
Returns the memory footprint in sensible units. More... | |
const std::string & | getName () const override |
Get the workspace name. More... | |
virtual const std::string | getTitle () const |
Get the workspace title. More... | |
WorkspaceHistory & | history () |
Returns a reference to the WorkspaceHistory. More... | |
bool | isDirty (const int n=1) const |
Check whether other algorithms have been applied to the workspace by checking the history length. More... | |
virtual bool | isGroup () const |
Workspace & | operator= (const Workspace &other)=delete |
void | setComment (const std::string &) |
Set the comment field of the workspace. More... | |
virtual void | setTitle (const std::string &) |
Set the title of the workspace. More... | |
Parallel::StorageMode | storageMode () const |
Returns the storage mode (used for MPI runs) More... | |
bool | threadSafe () const override |
Marks the workspace as safe for multiple threads to edit data simutaneously. More... | |
Workspace (const Parallel::StorageMode storageMode=Parallel::StorageMode::Cloned) | |
~Workspace () | |
Public Member Functions inherited from Mantid::Kernel::DataItem | |
DataItem () | |
Default constructor. More... | |
DataItem (const DataItem &other) | |
Copy constructor Always makes a unique lock. More... | |
virtual | ~DataItem () |
Destructor. More... | |
void | readLock () |
Acquires a read lock. More... | |
void | unlock () |
Protected Member Functions | |
void | insertInColumn (Column *c, size_t index) |
Insert a new element into a column. More... | |
ITableWorkspace (const ITableWorkspace &)=default | |
Protected copy constructor. May be used by childs for cloning. More... | |
void | removeFromColumn (Column *c, size_t index) |
Remove an element from a column. More... | |
void | resizeColumn (Column *c, size_t size) |
Resize a column. More... | |
Protected Member Functions inherited from Mantid::API::Workspace | |
void | setStorageMode (Parallel::StorageMode mode) |
Sets the storage mode (used for MPI runs) More... | |
Workspace (const Workspace &) | |
Protected copy constructor. May be used by childs for cloning. More... | |
Protected Member Functions inherited from Mantid::Kernel::DataItem | |
Poco::RWLock * | getLock () const |
Private method to access the RWLock object. More... | |
Private Member Functions | |
ITableWorkspace * | doClone () const override |
Virtual clone method. Not implemented to force implementation in children. More... | |
virtual ITableWorkspace * | doCloneColumns (const std::vector< std::string > &colNames) const =0 |
ITableWorkspace * | doCloneEmpty () const override=0 |
Virtual cloneEmpty method. More... | |
ITableWorkspace is an implementation of Workspace in which the data are organised in columns of same size.
Elements of a column have the same data type. Columns can be added to the TableWorkspace with ctreateColumn(type,name). name is a name given to the column. type is a symbolic name for the data type of the column. Predefined types are:
User defined types can be used after declaring them with DECLARE_TABLECOLUMN macro: DECLARE_TABLECOLUMN(typeName, UserDefinedType)
Ways to access the data:
Definition at line 101 of file ITableWorkspace.h.
|
inline |
Constructor.
Definition at line 104 of file ITableWorkspace.h.
|
protecteddefault |
Protected copy constructor. May be used by childs for cloning.
|
pure virtual |
Creates a new column.
type | :: The datatype of the column |
name | :: The name to assign to the column |
Implemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, TableWorkspaceTester, and Mantid::DataObjects::TableWorkspace.
Referenced by addColumns(), and ITableWorkspacePickleSuite::readMetaData().
|
virtual |
Creates n new columns of the same type.
type | :: The datatype of the column |
name | :: The name to assign to the column |
n | :: The number of columns to create |
Reimplemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, and Mantid::DataObjects::PeaksWorkspace.
Definition at line 35 of file ITableWorkspace.cpp.
References addColumn(), and n.
TableRowHelper Mantid::API::ITableWorkspace::appendRow | ( | ) |
Appends a row.
Definition at line 46 of file ITableWorkspace.cpp.
References getRow(), insertRow(), and rowCount().
Referenced by Mantid::DataObjects::SplittersWorkspace::addSplitter(), Mantid::CurveFitting::Algorithms::LeBailFit::exportInstrumentParameterToTable(), and ITableWorkspacePickleSuite::readData().
|
inline |
Get the reference to the element in row row
and column col
if its type is bool
.
If it doesn't match the actual type of the column a runtime_error exception is thrown.
row | :: Row number |
col | :: Column number |
Definition at line 248 of file ITableWorkspace.h.
|
inline |
Get the reference to the element in row row
and column col
.
row | :: Row number |
col | :: Column number |
T | Type of the data in the column. If it doesn't match the actual type a runtime_error exception is thrown. |
Definition at line 209 of file ITableWorkspace.h.
References std::to_string().
|
inline |
Returns a clone of the workspace.
Definition at line 107 of file ITableWorkspace.h.
ITableWorkspace_uptr Mantid::API::ITableWorkspace::cloneColumns | ( | const std::vector< std::string > & | colNames | ) | const |
Returns a clone of the workspace.
colNames | :: Names of the column to clone. If empty clone all columns. |
Definition at line 16 of file ITableWorkspace.cpp.
References doCloneColumns().
|
inline |
Returns a default-initialized clone of the workspace.
Definition at line 110 of file ITableWorkspace.h.
|
pure virtual |
Number of columns in the workspace.
Implemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, Mantid::DataObjects::TableWorkspace, and TableWorkspaceTester.
Referenced by export_ITableWorkspace(), Mantid::DataObjects::MementoTableWorkspace::isMementoWorkspace(), Mantid::API::Projection::Projection(), Mantid::API::TableRow::TableRow(), and toString().
|
inlinevirtual |
Does this type of TableWorkspace need a custom sorting call (e.g.
PeaksWorkspace)
Reimplemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, and Mantid::DataObjects::PeaksWorkspace.
Definition at line 172 of file ITableWorkspace.h.
|
inlineoverrideprivatevirtual |
Virtual clone method. Not implemented to force implementation in children.
Implements Mantid::API::Workspace.
Reimplemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::MementoTableWorkspace, Mantid::DataObjects::PeaksWorkspace, Mantid::DataObjects::SplittersWorkspace, Mantid::DataObjects::TableWorkspace, and TableWorkspaceTester.
Definition at line 310 of file ITableWorkspace.h.
|
privatepure virtual |
Implemented in TableWorkspaceTester, Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, and Mantid::DataObjects::TableWorkspace.
Referenced by cloneColumns().
|
overrideprivatepure virtual |
Virtual cloneEmpty method.
Not implemented to force implementation in children.
Implements Mantid::API::Workspace.
Implemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::MementoTableWorkspace, Mantid::DataObjects::PeaksWorkspace, Mantid::DataObjects::SplittersWorkspace, Mantid::DataObjects::TableWorkspace, and TableWorkspaceTester.
|
inline |
Get the reference to the element in row row
and column col
if its type is double
.
If it doesn't match the actual type of the column a runtime_error exception is thrown.
row | :: Row number |
col | :: Column number |
Definition at line 239 of file ITableWorkspace.h.
|
pure virtual |
find method to get the index of API::Boolean value cell in a table workspace
Implemented in Mantid::DataObjects::TableWorkspace, Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, and TableWorkspaceTester.
|
pure virtual |
find method to get the index of Mantid::Kernel::V3D cell value in a table workspace
Implemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, TableWorkspaceTester, and Mantid::DataObjects::TableWorkspace.
|
pure virtual |
find method to get the index of cellstd::string value in a table workspace
Implemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, TableWorkspaceTester, and Mantid::DataObjects::TableWorkspace.
|
pure virtual |
find method to get the index of double cell value in a table workspace
Implemented in Mantid::DataObjects::TableWorkspace, Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, and TableWorkspaceTester.
|
pure virtual |
find method to get the index of float cell value in a table workspace
Implemented in Mantid::DataObjects::TableWorkspace, Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, and TableWorkspaceTester.
|
pure virtual |
find method to get the index of integer cell value in a table workspace
Implemented in Mantid::DataObjects::TableWorkspace, Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, and TableWorkspaceTester.
|
pure virtual |
Gets the shared pointer to a column by name.
Implemented in TableWorkspaceTester, Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, and Mantid::DataObjects::TableWorkspace.
|
pure virtual |
Gets the shared pointer to a column by name.
Implemented in TableWorkspaceTester, Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, and Mantid::DataObjects::TableWorkspace.
Referenced by Mantid::DataObjects::MementoTableWorkspace::isMementoWorkspace(), Mantid::API::Projection::Projection(), ITableWorkspacePickleSuite::readData(), Mantid::API::TableRow::TableRow(), MantidQt::MantidWidgets::FunctionBrowser::updateMultiDatasetParameters(), and ITableWorkspacePickleSuite::writeMetaData().
|
pure virtual |
Gets the shared pointer to a column by index - return none-modifyable column.
Implemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, Mantid::DataObjects::TableWorkspace, and TableWorkspaceTester.
|
pure virtual |
Gets the shared pointer to a column by index.
Implemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, Mantid::DataObjects::TableWorkspace, and TableWorkspaceTester.
|
pure virtual |
Returns a vector of all column names.
Implemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, Mantid::DataObjects::TableWorkspace, and TableWorkspaceTester.
Referenced by export_ITableWorkspace(), ITableWorkspacePickleSuite::readData(), toDict(), and ITableWorkspacePickleSuite::writeMetaData().
|
inline |
Creates a TableRow object for the first row (row
== 0).
Definition at line 266 of file ITableWorkspace.h.
|
pure virtual |
Get constant access to shared pointer containing workspace properties.
Implemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, Mantid::DataObjects::TableWorkspace, and TableWorkspaceTester.
|
inline |
Get a reference to a data element.
name | :: Column name. |
index | :: Element's opsition in the column. |
T | Type of the data in the column. If it doesn't match the actual type a runtime_error exception is thrown. |
Definition at line 191 of file ITableWorkspace.h.
References index.
|
inline |
Creates a TableRow object for row row.
row | :: Row number |
Definition at line 263 of file ITableWorkspace.h.
Referenced by appendRow(), and Mantid::DataObjects::SplittersWorkspace::getSplitter().
TableColumnHelper Mantid::API::ITableWorkspace::getVector | ( | const std::string & | name | ) |
Access the column with name name
trough a ColumnVector object.
name | :: The name of the column |
Definition at line 56 of file ITableWorkspace.cpp.
TableConstColumnHelper Mantid::API::ITableWorkspace::getVector | ( | const std::string & | name | ) | const |
Access the column with name name
trough a ColumnVector object.
Access the column with name name
trough a ColumnVector object (const)
name | :: The name of the column |
Definition at line 63 of file ITableWorkspace.cpp.
|
inlineoverridevirtual |
Return the workspace typeID.
Implements Mantid::Kernel::DataItem.
Reimplemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, Mantid::DataObjects::TableWorkspace, and TableWorkspaceTester.
Definition at line 116 of file ITableWorkspace.h.
Referenced by toString().
|
inlineprotected |
Insert a new element into a column.
c | :: Pointer to the column |
index | :: Index in the column before which a new element wil be inserted. |
Definition at line 301 of file ITableWorkspace.h.
References index, and Mantid::API::Column::insert().
Referenced by Mantid::DataObjects::TableWorkspace::insertRow().
|
pure virtual |
Inserts a row before row pointed to by index and fills it with default vales.
Implemented in Mantid::DataObjects::TableWorkspace, Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, and TableWorkspaceTester.
Referenced by appendRow().
|
inline |
Get the reference to the element in row row
and column col
if its type is int
.
If it doesn't match the actual type of the column a runtime_error exception is thrown.
row | :: Row number |
col | :: Column number |
Definition at line 230 of file ITableWorkspace.h.
|
pure virtual |
Get access to shared pointer containing workspace properties.
Implemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, Mantid::DataObjects::TableWorkspace, and TableWorkspaceTester.
void Mantid::API::ITableWorkspace::modified | ( | ) |
If the workspace is the AnalysisDataService sends AfterReplaceNotification.
Definition at line 70 of file ITableWorkspace.cpp.
References Mantid::API::Workspace::getName(), and Mantid::Kernel::SingletonHolder< T >::Instance().
Referenced by Mantid::DataObjects::TableWorkspace::addColumn(), Mantid::DataObjects::TableWorkspace::insertRow(), Mantid::DataObjects::TableWorkspace::removeColumn(), Mantid::DataObjects::TableWorkspace::removeRow(), and Mantid::DataObjects::TableWorkspace::sort().
|
delete |
|
pure virtual |
Removes a column.
Implemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, TableWorkspaceTester, and Mantid::DataObjects::TableWorkspace.
Referenced by export_ITableWorkspace().
|
inlineprotected |
Remove an element from a column.
c | :: Pointer to the column |
index | :: Index of the element to be removed. |
Definition at line 307 of file ITableWorkspace.h.
References index, and Mantid::API::Column::remove().
Referenced by Mantid::DataObjects::TableWorkspace::removeRow().
|
pure virtual |
Delets a row if it exists.
Implemented in Mantid::DataObjects::TableWorkspace, Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, and TableWorkspaceTester.
|
inlineprotected |
Resize a column.
c | :: Pointer to the column |
size | :: New column size |
Definition at line 294 of file ITableWorkspace.h.
References Mantid::API::Column::resize().
Referenced by Mantid::DataObjects::TableWorkspace::addColumn(), and Mantid::DataObjects::TableWorkspace::setRowCount().
|
pure virtual |
Number of rows in the workspace.
Implemented in Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, Mantid::DataObjects::TableWorkspace, and TableWorkspaceTester.
Referenced by appendRow(), export_ITableWorkspace(), Mantid::API::Projection::Projection(), toString(), and MantidQt::MantidWidgets::FunctionBrowser::updateMultiDatasetParameters().
|
pure virtual |
Resizes the workspace.
Implemented in Mantid::DataObjects::TableWorkspace, Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, and TableWorkspaceTester.
Referenced by export_ITableWorkspace().
|
virtual |
Overridable method to custom-sort the workspace.
criteria | : a vector with a list of pairs: column name, bool; where bool = true for ascending, false for descending sort. The peaks are sorted by the first criterion first, then the 2nd if equal, etc. |
std::runtime_error | unless overridden |
Reimplemented in Mantid::DataObjects::TableWorkspace.
Definition at line 91 of file ITableWorkspace.cpp.
References UNUSED_ARG.
|
inline |
Get the reference to the element in row row and column col if its type is std::string
.
If it doesn't match the actual type of the column a runtime_error exception is thrown.
row | :: Row number |
col | :: Column number |
Definition at line 257 of file ITableWorkspace.h.
|
overridevirtual |
Serializes the object to a string.
Implements Mantid::Kernel::DataItem.
Definition at line 20 of file ITableWorkspace.cpp.
References columnCount(), Mantid::API::Workspace::getMemorySizeAsStr(), id(), rowCount(), and std::to_string().
Referenced by Mantid::API::IPeaksWorkspace::toString().