13 const std::string &idf_name) {
15 if (algProperty->isDefault()) {
16 auto defaults = instrument->getStringParameter(idf_name);
17 if (defaults.empty()) {
18 throw std::runtime_error(
"No data could be retrieved from the parameters "
19 "and argument wasn't provided: " +
24 return algProperty->value();
29boost::optional<std::string>
32 const std::string &idf_name) {
34 if (algProperty->isDefault()) {
35 auto defaults = instrument->getStringParameter(idf_name);
36 if (!defaults.empty()) {
37 return boost::optional<std::string>(defaults[0]);
39 return boost::optional<std::string>();
42 return boost::optional<std::string>(algProperty->value());
Base class from which all concrete algorithm classes should be derived.
Kernel::Property * getPointerToProperty(const std::string &name) const override
Get a property by name.
T checkForMandatoryInstrumentDefault(Mantid::API::Algorithm *const alg, const std::string &propName, const Mantid::Geometry::Instrument_const_sptr &instrument, const std::string &idf_name)
BoostOptionalToAlgorithmProperty : Checks for default values of an algorithm property if the user has...
boost::optional< T > checkForOptionalInstrumentDefault(Mantid::API::Algorithm *const alg, const std::string &propName, const Mantid::Geometry::Instrument_const_sptr &instrument, const std::string &idf_name)
Checks for the default values of an optional algorithm property associated with an instrument compone...
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.