Mantid
Loading...
Searching...
No Matches
PeakShapeBase.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
9#include <json/json.h>
10
11#include <utility>
12
13namespace Mantid::DataObjects {
14
15PeakShapeBase::PeakShapeBase(Kernel::SpecialCoordinateSystem frame, std::string algorithmName, int algorithmVersion)
16 : m_frame(frame), m_algorithmName(std::move(algorithmName)), m_algorithmVersion(algorithmVersion) {}
17
23
29void PeakShapeBase::buildCommon(Json::Value &root) const {
30 Json::Value shape(this->shapeName());
31 Json::Value algorithmName(this->algorithmName());
32 Json::Value algorithmVersion(this->algorithmVersion());
33 Json::Value frame(this->frame());
34 root["shape"] = shape;
35 root["algorithm_name"] = algorithmName;
36 root["algorithm_version"] = algorithmVersion;
37 root["frame"] = frame;
38}
39
44std::string PeakShapeBase::algorithmName() const { return m_algorithmName; }
45
51
52bool PeakShapeBase::operator==(const PeakShapeBase &other) const { return other.frame() == this->frame(); }
53
54} // namespace Mantid::DataObjects
PeakShapeBase : Base class for concrete PeakShapes containing common code.
Definition: PeakShapeBase.h:26
Mantid::Kernel::SpecialCoordinateSystem m_frame
Special coordinate system.
Definition: PeakShapeBase.h:47
std::string m_algorithmName
Generating algorithm name.
Definition: PeakShapeBase.h:50
std::string algorithmName() const override
Get the name of the algorithm used to make this shape.
void buildCommon(Json::Value &root) const
Build common parts of outgoing JSON serialization.
bool operator==(const PeakShapeBase &other) const
Equals operator.
Kernel::SpecialCoordinateSystem frame() const override
Get the coordinate frame.
int algorithmVersion() const override
Get the version of the algorithm used to make this shape.
PeakShapeBase(Kernel::SpecialCoordinateSystem frame, std::string algorithmName=std::string(), int algorithmVersion=-1)
Constructor.
int m_algorithmVersion
Generating algorithm version.
Definition: PeakShapeBase.h:53
virtual std::string shapeName() const =0
Shape name.
SpecialCoordinateSystem
Special coordinate systems for Q3D.
STL namespace.