diff --git a/qt/scientific_interfaces/ISISReflectometry/InstrumentParameters.h b/qt/scientific_interfaces/ISISReflectometry/InstrumentParameters.h index b0921e2b6a87d0559caa715fe1010dcea7740e84..f56611a2bb4476bb99cae7c573084d38e16255b7 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 1b61f927670caa2f1d442a3b10238a1b515c416e..6bc3fb85dd53139ebc65315f40c2bb9a8197f1dc 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 =