Newer
Older
#include "MantidDataObjects/PeakShapeBase.h"
#include "MantidAPI/SpecialCoordinateSystem.h"
#include <jsoncpp/json/json.h>
namespace Mantid {
namespace DataObjects {
PeakShapeBase::PeakShapeBase(API::SpecialCoordinateSystem frame,
std::string algorithmName, int algorithmVersion)
: m_frame(frame), m_algorithmName(algorithmName),
m_algorithmVersion(algorithmVersion) {}
//----------------------------------------------------------------------------------------------
/** Destructor
*/
PeakShapeBase::~PeakShapeBase() {}
/**
* @brief Copy constructor
* @param other : source of the copy
*/
PeakShapeBase::PeakShapeBase(const PeakShapeBase &other): m_frame(other.frame()),
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
m_algorithmName(other.algorithmName()),
m_algorithmVersion(other.algorithmVersion()) {}
/**
* @brief Assignment operator
* @param other : source of the assignment
* @return Ref to assigned object.
*/
PeakShapeBase &PeakShapeBase::operator=(const PeakShapeBase &other) {
if (this != &other) {
m_algorithmName = other.algorithmName();
m_algorithmVersion = other.algorithmVersion();
m_frame = other.frame();
}
return *this;
}
/**
* @brief PeakShapeBase::frame
* @return The coordinate frame used
*/
API::SpecialCoordinateSystem PeakShapeBase::frame() const { return m_frame; }
/**
* @brief PeakShapeBase::buildCommon. Serialize to JSON object and return the
* JSON value for further modification
* @param root : Ref to root value to write to
*/
void PeakShapeBase::buildCommon(Json::Value &root) const {
Json::Value shape(this->shapeName());
Json::Value algorithmName(this->algorithmName());
Json::Value algorithmVersion(this->algorithmVersion());
Json::Value frame(this->frame());
root["shape"] = shape;
root["algorithm_name"] = algorithmName;
root["algorithm_version"] = algorithmVersion;
root["frame"] = frame;
}
/**
* @brief Get the algorithm name
* @return Algorithm name
*/
std::string PeakShapeBase::algorithmName() const { return m_algorithmName; }
/**
* @brief Get the algorithmVersion
* @return Algorithm version
*/
int PeakShapeBase::algorithmVersion() const { return m_algorithmVersion; }
bool PeakShapeBase::operator==(const PeakShapeBase &other) const {
return other.frame() == this->frame();
}
} // namespace DataObjects
} // namespace Mantid