Newer
Older
Janik Zikovsky
committed
#ifndef MANTID_DATAOBJECTS_PEAKCOLUMN_H_
#define MANTID_DATAOBJECTS_PEAKCOLUMN_H_
Janik Zikovsky
committed
#include "MantidAPI/Column.h"
#include "MantidDataObjects/Peak.h"
#include <boost/variant.hpp>
Janik Zikovsky
committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
namespace Mantid {
namespace DataObjects {
/** 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
*/
class DLLExport PeakColumn : public Mantid::API::Column {
public:
/// Construct a column with a reference to the peaks list, a name & type
PeakColumn(std::vector<Peak> &peaks, const std::string &name);
virtual ~PeakColumn();
/// Number of individual elements in the column.
virtual size_t size() const { return m_peaks.size(); }
/// Returns typeid for the data in the column
virtual const std::type_info &get_type_info() const;
/// Returns typeid for the pointer type to the data element in the column
virtual const std::type_info &get_pointer_type_info() const;
virtual bool getReadOnly() const;
/// Prints
virtual void print(size_t index, std::ostream &s) const;
virtual void read(size_t index, const std::string &text);
/// Specialized type check
virtual bool isBool() const;
/// Must return overall memory size taken by the column.
virtual long int sizeOfData() const;
/// Clone.
virtual PeakColumn *clone() const;
/// Cast to double
virtual double toDouble(size_t i) const;
/// Assign from double
virtual void fromDouble(size_t i, double value);
protected:
/// Sets the new column size.
virtual void resize(size_t count);
/// Inserts an item.
virtual void insert(size_t index);
/// Removes an item.
virtual void remove(size_t index);
/// Pointer to a data element
virtual void *void_pointer(size_t index);
/// Pointer to a data element
virtual const void *void_pointer(size_t index) const;
private:
/// Reference to the peaks object saved in the PeaksWorkspace.
std::vector<Peak> &m_peaks;
/// Precision of hkl in table workspace
int m_hklPrec;
Janik Zikovsky
committed
/// Type of the row cache value
typedef boost::variant<double, int, std::string, Kernel::V3D> CacheValueType;
///
mutable std::list<CacheValueType> m_oldRows;
};
Janik Zikovsky
committed
} // namespace Mantid
} // namespace DataObjects
#endif /* MANTID_DATAOBJECTS_PEAKCOLUMN_H_ */