diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Measurement.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Measurement.h index a6fb53be0eb8ef208815d60cc6c616211e8099ba..d2f441c9c32738acb43879f85a87d6d74ac61b52 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Measurement.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Measurement.h @@ -33,7 +33,7 @@ namespace CustomInterfaces { class MANTIDQT_CUSTOMINTERFACES_DLL Measurement { public: - typedef const std::string IDType; + typedef std::string IDType; /// Constructor Measurement(const IDType &measurementId, const IDType &subId, @@ -41,7 +41,7 @@ public: const double angle, const std::string &run); /// Constructional method - static Measurement InvalidMeasurement(const std::string& why); + static Measurement InvalidMeasurement(const std::string &why); /// Copy constructor Measurement(const Measurement &other); @@ -58,19 +58,19 @@ public: std::string label() const; double angle() const; std::string angleStr() const; + Measurement &operator=(const Measurement &); private: /// Constructor - Measurement(const std::string& why); - const IDType m_measurementId; - const IDType m_subId; - const std::string m_label; - const std::string m_type; - const double m_angle; - const std::string m_run; + Measurement(const std::string &why); + IDType m_measurementId; + IDType m_subId; + std::string m_label; + std::string m_type; + double m_angle; + std::string m_run; std::string m_whyUnuseable; /// Not assignable - Measurement &operator=(const Measurement &); }; } // namespace CustomInterfaces diff --git a/MantidQt/CustomInterfaces/src/Measurement.cpp b/MantidQt/CustomInterfaces/src/Measurement.cpp index 6b21601cd72a5ce1d73a5880300691e35f7145fb..1b0225105ea18fe808d34805948a29ab2b263c32 100644 --- a/MantidQt/CustomInterfaces/src/Measurement.cpp +++ b/MantidQt/CustomInterfaces/src/Measurement.cpp @@ -78,6 +78,19 @@ std::string Measurement::angleStr() const { return buffer.str(); } +Measurement &Measurement::operator=(const Measurement &other) { + if (&other != this) { + m_measurementId = other.id(); + m_subId = other.subId(); + m_label = other.label(); + m_type = other.type(); + m_angle = other.angle(); + m_run = other.run(); + m_whyUnuseable = other.whyUnuseable(); + } + return *this; +} + std::string Measurement::whyUnuseable() const { return m_whyUnuseable; } } // namespace CustomInterfaces diff --git a/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp b/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp index 246210109a9302d0ce903b24d4118b427e7991c4..c07c22422b55238a3eb196e46e6f010135b5a66c 100644 --- a/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp +++ b/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp @@ -50,7 +50,7 @@ public: ReflProgress( double start, double end, int64_t nSteps, MantidQt::CustomInterfaces::ProgressableView *const progressableView) - : ProgressBase(start, end, nSteps), m_progressableView(progressableView) { + : ProgressBase(static_cast<int>(start), static_cast<int>(end), static_cast<int>(nSteps)), m_progressableView(progressableView) { if (!progressableView) { throw std::runtime_error("ProgressableView is null"); } @@ -1509,7 +1509,7 @@ void ReflMainViewPresenter::transfer() { runs[run] = searchResult; } - ReflProgress progress(0, selectedRows.size(), selectedRows.size(), + ReflProgress progress(0, static_cast<double>(selectedRows.size()), static_cast<double>(selectedRows.size()), this->m_progressView); auto newRows = getTransferStrategy()->transferRuns(runs, progress); diff --git a/MantidQt/CustomInterfaces/src/ReflMeasureTransferStrategy.cpp b/MantidQt/CustomInterfaces/src/ReflMeasureTransferStrategy.cpp index c9aa8782cbf6bb3a37e1c7ee49b326653ee078a3..3ccf8b5bfa4de1c30f6afc6684b2804710eea0c2 100644 --- a/MantidQt/CustomInterfaces/src/ReflMeasureTransferStrategy.cpp +++ b/MantidQt/CustomInterfaces/src/ReflMeasureTransferStrategy.cpp @@ -11,6 +11,7 @@ #include <utility> #include <limits> #include <set> +#include <sstream> using namespace Mantid::Kernel; @@ -96,7 +97,9 @@ MantidQt::CustomInterfaces::ReflMeasureTransferStrategy::transferRuns( std::map<std::string, std::string> row; row[ReflTableSchema::RUNS] = measurement.run(); row[ReflTableSchema::ANGLE] = measurement.angleStr(); - row[ReflTableSchema::GROUP] = nextGroupId; + std::stringstream buffer; + buffer << nextGroupId; + row[ReflTableSchema::GROUP] = buffer.str(); subIdMap.insert(std::make_pair(measurement.subId(), i)); output.push_back(row); } diff --git a/MantidQt/CustomInterfaces/test/ReflMeasureTransferStrategyTest.h b/MantidQt/CustomInterfaces/test/ReflMeasureTransferStrategyTest.h index e46cdabfc0b55c3157194c7a69c4bf7626ebf209..9e03dee9fce79536f067335c678ddc9fa0dcf20c 100644 --- a/MantidQt/CustomInterfaces/test/ReflMeasureTransferStrategyTest.h +++ b/MantidQt/CustomInterfaces/test/ReflMeasureTransferStrategyTest.h @@ -45,19 +45,19 @@ public: // We expect that we are going to fetch the measurement data for every // search result. EXPECT_CALL(*mockMeasurementSource, obtain(_, _)) - .Times(Exactly(data.size())) + .Times(Exactly(static_cast<int>(data.size()))) .WillRepeatedly(Return(Measurement("a", "s_a", "l", "t", 0, "111"))); auto mockCatInfo = new MockICatalogInfo; // We expect that every location will be translated/transformed to make it // os specific EXPECT_CALL(*mockCatInfo, transformArchivePath(_)) - .Times(Exactly(data.size())) + .Times(Exactly(static_cast<int>(data.size()))) .WillRepeatedly(Return(std::string())); MockProgressBase progress; // We expect a progress update on each transfer - EXPECT_CALL(progress, doReport(_)).Times(Exactly(data.size())); + EXPECT_CALL(progress, doReport(_)).Times(Exactly(static_cast<int>(data.size()))); ReflMeasureTransferStrategy strategy( std::move(std::unique_ptr<MockICatalogInfo>(mockCatInfo)), @@ -86,7 +86,7 @@ public: // We are going to return three SearchResults two have the same measurement // id EXPECT_CALL(*mockMeasurementSource, obtain(_, _)) - .Times(Exactly(data.size())) + .Times(Exactly(static_cast<int>(data.size()))) .WillOnce(Return(Measurement("m1", "s1", "l1", "t1", 0.1, "111"))) .WillOnce(Return(Measurement("m1", "s2", "l1", "t1", 0.2, "122"))) .WillOnce(Return(Measurement("m2", "s2", "l1", "t1", 0.2, "123"))); @@ -95,12 +95,12 @@ public: // We expect that every location will be translated/transformed to make it // os specific EXPECT_CALL(*mockCatInfo, transformArchivePath(_)) - .Times(Exactly(data.size())) + .Times(Exactly(static_cast<int>(data.size()))) .WillRepeatedly(Return(std::string())); MockProgressBase progress; // Expect a progress update - EXPECT_CALL(progress, doReport(_)).Times(Exactly(data.size())); + EXPECT_CALL(progress, doReport(_)).Times(Exactly(static_cast<int>(data.size()))); // Make the transfer stragegy ReflMeasureTransferStrategy strategy( @@ -147,7 +147,7 @@ public: auto mockMeasurementSource = new MockReflMeasurementSource; // All 3 have same measurment id, but we also have 2 with same sub id. EXPECT_CALL(*mockMeasurementSource, obtain(_, _)) - .Times(Exactly(data.size())) + .Times(Exactly(static_cast<int>(data.size()))) .WillOnce(Return(Measurement("m1", "s1", "l1", "t1", 0.1, "111"))) .WillOnce(Return(Measurement("m1", "s1", "l1", "t1", 0.2, "122"))) .WillOnce(Return(Measurement("m1", "s2", "l1", "t1", 0.2, "123"))); @@ -156,12 +156,12 @@ public: // We expect that every location will be translated/transformed to make it // os specific EXPECT_CALL(*mockCatInfo, transformArchivePath(_)) - .Times(Exactly(data.size())) + .Times(Exactly(static_cast<int>(data.size()))) .WillRepeatedly(Return(std::string())); MockProgressBase progress; // Expect a progress update - EXPECT_CALL(progress, doReport(_)).Times(Exactly(data.size())); + EXPECT_CALL(progress, doReport(_)).Times(Exactly(static_cast<int>(data.size()))); // Make the transfer stragegy ReflMeasureTransferStrategy strategy( @@ -203,14 +203,14 @@ public: // We expect that we are going to fetch the measurement data for every // search result. EXPECT_CALL(*mockMeasurementSource, obtain(_, _)) - .Times(Exactly(data.size())) + .Times(Exactly(static_cast<int>(data.size()))) .WillRepeatedly(Return(Measurement::InvalidMeasurement("Abort!"))); auto mockCatInfo = new MockICatalogInfo; // We expect that every location will be translated/transformed to make it // os specific EXPECT_CALL(*mockCatInfo, transformArchivePath(_)) - .Times(Exactly(data.size())); + .Times(Exactly(static_cast<int>(data.size()))); MockProgressBase progress; // Nothing obtained. No progress to report.