Skip to content
Snippets Groups Projects
Commit 8ba61705 authored by Owen Arnold's avatar Owen Arnold
Browse files

refs #12185. MDHistoDimensionBuilder now uses UnitLabel.

parent 951173b0
No related merge requests found
......@@ -2,6 +2,7 @@
#define MANTID_GEOMETRY_MDHISTODIMENSION_BUILDER_H_
#include "MantidGeometry/MDGeometry/MDHistoDimension.h"
#include "MantidKernel/UnitLabel.h"
namespace Mantid {
namespace Geometry {
......@@ -23,7 +24,7 @@ public:
~MDHistoDimensionBuilder();
void setName(std::string name);
void setId(std::string id);
void setUnits(std::string units);
void setUnits(const Kernel::UnitLabel& units);
void setMin(double min);
void setMax(double max);
void setNumBins(size_t nbins);
......@@ -40,7 +41,7 @@ private:
/// Cached id
std::string m_id;
/// Cached units
std::string m_units;
Kernel::UnitLabel m_units;
/// Cached min
double m_min;
/// Cached max
......@@ -58,4 +59,4 @@ typedef std::vector<MDHistoDimensionBuilder> Vec_MDHistoDimensionBuilder;
}
}
#endif
\ No newline at end of file
#endif
#include "MantidGeometry/MDGeometry/MDHistoDimensionBuilder.h"
#include "MantidKernel/Strings.h"
#include "MantidKernel/UnitLabelTypes.h"
namespace Mantid {
namespace Geometry {
/// Constructor
MDHistoDimensionBuilder::MDHistoDimensionBuilder()
: m_min(0), m_max(0), m_nbins(0), m_minSet(false), m_maxSet(false) {}
: m_units(Kernel::Units::Symbol::EmptyLabel), m_min(0), m_max(0), m_nbins(0), m_minSet(false), m_maxSet(false) {}
/// Destructor
MDHistoDimensionBuilder::~MDHistoDimensionBuilder() {}
......@@ -59,7 +60,7 @@ void MDHistoDimensionBuilder::setId(std::string id) { m_id = id; }
Setter for the dimension units
@param units : unit type of dimension
*/
void MDHistoDimensionBuilder::setUnits(std::string units) { m_units = units; }
void MDHistoDimensionBuilder::setUnits(const Kernel::UnitLabel& units) { m_units = units; }
/*
Setter for the dimension min
......@@ -98,7 +99,7 @@ MDHistoDimension *MDHistoDimensionBuilder::createRaw() {
throw std::invalid_argument(
"Cannot create MDHistogramDimension without setting a id.");
}
if (m_units.empty()) {
if (m_units.ascii().empty()) {
throw std::invalid_argument(
"Cannot create MDHistogramDimension without setting a unit type.");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment