Mantid
|
Column is the base class for columns of TableWorkspace. More...
#include <Column.h>
Public Member Functions | |
template<class T > | |
T & | cell (size_t index) |
Templated method for returning a value. No type checks are done. More... | |
template<class T > | |
const T & | cell (size_t index) const |
Templated method for returning a value (const version). More... | |
virtual Column * | clone () const =0 |
Virtual constructor. Fully clone any column. More... | |
Column () | |
virtual bool | equals (const Column &, double) const |
virtual bool | equalsRelErr (const Column &, double) const |
virtual void | fromDouble (size_t index, double value)=0 |
Assign an element from double if possible. More... | |
virtual const std::type_info & | get_pointer_type_info () const =0 |
Returns typeid for the pointer type to the data element in the column. More... | |
virtual const std::type_info & | get_type_info () const =0 |
Returns typeid for the data in the column. More... | |
int | getLinkedYCol () const |
int | getPlotType () const |
get plot type More... | |
virtual bool | getReadOnly () const |
Returns column read-only flag. More... | |
virtual bool | isBool () const =0 |
Specialized type check. More... | |
virtual bool | isNumber () const =0 |
Are elements of the column interpretable as a number? More... | |
template<class T > | |
bool | isType () const |
Type check. More... | |
template<> | |
bool | isType () const |
const std::string & | name () const |
Name (caption) of the column. More... | |
template<class T = double> | |
std::vector< T > | numeric_fill (size_t maxSize=std::numeric_limits< size_t >::max()) const |
Fills a std vector with values from the column if the types are compatible. More... | |
virtual double | operator[] (size_t i) const |
return value casted to double (should be pure virtual) More... | |
virtual void | print (size_t index, std::ostream &s) const =0 |
Prints out the value to a stream. More... | |
virtual void | read (const size_t index, std::istringstream &in) |
Read in from stream and set the value at the given index. More... | |
virtual void | read (size_t index, const std::string &text) |
Read in a string and set the value at the given index. More... | |
void | setLinkedYCol (const int yCol) |
void | setName (const std::string &str) |
Renames the column. More... | |
void | setPlotType (int t) |
Set plot type where. More... | |
void | setReadOnly (bool isReadOnly) |
Sets column read-only flag. More... | |
virtual size_t | size () const =0 |
Number of individual elements in the column. More... | |
virtual long int | sizeOfData () const =0 |
Must return overall memory size taken by the column. More... | |
virtual void | sortIndex (bool ascending, size_t start, size_t end, std::vector< size_t > &indexVec, std::vector< std::pair< size_t, size_t > > &equalRanges) const |
Sort all or part of a vector of indices according to values in corresponding cells of this column. More... | |
virtual void | sortValues (const std::vector< size_t > &indexVec) |
Re-arrange values in this column according to indices in indexVec. More... | |
virtual double | toDouble (size_t index) const =0 |
Cast an element to double if possible. More... | |
const std::string & | type () const |
Type of the column data. More... | |
virtual | ~Column ()=default |
Virtual destructor. More... | |
Protected Member Functions | |
virtual void | insert (size_t index)=0 |
Inserts an item. More... | |
bool | possibleToCompare (const Column &otherColumn) const |
virtual void | remove (size_t index)=0 |
Removes an item. More... | |
virtual void | resize (size_t count)=0 |
Sets the new column size. More... | |
virtual const void * | void_pointer (size_t index) const =0 |
Pointer to a data element. More... | |
virtual void * | void_pointer (size_t index)=0 |
Pointer to a data element. More... | |
Protected Attributes | |
bool | m_isReadOnly |
Column read-only flag. More... | |
int | m_linkedYCol = -1 |
For error columns - the index of the related data column. More... | |
std::string | m_name |
name More... | |
int | m_plotType |
plot type where None = 0 (means it has specifically been set to 'no plot type') NotSet = -1000 (this is the default and means plot style has not been set) X = 1, Y = 2, Z = 3, xErr = 4, yErr = 5, Label = 6 More... | |
std::string | m_type |
type More... | |
Friends | |
class | ColumnFactoryImpl |
template<class T > | |
class | ColumnVector |
class | ITableWorkspace |
Column is the base class for columns of TableWorkspace.
|
virtualdefault |
Virtual destructor.
|
inline |
Templated method for returning a value. No type checks are done.
Definition at line 127 of file Column.h.
References index.
Referenced by Mantid::NeXus::NexusFileIO::writeTableColumn().
|
inline |
|
pure virtual |
Virtual constructor. Fully clone any column.
Implemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
|
inlinevirtual |
Reimplemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, and Mantid::DataObjects::VectorColumn< Type >.
|
inlinevirtual |
|
pure virtual |
Assign an element from double if possible.
Implemented in Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
|
pure virtual |
Returns typeid for the pointer type to the data element in the column.
Implemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
|
pure virtual |
Returns typeid for the data in the column.
Implemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
Referenced by possibleToCompare().
|
inline |
get plot type
|
inlinevirtual |
Returns column read-only flag.
Reimplemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, and Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >.
|
protectedpure virtual |
Inserts an item.
Implemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
Referenced by Mantid::API::ITableWorkspace::insertInColumn().
|
pure virtual |
Specialized type check.
Implemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
Referenced by isType().
|
pure virtual |
Are elements of the column interpretable as a number?
Implemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
|
inline |
bool Mantid::API::Column::isType | ( | ) | const |
Definition at line 21 of file Column.cpp.
References isBool().
|
inline |
Name (caption) of the column.
Definition at line 43 of file Column.h.
Referenced by Mantid::DataObjects::TableColumn< API::Boolean >::InconvertibleToDoubleType::operator API::Boolean(), Mantid::DataObjects::TableColumn< Type >::InconvertibleToDoubleType::operator double(), Mantid::DataObjects::TableColumn< Type >::TableColumn(), and Mantid::DataObjects::TableColumn_ptr< T >::TableColumn_ptr().
|
inline |
|
inlinevirtual |
return value casted to double (should be pure virtual)
Reimplemented in Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, and Mantid::DataObjects::TableColumn< API::Boolean >.
Definition at line 48 of file Column.h.
References UNUSED_ARG.
|
inlineprotected |
Definition at line 176 of file Column.h.
References get_type_info(), and size().
Referenced by Mantid::DataObjects::TableColumn< Type >::equals(), and Mantid::DataObjects::TableColumn< Type >::equalsRelErr().
|
pure virtual |
Prints out the value to a stream.
Implemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
|
inlinevirtual |
Read in from stream and set the value at the given index.
Reimplemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, and Mantid::DataObjects::TableColumn< API::Boolean >.
Definition at line 80 of file Column.h.
References index, and UNUSED_ARG.
|
inlinevirtual |
Read in a string and set the value at the given index.
Reimplemented in Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, and Mantid::DataObjects::VectorColumn< Type >.
Definition at line 74 of file Column.h.
References index, and UNUSED_ARG.
|
protectedpure virtual |
Removes an item.
Implemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
Referenced by Mantid::API::ITableWorkspace::removeFromColumn().
|
protectedpure virtual |
Sets the new column size.
Implemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
Referenced by Mantid::API::ITableWorkspace::resizeColumn().
void Mantid::API::Column::setLinkedYCol | ( | const int | yCol | ) |
Definition at line 36 of file Column.cpp.
References m_linkedYCol.
|
inline |
void Mantid::API::Column::setPlotType | ( | int | t | ) |
Set plot type where.
Set plot type where None = 0 (means it has specifically been set to 'no plot type') NotSet = -1000 (this is the default and means plot style has not been set) X = 1, Y = 2, Z = 3, xErr = 4, yErr = 5, Label = 6.
t | plot type as defined above |
Definition at line 28 of file Column.cpp.
References Mantid::Kernel::Logger::error(), Mantid::API::g_log, and m_plotType.
|
inline |
|
pure virtual |
Number of individual elements in the column.
Implemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
Referenced by possibleToCompare(), and Mantid::NeXus::NexusFileIO::writeTableColumn().
|
pure virtual |
Must return overall memory size taken by the column.
Implemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
|
virtual |
Sort all or part of a vector of indices according to values in corresponding cells of this column.
No implementation by default.
Fill in a vector of ranges of equal values. A range is a [begin,end) pair of indices in indexVec.
ascending | :: Sort in ascending (true) or descending (false) order. |
start | :: Starting index in indexVec to be sorted. |
end | :: Ending index (one past last) in indexVec to be sorted. |
indexVec | :: A vector of indices. On input it must contain all indices from 0 to this->size()-1. On output indices between start and end are sorted in ascending order of values in this column. So that: cell(indexVec[i]) <= cell(indexVec[i+1]) |
equalRanges | :: Output only vector. For each pair p in equalRanges cell(indexVec[p.first]) == cell(indexVec[p.first+1]) == ... == cell(indexVec[p.end-1]). If equalRanges is empty then there are no equal velues in this column. |
Reimplemented in Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, and Mantid::DataObjects::TableColumn< API::Boolean >.
Definition at line 41 of file Column.cpp.
References m_type.
|
virtual |
Re-arrange values in this column according to indices in indexVec.
No implementation by default.
Reimplemented in Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, and Mantid::DataObjects::TableColumn< API::Boolean >.
Definition at line 49 of file Column.cpp.
References m_type.
|
pure virtual |
Cast an element to double if possible.
Implemented in Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
|
inline |
Type of the column data.
Definition at line 46 of file Column.h.
Referenced by Mantid::DataObjects::TableColumn< Type >::convertToDouble(), and Mantid::DataObjects::TableColumn< Type >::fromDouble().
|
protectedpure virtual |
Pointer to a data element.
Implemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
|
protectedpure virtual |
Pointer to a data element.
Implemented in Mantid::DataObjects::PeakColumn< T >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak >, Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak >, Mantid::DataObjects::TableColumn< Type >, Mantid::DataObjects::TableColumn< T >, Mantid::DataObjects::TableColumn< API::Boolean >, Mantid::DataObjects::VectorColumn< Type >, and ColumnTester.
|
friend |
|
friend |
|
friend |
|
protected |
|
protected |
For error columns - the index of the related data column.
Definition at line 195 of file Column.h.
Referenced by setLinkedYCol().
|
protected |
plot type where None = 0 (means it has specifically been set to 'no plot type') NotSet = -1000 (this is the default and means plot style has not been set) X = 1, Y = 2, Z = 3, xErr = 4, yErr = 5, Label = 6
Definition at line 192 of file Column.h.
Referenced by setPlotType().
|
protected |
type
Definition at line 186 of file Column.h.
Referenced by sortIndex(), sortValues(), and Mantid::DataObjects::TableColumn< Type >::TableColumn().