Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Mantid::DataObjects::PeakColumn< T > Class Template Reference

PeakColumn : a Column sub-class used to display peak information as a TableWorkspace. More...

#include <PeakColumn.h>

Inheritance diagram for Mantid::DataObjects::PeakColumn< T >:
Mantid::API::Column

Public Member Functions

PeakColumnclone () const override
 Clone. More...
 
const std::vector< T > & data () const
 Reference to the data. More...
 
bool equals (const Column &otherColumn, double tolerance) const override
 
void fromDouble (size_t i, double value) override
 Assign from double. More...
 
const std::type_info & get_pointer_type_info () const override
 Returns typeid for the pointer type to the data element in the column. More...
 
const std::type_info & get_type_info () const override
 Returns typeid for the data in the column. More...
 
bool getReadOnly () const override
 
bool isBool () const override
 Specialized type check. More...
 
bool isNumber () const override
 Are elements of the column interpretable as a number? More...
 
 PeakColumn (std::vector< T > &peaks, const std::string &name)
 Construct a column with a reference to the peaks list, a name & type. More...
 
void print (size_t index, std::ostream &s) const override
 Prints. More...
 
void read (const size_t index, std::istringstream &in) override
 Sets item from a stream. More...
 
void read (size_t index, const std::string &text) override
 Read in some text and convert to a number in the PeaksWorkspace. More...
 
size_t size () const override
 Number of individual elements in the column. More...
 
long int sizeOfData () const override
 Must return overall memory size taken by the column. More...
 
double toDouble (size_t i) const override
 Cast to double. More...
 
- 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. 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

void insert (size_t index) override
 Inserts an item. More...
 
void remove (size_t index) override
 Removes an item. More...
 
void resize (size_t count) override
 Sets the new column size. More...
 
const void * void_pointer (size_t index) const override
 Pointer to a data element. More...
 
void * void_pointer (size_t index) override
 Pointer to a data element. More...
 
- Protected Member Functions inherited from Mantid::API::Column
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...
 

Private Types

using CacheValueType = boost::variant< double, int, std::string, Kernel::V3D >
 Type of the row cache value. More...
 

Private Member Functions

void setPeakHKLOrRunNumber (const size_t index, const double val)
 Sets the correct value in the referenced peak. More...
 

Private Attributes

int m_hklPrec
 Precision of hkl in table workspace. More...
 
std::list< CacheValueTypem_oldRows
 
std::vector< T > & m_peaks
 Reference to the peaks object saved in the PeaksWorkspace. More...
 

Additional Inherited Members

- Protected Attributes inherited from Mantid::API::Column
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...
 

Detailed Description

template<class T>
class Mantid::DataObjects::PeakColumn< T >

PeakColumn : a Column sub-class used to display peak information as a TableWorkspace.

The column holds a reference to a vector of Peak objects. Values in the column are taken directly from those Peak objects.

Author
Janik Zikovsky
Date
2011-04-25 18:06:32.952258

Definition at line 28 of file PeakColumn.h.

Member Typedef Documentation

◆ CacheValueType

template<class T >
using Mantid::DataObjects::PeakColumn< T >::CacheValueType = boost::variant<double, int, std::string, Kernel::V3D>
private

Type of the row cache value.

Definition at line 98 of file PeakColumn.h.

Constructor & Destructor Documentation

◆ PeakColumn()

template<class T >
Mantid::DataObjects::PeakColumn< T >::PeakColumn ( std::vector< T > &  peaks,
const std::string &  name 
)

Construct a column with a reference to the peaks list, a name & type.

Constructor.

Parameters
peaks:: vector of peaks
name:: name for the column

Definition at line 86 of file PeakColumn.cpp.

Member Function Documentation

◆ clone()

template<class T >
PeakColumn< T > * Mantid::DataObjects::PeakColumn< T >::clone
overridevirtual

Clone.

Implements Mantid::API::Column.

Definition at line 322 of file PeakColumn.cpp.

◆ data()

template<class T >
const std::vector< T > & Mantid::DataObjects::PeakColumn< T >::data ( ) const
inline

Reference to the data.

Definition at line 71 of file PeakColumn.h.

◆ equals()

template<class T >
bool Mantid::DataObjects::PeakColumn< T >::equals ( const Column otherColumn,
double  tolerance 
) const
inlineoverridevirtual

Reimplemented from Mantid::API::Column.

Definition at line 73 of file PeakColumn.h.

References tolerance.

◆ fromDouble()

template<class T >
void Mantid::DataObjects::PeakColumn< T >::fromDouble ( size_t  i,
double  value 
)
overridevirtual

Assign from double.

Implements Mantid::API::Column.

Definition at line 332 of file PeakColumn.cpp.

◆ get_pointer_type_info()

template<class T >
const std::type_info & Mantid::DataObjects::PeakColumn< T >::get_pointer_type_info
overridevirtual

Returns typeid for the pointer type to the data element in the column.

Implements Mantid::API::Column.

Definition at line 119 of file PeakColumn.cpp.

◆ get_type_info()

template<class T >
const std::type_info & Mantid::DataObjects::PeakColumn< T >::get_type_info
overridevirtual

Returns typeid for the data in the column.

Implements Mantid::API::Column.

Definition at line 99 of file PeakColumn.cpp.

◆ getReadOnly()

template<class T >
bool Mantid::DataObjects::PeakColumn< T >::getReadOnly
overridevirtual
Returns
true if the column is read-only

Reimplemented from Mantid::API::Column.

Definition at line 212 of file PeakColumn.cpp.

◆ insert()

template<class T >
void Mantid::DataObjects::PeakColumn< T >::insert ( size_t  index)
overrideprotectedvirtual

Inserts an item.

Inserts an item into the column.

