|
Mantid
|
Class TableColumn implements abstract class Column for any copyable data type. More...
#include <TableColumn.h>
Classes | |
| struct | InconvertibleToDoubleType |
| Helper struct helping to write a generic casting to double. More... | |
Public Member Functions | |
| TableColumn * | clone () const override |
| Clone. | |
| double | convertToDouble (const std::string &value) const |
| Cast an string to double if possible. | |
| template<typename T > | |
| double | convertToDouble (const T &value) const |
| Cast an element to double if possible. | |
| std::vector< Type > & | data () |
| Reference to the data. | |
| const std::vector< Type > & | data () const |
| Const reference to the data. | |
| Type * | dataArray () |
| Pointer to the data array. | |
| bool | equals (const Column &otherColumn, double tolerance, bool const nanEqual=false) const override |
| bool | equalsRelErr (const Column &otherColumn, double tolerance, bool const nanEqual=false) const override |
| void | fromDouble (size_t i, double value) |
| Assign an element from double if possible. | |
| void | fromDouble (size_t i, double value) override |
| Cast an element to double if possible. | |
| const std::type_info & | get_pointer_type_info () const override |
| Type id of the pointer to data in the column. | |
| const std::type_info & | get_type_info () const override |
| Type id of the data in the column. | |
| bool | isBool () const override |
| Type check. | |
| bool | isNumber () const override |
| Are elements of the column interpretable as a number? | |
| double | operator[] (size_t i) const override |
| return a value casted to double; the users responsibility is to be sure, that the casting is possible | |
| void | print (size_t index, std::ostream &s) const override |
| Output to an ostream. | |
| void | read (const size_t index, std::istringstream &in) override |
| Read in from stream and set the value at the given index. | |
| void | read (size_t index, const std::string &text) |
| Template specialization for strings so they can contain spaces. | |
| void | read (size_t index, const std::string &text) override |
| Read in a string and set the value at the given index. | |
| void | read (size_t index, std::istringstream &text) |
| Template specialization for strings so they can contain spaces. | |
| size_t | size () const override |
| Number of individual elements in the column. | |
| long int | sizeOfData () const override |
| Memory used by the column. | |
| 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 override |
| Sort a vector of indices according to values in corresponding cells of this column. | |
| void | sortValues (const std::vector< size_t > &indexVec) override |
| Re-arrange values in this column according to indices in indexVec. | |
| TableColumn () | |
| double | toDouble (size_t i) const |
| Cast an element to double if possible. | |
| double | toDouble (size_t i) const override |
| Cast an element to double if possible. | |
Public Member Functions inherited from Mantid::API::Column | |
| template<class T > | |
| T & | cell (size_t index) |
| Templated method for returning a value. No type checks are done. | |
| template<class T > | |
| const T & | cell (size_t index) const |
| Templated method for returning a value (const version). | |
| Column () | |
| int | getLinkedYCol () const |
| int | getPlotType () const |
| get plot type | |
| virtual bool | getReadOnly () const |
| Returns column read-only flag. | |
| template<class T > | |
| bool | isType () const |
| Type check. | |
| template<> | |
| bool | isType () const |
| const std::string & | name () const |
| Name (caption) of the column. | |
| 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. | |
| void | setLinkedYCol (const int yCol) |
| void | setName (const std::string &str) |
| Renames the column. | |
| void | setPlotType (int t) |
| Set plot type where. | |
| void | setReadOnly (bool isReadOnly) |
| Sets column read-only flag. | |
| const std::string & | type () const |
| Type of the column data. | |
| virtual | ~Column ()=default |
| Virtual destructor. | |
Protected Member Functions | |
| void | insert (size_t index) override |
| Inserts default value at position index. | |
| void | remove (size_t index) override |
| Removes an item at index. | |
| void | resize (size_t count) override |
| Resize. | |
| const void * | void_pointer (size_t index) const override |
| Returns a pointer to the data element. | |
| void * | void_pointer (size_t index) override |
| Returns a pointer to the data element. | |
Protected Member Functions inherited from Mantid::API::Column | |
| bool | possibleToCompare (const Column &otherColumn) const |
Private Member Functions | |
| bool | compareVectors (const std::vector< API::Boolean > &newVector, double, bool const) const |
| Template specialisation for strings for comparison. | |
| bool | compareVectors (const std::vector< Kernel::V3D > &newVector, double tolerance, bool const nanEqual) const |
| Template specialisation for V3D for comparison. | |
| bool | compareVectors (const std::vector< std::string > &newVector, double, bool const) const |
| Template specialisation for strings for comparison. | |
| bool | compareVectors (const std::vector< Type > &newVector, double tolerance, bool const nanEqual, std::false_type) const |
| bool | compareVectors (const std::vector< Type > &newVector, double tolerance, bool const nanEqual=false) const |
| bool | compareVectors (const std::vector< Type > &newVector, double tolerance, bool const, std::true_type) const |
| bool | compareVectorsRelError (const std::vector< API::Boolean > &newVector, double tolerance, bool const) const |
| Template specialisation for bools for comparison. | |
| bool | compareVectorsRelError (const std::vector< Kernel::V3D > &newVector, double tolerance, bool const nanEqual) const |
| Template specialisation for V3D for comparison. | |
| bool | compareVectorsRelError (const std::vector< std::string > &newVector, double tolerance, bool const) const |
| Template specialisation for strings for comparison. | |
| bool | compareVectorsRelError (const std::vector< Type > &newVector, double tolerance, bool const nanEqual, std::false_type) const |
| bool | compareVectorsRelError (const std::vector< Type > &newVector, double tolerance, bool const nanEqual=false) const |
| bool | compareVectorsRelError (const std::vector< Type > &newVector, double tolerance, bool const, std::true_type) const |
Private Attributes | |
| std::vector< Type > | m_data |
| Column data. | |
Friends | |
| class | TableWorkspace |
Additional Inherited Members | |
Protected Attributes inherited from Mantid::API::Column | |
| bool | m_isReadOnly |
| Column read-only flag. | |
| int | m_linkedYCol = -1 |
| For error columns - the index of the related data column. | |
| std::string | m_name |
| name | |
| 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 | |
| std::string | m_type |
| type | |
Class TableColumn implements abstract class Column for any copyable data type.
A TableColumn is created using TableWorkspace::addColumn(type,name). type is the simbolic name of the data type which must be first declared with DECLARE_TABLECOLUMN macro. Predeclared types are:
"int" for int "int32_t" for int32_t "size_t" for size_t "float" for float "double" for double "bool" for Boolean "str" for std::string "V3D" for Mantid::Kernel::V3D
Boolean is used instead of bool because of bool's non-standard treatmemt in std::vector.
Definition at line 46 of file TableColumn.h.
|
inline |
Definition at line 63 of file TableColumn.h.
References Mantid::API::Column::m_type, and Mantid::API::Column::name().
Referenced by Mantid::DataObjects::TableColumn< Type >::clone().
|
inlineoverridevirtual |
Clone.
Implements Mantid::API::Column.
Definition at line 113 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::TableColumn().
|
inlineprivate |
Template specialisation for strings for comparison.
Definition at line 289 of file TableColumn.h.
References m_data.
|
inlineprivate |
Template specialisation for V3D for comparison.
Definition at line 301 of file TableColumn.h.
References Mantid::Kernel::V3D::isnan(), m_data, tolerance, and Mantid::Kernel::withinAbsoluteDifference().
|
inlineprivate |
Template specialisation for strings for comparison.
Definition at line 277 of file TableColumn.h.
References m_data.
|
inlineprivate |
Definition at line 236 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::m_data, and tolerance.
|
inlineprivate |
Definition at line 223 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::compareVectors(), and tolerance.
Referenced by Mantid::DataObjects::TableColumn< Type >::compareVectors(), and Mantid::DataObjects::TableColumn< Type >::equals().
|
inlineprivate |
Definition at line 227 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::m_data, and tolerance.
|
inlineprivate |
Template specialisation for bools for comparison.
Definition at line 323 of file TableColumn.h.
References tolerance.
|
inlineprivate |
Template specialisation for V3D for comparison.
Definition at line 330 of file TableColumn.h.
References Mantid::Kernel::V3D::isnan(), m_data, tolerance, and Mantid::Kernel::withinRelativeDifference().
|
inlineprivate |
Template specialisation for strings for comparison.
Definition at line 316 of file TableColumn.h.
References tolerance.
|
inlineprivate |
Definition at line 262 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::m_data, and tolerance.
|
inlineprivate |
Definition at line 249 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::compareVectorsRelError(), and tolerance.
Referenced by Mantid::DataObjects::TableColumn< Type >::compareVectorsRelError(), and Mantid::DataObjects::TableColumn< Type >::equalsRelErr().
|
inlineprivate |
Definition at line 253 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::m_data, and tolerance.
|
inline |
Cast an string to double if possible.
If it's impossible std::invalid_argument is throw. In case of an overflow boost::numeric::positive_overflow or boost::numeric::negative_overflow is throw.
| value | :: The value of the element. |
Definition at line 138 of file TableColumn.h.
References value.
|
inline |
Cast an element to double if possible.
If it's impossible boost::numeric::bad_numeric_cast is throw. In case of an overflow boost::numeric::positive_overflow or boost::numeric::negative_overflow is throw.
| value | :: The value of the element. |
Definition at line 123 of file TableColumn.h.
References Mantid::API::Column::type(), and value.
Referenced by Mantid::DataObjects::TableColumn< Type >::operator[](), and Mantid::DataObjects::TableColumn< Type >::toDouble().
|
inline |
Reference to the data.
Definition at line 158 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::m_data.
Referenced by Mantid::DataObjects::TableColumn< Type >::equals(), Mantid::DataObjects::TableColumn< Type >::equalsRelErr(), Mantid::DataObjects::TableWorkspace::getColVector(), Mantid::DataObjects::TableWorkspace::getColVector(), Mantid::DataObjects::TableWorkspace::getColVector(), and Mantid::DataObjects::TableWorkspace::getColVector().
|
inline |
Const reference to the data.
Definition at line 160 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::m_data.
|
inline |
Pointer to the data array.
Definition at line 162 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::m_data.
Referenced by Mantid::DataObjects::TableWorkspace::getColDataArray(), and Mantid::DataObjects::TableWorkspace::getColDataArray().
|
inlineoverridevirtual |
Reimplemented from Mantid::API::Column.
Definition at line 182 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::compareVectors(), Mantid::DataObjects::TableColumn< Type >::data(), Mantid::API::Column::possibleToCompare(), and tolerance.
|
inlineoverridevirtual |
Reimplemented from Mantid::API::Column.
Definition at line 191 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::compareVectorsRelError(), Mantid::DataObjects::TableColumn< Type >::data(), Mantid::API::Column::possibleToCompare(), and tolerance.
|
inlinevirtual |
Assign an element from double if possible.
Implements Mantid::API::Column.
Definition at line 444 of file TableColumn.h.
|
inlineoverridevirtual |
Cast an element to double if possible.
If it's impossible boost::numeric::bad_numeric_cast is throw. In case of an overflow boost::numeric::positive_overflow or boost::numeric::negative_overflow is throw.
| i | :: The index to an element. |
| value | cast this value |
Implements Mantid::API::Column.
Definition at line 151 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::m_data, Mantid::API::Column::type(), and value.
|
inlineoverridevirtual |
Type id of the pointer to data in the column.
Implements Mantid::API::Column.
Definition at line 100 of file TableColumn.h.
|
inlineoverridevirtual |
Type id of the data in the column.
Implements Mantid::API::Column.
Definition at line 98 of file TableColumn.h.
|
inlineoverrideprotectedvirtual |
Inserts default value at position index.
Implements Mantid::API::Column.
Definition at line 204 of file TableColumn.h.
References index, and Mantid::DataObjects::TableColumn< Type >::m_data.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Are elements of the column interpretable as a number?
Implements Mantid::API::Column.
Definition at line 109 of file TableColumn.h.
|
inlineoverridevirtual |
return a value casted to double; the users responsibility is to be sure, that the casting is possible
Reimplemented from Mantid::API::Column.
Definition at line 166 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::convertToDouble(), and Mantid::DataObjects::TableColumn< Type >::m_data.
|
inlineoverridevirtual |
Output to an ostream.
Implements Mantid::API::Column.
Definition at line 102 of file TableColumn.h.
References index, and Mantid::DataObjects::TableColumn< Type >::m_data.
|
overridevirtual |
Read in from stream and set the value at the given index.
Reimplemented from Mantid::API::Column.
Definition at line 368 of file TableColumn.h.
|
inlinevirtual |
Template specialization for strings so they can contain spaces.
Reimplemented from Mantid::API::Column.
Definition at line 344 of file TableColumn.h.
|
overridevirtual |
Read in a string and set the value at the given index.
Reimplemented from Mantid::API::Column.
Definition at line 362 of file TableColumn.h.
|
inlinevirtual |
Template specialization for strings so they can contain spaces.
Reimplemented from Mantid::API::Column.
Definition at line 353 of file TableColumn.h.
|
inlineoverrideprotectedvirtual |
Removes an item at index.
Implements Mantid::API::Column.
Definition at line 211 of file TableColumn.h.
References index, and Mantid::DataObjects::TableColumn< Type >::m_data.
|
inlineoverrideprotectedvirtual |
Resize.
Implements Mantid::API::Column.
Definition at line 202 of file TableColumn.h.
References count, and Mantid::DataObjects::TableColumn< Type >::m_data.
|
inlineoverridevirtual |
Number of individual elements in the column.
Implements Mantid::API::Column.
Definition at line 96 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::m_data.
|
inlineoverridevirtual |
Memory used by the column.
Implements Mantid::API::Column.
Definition at line 111 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::m_data.
|
overridevirtual |
Sort a vector of indices according to values in corresponding cells of this column.
Reimplemented from Mantid::API::Column.
Definition at line 391 of file TableColumn.h.
|
overridevirtual |
Re-arrange values in this column according to indices in indexVec.
Re-arrange values in this column in order of indices in indexVec.
Reimplemented from Mantid::API::Column.
Definition at line 430 of file TableColumn.h.
References m_data.
|
inlinevirtual |
Cast an element to double if possible.
Implements Mantid::API::Column.
Definition at line 442 of file TableColumn.h.
References m_data.
|
inlineoverridevirtual |
Cast an element to double if possible.
Implements Mantid::API::Column.
Definition at line 140 of file TableColumn.h.
References Mantid::DataObjects::TableColumn< Type >::convertToDouble(), and Mantid::DataObjects::TableColumn< Type >::m_data.
|
inlineoverrideprotectedvirtual |
Returns a pointer to the data element.
Implements Mantid::API::Column.
Definition at line 215 of file TableColumn.h.
References index, and Mantid::DataObjects::TableColumn< Type >::m_data.
|
inlineoverrideprotectedvirtual |
Returns a pointer to the data element.
Implements Mantid::API::Column.
Definition at line 213 of file TableColumn.h.
References index, and Mantid::DataObjects::TableColumn< Type >::m_data.
|
friend |
Definition at line 220 of file TableColumn.h.
|
private |
Column data.
Definition at line 219 of file TableColumn.h.
Referenced by Mantid::DataObjects::TableColumn< Type >::compareVectors(), Mantid::DataObjects::TableColumn< Type >::compareVectors(), Mantid::DataObjects::TableColumn< Type >::compareVectorsRelError(), Mantid::DataObjects::TableColumn< Type >::compareVectorsRelError(), Mantid::DataObjects::TableColumn< Type >::data(), Mantid::DataObjects::TableColumn< Type >::data(), Mantid::DataObjects::TableColumn< Type >::dataArray(), Mantid::DataObjects::TableColumn< Type >::fromDouble(), Mantid::DataObjects::TableColumn< Type >::insert(), Mantid::DataObjects::TableColumn< Type >::operator[](), Mantid::DataObjects::TableColumn< Type >::print(), Mantid::DataObjects::TableColumn< Type >::remove(), Mantid::DataObjects::TableColumn< Type >::resize(), Mantid::DataObjects::TableColumn< Type >::size(), Mantid::DataObjects::TableColumn< Type >::sizeOfData(), Mantid::DataObjects::TableColumn< Type >::toDouble(), Mantid::DataObjects::TableColumn< Type >::void_pointer(), and Mantid::DataObjects::TableColumn< Type >::void_pointer().