From 2cf4753b6ec6d85b1e501cd19cbf55e72087b10f Mon Sep 17 00:00:00 2001 From: Edward Brown <edward.brown@stfc.ac.uk> Date: Mon, 29 Jan 2018 10:06:08 +0000 Subject: [PATCH] Revert "Re #21543: Added function mandatoryVaraint to be compatible with RHEL." This reverts commit 68bf6790be24e4182bc0fd4a95f108a9671f3a93. --- .../ISISReflectometry/InstrumentParameters.h | 40 +++---------------- .../ReflSettingsPresenter.cpp | 2 +- 2 files changed, 7 insertions(+), 35 deletions(-) diff --git a/qt/scientific_interfaces/ISISReflectometry/InstrumentParameters.h b/qt/scientific_interfaces/ISISReflectometry/InstrumentParameters.h index b0921e2b6a8..f56611a2bb4 100644 --- a/qt/scientific_interfaces/ISISReflectometry/InstrumentParameters.h +++ b/qt/scientific_interfaces/ISISReflectometry/InstrumentParameters.h @@ -16,14 +16,6 @@ firstFromParameterFile(Mantid::Geometry::Instrument_const_sptr instrument, return first(getInstrumentParameter<T>(instrument, parameterName)); } -template <typename... Ts> -boost::optional<boost::variant<Ts...>> firstFromParameterFileVariant( - Mantid::Geometry::Instrument_const_sptr instrument, - std::string const ¶meterName) { - return first<Ts...>( - getInstrumentParameter<boost::variant<Ts...>>(instrument, parameterName)); -} - class MissingInstrumentParameterValue { public: explicit MissingInstrumentParameterValue(std::string const ¶meterName) @@ -55,34 +47,14 @@ public: return fromFile<T>(parameterName); } - template <typename T> - T handleMissingValue(boost::optional<T> const &value, - std::string const ¶meterName) { - if (value) - return value.get(); - else { - m_missingValueErrors.emplace_back(parameterName); - return T(); - } - } - template <typename T> T mandatory(std::string const ¶meterName) { try { - return handleMissingValue( - firstFromParameterFile<T>(m_instrument, parameterName), - parameterName); - } catch (InstrumentParameterTypeMissmatch const &ex) { - m_typeErrors.emplace_back(ex); - return T(); - } - } - - template <typename T, typename... Ts> - boost::variant<T, Ts...> mandatoryVariant(std::string const ¶meterName) { - try { - return handleMissingValue( - firstFromParameterFileVariant<T, Ts...>(m_instrument, parameterName), - parameterName); + if (auto value = firstFromParameterFile<T>(m_instrument, parameterName)) { + return value.get(); + } else { + m_missingValueErrors.emplace_back(parameterName); + return T(); + } } catch (InstrumentParameterTypeMissmatch const &ex) { m_typeErrors.emplace_back(ex); return T(); diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflSettingsPresenter.cpp b/qt/scientific_interfaces/ISISReflectometry/ReflSettingsPresenter.cpp index 1b61f927670..6bc3fb85dd5 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflSettingsPresenter.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/ReflSettingsPresenter.cpp @@ -345,7 +345,7 @@ void ReflSettingsPresenter::getInstDefaults() { defaults.LambdaMin = parameters.mandatory<double>("LambdaMin"); defaults.LambdaMax = parameters.mandatory<double>("LambdaMax"); defaults.I0MonitorIndex = - parameters.mandatoryVariant<int, double>("I0MonitorIndex"); + parameters.mandatory<boost::variant<int, double>>("I0MonitorIndex"); defaults.ProcessingInstructions = parameters.optional<std::string>("ProcessingInstructions"); defaults.CorrectDetectors = -- GitLab