Not implemented as this is controlled by the PeaksWorkspace

Parameters
index:: The new index position (unused)
Exceptions
Exception::NotImplementedError

Implements Mantid::API::Column.

Definition at line 246 of file PeakColumn.cpp.

References index, and UNUSED_ARG.

◆ isBool()

template<class T >
bool Mantid::DataObjects::PeakColumn< T >::isBool
overridevirtual

Specialized type check.

Implements Mantid::API::Column.

Definition at line 218 of file PeakColumn.cpp.

◆ isNumber()

template<class T >
bool Mantid::DataObjects::PeakColumn< T >::isNumber ( ) const
overridevirtual

Are elements of the column interpretable as a number?

Implements Mantid::API::Column.

Definition at line 220 of file PeakColumn.cpp.

◆ print()

template<class T >
void Mantid::DataObjects::PeakColumn< T >::print ( size_t  index,
std::ostream &  s 
) const
overridevirtual

Prints.

Prints out the column string at the given row index.

Parameters
s:: stream to output
index:: row index

Implements Mantid::API::Column.

Definition at line 139 of file PeakColumn.cpp.

References index.

◆ read() [1/2]

template<class T >
void Mantid::DataObjects::PeakColumn< T >::read ( const size_t  index,
std::istringstream &  in 
)
overridevirtual

Sets item from a stream.

Read in from stream and convert to a number in the PeaksWorkspace.

Parameters
index:: index of the peak to modify
in:: input stream

Reimplemented from Mantid::API::Column.

Definition at line 195 of file PeakColumn.cpp.

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

◆ read() [2/2]

template<class T >
void Mantid::DataObjects::PeakColumn< T >::read ( size_t  index,
const std::string &  text 
)
overridevirtual

Read in some text and convert to a number in the PeaksWorkspace.

Parameters
text:: string to read
index:: index of the peak to modify

Reimplemented from Mantid::API::Column.

Definition at line 174 of file PeakColumn.cpp.

References Mantid::Kernel::Strings::convert(), Mantid::Kernel::Logger::error(), Mantid::API::g_log, and index.

◆ remove()

template<class T >
void Mantid::DataObjects::PeakColumn< T >::remove ( size_t  index)
overrideprotectedvirtual

Removes an item.

Removes an item from the column.

Not implemented as this is controlled by the PeaksWorkspace

Parameters
index:: The index position removed(unused)
Exceptions
Exception::NotImplementedError

Implements Mantid::API::Column.

Definition at line 259 of file PeakColumn.cpp.

References index, and UNUSED_ARG.

◆ resize()

template<class T >
void Mantid::DataObjects::PeakColumn< T >::resize ( size_t  count)
overrideprotectedvirtual

Sets the new column size.

Sets a new size for the column.

Not implemented as this is controlled by the PeaksWorkspace

Parameters
count:: Count of new column size (unused)
Exceptions
Exception::NotImplementedError

Implements Mantid::API::Column.

Definition at line 233 of file PeakColumn.cpp.

References count, and UNUSED_ARG.

◆ setPeakHKLOrRunNumber()

template<class T >
void Mantid::DataObjects::PeakColumn< T >::setPeakHKLOrRunNumber ( const size_t  index,
const double  val 
)
private

Sets the correct value in the referenced peak.

Definition at line 337 of file PeakColumn.cpp.

References index.

◆ size()

template<class T >
size_t Mantid::DataObjects::PeakColumn< T >::size ( ) const
inlineoverridevirtual

Number of individual elements in the column.

Implements Mantid::API::Column.

Definition at line 35 of file PeakColumn.h.

◆ sizeOfData()

template<class T >
long int Mantid::DataObjects::PeakColumn< T >::sizeOfData
overridevirtual

Must return overall memory size taken by the column.

Returns
overall memory size taken by the column.

Implements Mantid::API::Column.

Definition at line 223 of file PeakColumn.cpp.

◆ toDouble()

template<class T >
double Mantid::DataObjects::PeakColumn< T >::toDouble ( size_t  i) const
overridevirtual

Cast to double.

Implements Mantid::API::Column.

Definition at line 327 of file PeakColumn.cpp.

◆ void_pointer() [1/2]

template<class T >
const void * Mantid::DataObjects::PeakColumn< T >::void_pointer ( size_t  index) const
overrideprotectedvirtual

Pointer to a data element.

Pointer to a data element in the PeaksWorkspace (const version)

Parameters
index:: A row index pointing to the PeaksWorkspace
Returns
A pointer to the data element at that index from this column

Implements Mantid::API::Column.

Definition at line 281 of file PeakColumn.cpp.

References index, and value.

◆ void_pointer() [2/2]

template<class T >
void * Mantid::DataObjects::PeakColumn< T >::void_pointer ( size_t  index)
overrideprotectedvirtual

Pointer to a data element.

Pointer to a data element in the PeaksWorkspace (non-const version)

Parameters
index:: A row index pointing to the PeaksWorkspace
Returns
A pointer to the data element at that index from this column

Implements Mantid::API::Column.

Definition at line 271 of file PeakColumn.cpp.

References index.

Member Data Documentation

◆ m_hklPrec

template<class T >
int Mantid::DataObjects::PeakColumn< T >::m_hklPrec
private

Precision of hkl in table workspace.

Definition at line 95 of file PeakColumn.h.

◆ m_oldRows

template<class T >
std::list<CacheValueType> Mantid::DataObjects::PeakColumn< T >::m_oldRows
mutableprivate

Definition at line 100 of file PeakColumn.h.

◆ m_peaks

template<class T >
std::vector<T>& Mantid::DataObjects::PeakColumn< T >::m_peaks
private

Reference to the peaks object saved in the PeaksWorkspace.

Definition at line 93 of file PeakColumn.h.


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