Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Mantid::API::Column Class Referenceabstract

Column is the base class for columns of TableWorkspace. More...

#include <Column.h>

Inheritance diagram for Mantid::API::Column:
Mantid::DataObjects::PeakColumn< Mantid::DataObjects::LeanElasticPeak > Mantid::DataObjects::PeakColumn< Mantid::DataObjects::Peak > Mantid::DataObjects::TableColumn< T > Mantid::DataObjects::TableColumn< API::Boolean > ColumnTester Mantid::DataObjects::PeakColumn< T > Mantid::DataObjects::TableColumn< Type > Mantid::DataObjects::VectorColumn< Type >

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 Columnclone () 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
 

Detailed Description

Column is the base class for columns of TableWorkspace.

Author
Roman Tolchenov
Date
31/10/2008

Definition at line 35 of file Column.h.

Constructor & Destructor Documentation

◆ Column()

Mantid::API::Column::Column ( )
inline

Definition at line 37 of file Column.h.

◆ ~Column()

virtual Mantid::API::Column::~Column ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ cell() [1/2]

template<class T >
T & Mantid::API::Column::cell ( size_t  index)
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().

◆ cell() [2/2]

template<class T >
const T & Mantid::API::Column::cell ( size_t  index) const
inline

Templated method for returning a value (const version).

No type checks are done.

Definition at line 131 of file Column.h.

References index.

◆ clone()

virtual Column * Mantid::API::Column::clone ( ) const
pure virtual

◆ equals()

virtual bool Mantid::API::Column::equals ( const Column ,
double   
) const
inlinevirtual

◆ equalsRelErr()

virtual bool Mantid::API::Column::equalsRelErr ( const Column ,
double   
) const
inlinevirtual

◆ fromDouble()

virtual void Mantid::API::Column::fromDouble ( size_t  index,
double  value 
)
pure virtual

◆ get_pointer_type_info()

virtual const std::type_info & Mantid::API::Column::get_pointer_type_info ( ) const
pure virtual

◆ get_type_info()

virtual const std::type_info & Mantid::API::Column::get_type_info ( ) const
pure virtual

◆ getLinkedYCol()

int Mantid::API::Column::getLinkedYCol ( ) const
inline

Definition at line 144 of file Column.h.

◆ getPlotType()

int Mantid::API::Column::getPlotType ( ) const
inline

get plot type

Returns
See description of setPlotType() for the interpretation of the returned int

Definition at line 139 of file Column.h.

◆ getReadOnly()

virtual bool Mantid::API::Column::getReadOnly ( ) const
inlinevirtual

◆ insert()

virtual void Mantid::API::Column::insert ( size_t  index)
protectedpure virtual

◆ isBool()

virtual bool Mantid::API::Column::isBool ( ) const
pure virtual

◆ isNumber()

virtual bool Mantid::API::Column::isNumber ( ) const
pure virtual

◆ isType() [1/2]

template<class T >
bool Mantid::API::Column::isType ( ) const
inline

Type check.

Definition at line 134 of file Column.h.

◆ isType() [2/2]

template<>
bool Mantid::API::Column::isType ( ) const

Definition at line 21 of file Column.cpp.

References isBool().

◆ name()

const std::string & Mantid::API::Column::name ( ) const
inline

◆ numeric_fill()

template<class T = double>
std::vector< T > Mantid::API::Column::numeric_fill ( size_t  maxSize = std::numeric_limits<size_t>::max()) const
inline

Fills a std vector with values from the column if the types are compatible.

Parameters
maxSize:: Set size to less than the full column.

Definition at line 152 of file Column.h.

◆ operator[]()

virtual double Mantid::API::Column::operator[] ( size_t  i) const
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.

◆ possibleToCompare()

bool Mantid::API::Column::possibleToCompare ( const Column otherColumn) const
inlineprotected

◆ print()

virtual void Mantid::API::Column::print ( size_t  index,
std::ostream &  s 
) const
pure virtual

◆ read() [1/2]

virtual void Mantid::API::Column::read ( const size_t  index,
std::istringstream &  in 
)
inlinevirtual

◆ read() [2/2]

virtual void Mantid::API::Column::read ( size_t  index,
const std::string &  text 
)
inlinevirtual

◆ remove()

virtual void Mantid::API::Column::remove ( size_t  index)
protectedpure virtual

◆ resize()

virtual void Mantid::API::Column::resize ( size_t  count)
protectedpure virtual

◆ setLinkedYCol()

void Mantid::API::Column::setLinkedYCol ( const int  yCol)

Definition at line 36 of file Column.cpp.

References m_linkedYCol.

◆ setName()

void Mantid::API::Column::setName ( const std::string &  str)
inline

Renames the column.

Definition at line 53 of file Column.h.

◆ setPlotType()

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.

Parameters
tplot type as defined above

Definition at line 28 of file Column.cpp.

References Mantid::Kernel::Logger::error(), Mantid::API::g_log, and m_plotType.

◆ setReadOnly()

void Mantid::API::Column::setReadOnly ( bool  isReadOnly)
inline

Sets column read-only flag.

Definition at line 68 of file Column.h.

◆ size()

virtual size_t Mantid::API::Column::size ( ) const
pure virtual

◆ sizeOfData()

virtual long int Mantid::API::Column::sizeOfData ( ) const
pure virtual

◆ sortIndex()

void Mantid::API::Column::sortIndex ( bool  ascending,
size_t  start,
size_t  end,
std::vector< size_t > &  indexVec,
std::vector< std::pair< size_t, size_t > > &  equalRanges 
) const
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.

Parameters
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.

◆ sortValues()

void Mantid::API::Column::sortValues ( const std::vector< size_t > &  indexVec)
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.

◆ toDouble()

virtual double Mantid::API::Column::toDouble ( size_t  index) const
pure virtual

◆ type()

const std::string & Mantid::API::Column::type ( ) const
inline

◆ void_pointer() [1/2]

virtual const void * Mantid::API::Column::void_pointer ( size_t  index) const
protectedpure virtual

◆ void_pointer() [2/2]

virtual void * Mantid::API::Column::void_pointer ( size_t  index)
protectedpure virtual

Friends And Related Function Documentation

◆ ColumnFactoryImpl

friend class ColumnFactoryImpl
friend

Definition at line 200 of file Column.h.

◆ ColumnVector

template<class T >
friend class ColumnVector
friend

Definition at line 202 of file Column.h.

◆ ITableWorkspace

friend class ITableWorkspace
friend

Definition at line 201 of file Column.h.

Member Data Documentation

◆ m_isReadOnly

bool Mantid::API::Column::m_isReadOnly
protected

Column read-only flag.

Definition at line 198 of file Column.h.

◆ m_linkedYCol

int Mantid::API::Column::m_linkedYCol = -1
protected

For error columns - the index of the related data column.

Definition at line 195 of file Column.h.

Referenced by setLinkedYCol().

◆ m_name

std::string Mantid::API::Column::m_name
protected

name

Definition at line 185 of file Column.h.

◆ m_plotType

int Mantid::API::Column::m_plotType
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().

◆ m_type

std::string Mantid::API::Column::m_type
protected

type

Definition at line 186 of file Column.h.

Referenced by sortIndex(), sortValues(), and Mantid::DataObjects::TableColumn< Type >::TableColumn().


The documentation for this class was generated from the following files: