diff --git a/Framework/API/test/EnabledWhenWorkspaceIsTypeTest.h b/Framework/API/test/EnabledWhenWorkspaceIsTypeTest.h index e29560fe35e08f26876c4fdbf997ab7526e575dc..a3db0d82c45640e93e7f57352aaf1f360e1aa65b 100644 --- a/Framework/API/test/EnabledWhenWorkspaceIsTypeTest.h +++ b/Framework/API/test/EnabledWhenWorkspaceIsTypeTest.h @@ -50,13 +50,15 @@ public: alg.declareProperty("MyValidatorProp", 456); alg.setPropertySettings( "MyValidatorProp", - new EnabledWhenWorkspaceIsType<WorkspaceTesterSubClass>( + Kernel::make_unique< + EnabledWhenWorkspaceIsType<WorkspaceTesterSubClass>>( "InputWorkspace", true)); alg.declareProperty("MyValidatorProp2", 456); alg.setPropertySettings( "MyValidatorProp2", - new EnabledWhenWorkspaceIsType<WorkspaceTesterSubClass>( + Kernel::make_unique< + EnabledWhenWorkspaceIsType<WorkspaceTesterSubClass>>( "InputWorkspace", false)); Property *prop = alg.getPointerToProperty("MyValidatorProp"); diff --git a/Framework/Algorithms/src/CopySample.cpp b/Framework/Algorithms/src/CopySample.cpp index 17bae45f00b5a8599f57290f87ce251ea338b050..ccc93ae1b5be19646154d98661476893f6c9e251 100644 --- a/Framework/Algorithms/src/CopySample.cpp +++ b/Framework/Algorithms/src/CopySample.cpp @@ -54,9 +54,9 @@ void CopySample::init() { false, Direction::Input), "Copy the U matrix only, if both origin and destination have " "oriented lattices"); - setPropertySettings( - "CopyOrientationOnly", - new Kernel::EnabledWhenProperty("CopyLattice", IS_EQUAL_TO, "1")); + setPropertySettings("CopyOrientationOnly", + make_unique<Kernel::EnabledWhenProperty>( + "CopyLattice", IS_EQUAL_TO, "1")); declareProperty( make_unique<PropertyWithValue<int>>("MDInputSampleNumber", 0, Direction::Input), diff --git a/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp b/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp index 1b4fb3e675f3b5a4138a73b64da82b12f8a38222..7518761dbc260ea3c03fd460999105eb91115dfe 100644 --- a/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp +++ b/Framework/Algorithms/src/CreateTransmissionWorkspace.cpp @@ -65,16 +65,16 @@ void CreateTransmissionWorkspace::init() { "OutputWorkspace", "", Direction::Output), "Output Workspace IvsQ."); - setPropertySettings( - "Params", new Kernel::EnabledWhenProperty("SecondTransmissionWorkspace", - IS_NOT_DEFAULT)); + setPropertySettings("Params", + make_unique<Kernel::EnabledWhenProperty>( + "SecondTransmissionWorkspace", IS_NOT_DEFAULT)); setPropertySettings("StartOverlap", - new Kernel::EnabledWhenProperty( + make_unique<Kernel::EnabledWhenProperty>( "SecondTransmissionWorkspace", IS_NOT_DEFAULT)); setPropertySettings("EndOverlap", - new Kernel::EnabledWhenProperty( + make_unique<Kernel::EnabledWhenProperty>( "SecondTransmissionWorkspace", IS_NOT_DEFAULT)); } diff --git a/Framework/Algorithms/src/DetectorDiagnostic.cpp b/Framework/Algorithms/src/DetectorDiagnostic.cpp index 45329645b92fc39dbaed84aec64d459943cccd5a..d1b8df2a1bf1392beb1694f367b27c75b63954f2 100644 --- a/Framework/Algorithms/src/DetectorDiagnostic.cpp +++ b/Framework/Algorithms/src/DetectorDiagnostic.cpp @@ -143,7 +143,7 @@ void DetectorDiagnostic::init() { this->setPropertyGroup("DetVanRatioVariation", detEffVarGrp); this->setPropertySettings( "DetVanRatioVariation", - new EnabledWhenProperty("DetVanCompare", IS_NOT_DEFAULT)); + make_unique<EnabledWhenProperty>("DetVanCompare", IS_NOT_DEFAULT)); string countsCheck("Check Sample Counts"); this->declareProperty( @@ -195,7 +195,7 @@ void DetectorDiagnostic::init() { this->setPropertyGroup("NIgnoredCentralPixels", psdBleedMaskGrp); this->setPropertySettings( "NIgnoredCentralPixels", - new EnabledWhenProperty("MaxTubeFramerate", IS_NOT_DEFAULT)); + make_unique<EnabledWhenProperty>("MaxTubeFramerate", IS_NOT_DEFAULT)); this->declareProperty("NumberOfFailures", 0, Direction::Output); } diff --git a/Framework/Algorithms/src/FilterEvents.cpp b/Framework/Algorithms/src/FilterEvents.cpp index 6b3deb8fff317f4f35ad41a0ee09921ebdaa79a1..7e599f86b59803620fe0dc4b83afb03e1693939f 100644 --- a/Framework/Algorithms/src/FilterEvents.cpp +++ b/Framework/Algorithms/src/FilterEvents.cpp @@ -103,17 +103,17 @@ void FilterEvents::init() { PropertyMode::Optional), "Name of table workspace containing the log " "time correction factor for each detector. "); - setPropertySettings( - "DetectorTOFCorrectionWorkspace", - new VisibleWhenProperty("CorrectionToSample", IS_EQUAL_TO, "Customized")); + setPropertySettings("DetectorTOFCorrectionWorkspace", + Kernel::make_unique<VisibleWhenProperty>( + "CorrectionToSample", IS_EQUAL_TO, "Customized")); auto mustBePositive = boost::make_shared<BoundedValidator<double>>(); mustBePositive->setLower(0.0); declareProperty("IncidentEnergy", EMPTY_DBL(), mustBePositive, "Value of incident energy (Ei) in meV in direct mode."); - setPropertySettings( - "IncidentEnergy", - new VisibleWhenProperty("CorrectionToSample", IS_EQUAL_TO, "Direct")); + setPropertySettings("IncidentEnergy", + Kernel::make_unique<VisibleWhenProperty>( + "CorrectionToSample", IS_EQUAL_TO, "Direct")); // Algorithm to spectra without detectors vector<string> spec_no_det{"Skip", "Skip only if TOF correction"}; diff --git a/Framework/Algorithms/src/GenerateEventsFilter.cpp b/Framework/Algorithms/src/GenerateEventsFilter.cpp index 5717a70eb01ce9adf81c37a90cb2e048682ce98d..87bb497e4682531fc3b1c78b36e1f0d6f82ee5fb 100644 --- a/Framework/Algorithms/src/GenerateEventsFilter.cpp +++ b/Framework/Algorithms/src/GenerateEventsFilter.cpp @@ -90,8 +90,8 @@ void GenerateEventsFilter::init() { "same time intervals. " "If the size of the array is larger than one, then the " "splitters can have various time interval values."); - setPropertySettings("TimeInterval", - new VisibleWhenProperty("LogName", IS_EQUAL_TO, "")); + setPropertySettings("TimeInterval", Kernel::make_unique<VisibleWhenProperty>( + "LogName", IS_EQUAL_TO, "")); std::vector<std::string> timeoptions{"Seconds", "Nanoseconds", "Percent"}; declareProperty( @@ -109,20 +109,23 @@ void GenerateEventsFilter::init() { declareProperty("MinimumLogValue", EMPTY_DBL(), "Minimum log value for which to keep events."); - setPropertySettings("MinimumLogValue", - new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); + setPropertySettings( + "MinimumLogValue", + Kernel::make_unique<VisibleWhenProperty>("LogName", IS_NOT_EQUAL_TO, "")); declareProperty("MaximumLogValue", EMPTY_DBL(), "Maximum log value for which to keep events."); - setPropertySettings("MaximumLogValue", - new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); + setPropertySettings( + "MaximumLogValue", + Kernel::make_unique<VisibleWhenProperty>("LogName", IS_NOT_EQUAL_TO, "")); declareProperty("LogValueInterval", EMPTY_DBL(), "Delta of log value to be sliced into from min log value and " "max log value.\n" "If not given, then only value "); - setPropertySettings("LogValueInterval", - new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); + setPropertySettings( + "LogValueInterval", + Kernel::make_unique<VisibleWhenProperty>("LogName", IS_NOT_EQUAL_TO, "")); std::vector<std::string> filteroptions{"Both", "Increase", "Decrease"}; declareProperty( @@ -133,14 +136,15 @@ void GenerateEventsFilter::init() { "There are 3 options, 'Both', 'Increase' and 'Decrease' corresponding to " "d(log value)/dt can be any value, positive only and negative only " "respectively."); - setPropertySettings("FilterLogValueByChangingDirection", - new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); + setPropertySettings( + "FilterLogValueByChangingDirection", + Kernel::make_unique<VisibleWhenProperty>("LogName", IS_NOT_EQUAL_TO, "")); declareProperty("TimeTolerance", 0.0, "Tolerance in time for the event times to keep. " "It is used in the case to filter by single value."); - setPropertySettings("TimeTolerance", - new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); + setPropertySettings("TimeTolerance", Kernel::make_unique<VisibleWhenProperty>( + "LogName", IS_NOT_EQUAL_TO, "")); vector<string> logboundoptions{"Centre", "Left", "Other"}; auto logvalidator = boost::make_shared<StringListValidator>(logboundoptions); @@ -148,14 +152,15 @@ void GenerateEventsFilter::init() { "LogBoundary", "Centre", logvalidator, "How to treat log values as being measured in the centre of time. " "There are three options, 'Centre', 'Left' and 'Other'. "); - setPropertySettings("LogBoundary", - new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); + setPropertySettings("LogBoundary", Kernel::make_unique<VisibleWhenProperty>( + "LogName", IS_NOT_EQUAL_TO, "")); declareProperty("LogValueTolerance", EMPTY_DBL(), "Tolerance of the log value to be included in filter. It is " "used in the case to filter by multiple values."); - setPropertySettings("LogValueTolerance", - new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); + setPropertySettings( + "LogValueTolerance", + Kernel::make_unique<VisibleWhenProperty>("LogName", IS_NOT_EQUAL_TO, "")); // Output workspaces' title and name declareProperty( diff --git a/Framework/Algorithms/src/GetAllEi.cpp b/Framework/Algorithms/src/GetAllEi.cpp index 18449892fdad685859c4a2a23c714ef4f42dd181..7a82337e281577f2ad3d98475dbd0a04387131dd 100644 --- a/Framework/Algorithms/src/GetAllEi.cpp +++ b/Framework/Algorithms/src/GetAllEi.cpp @@ -81,11 +81,11 @@ void GetAllEi::init() { "values where the derivative of the log turns zero.\n" "E.g. the 'proton_chage' log grows for each frame " "when instrument is counting and is constant otherwise."); - setPropertySettings( - "FilterWithDerivative", - new Kernel::EnabledWhenProperty("FilterBaseLog", - Kernel::ePropertyCriterion::IS_EQUAL_TO, - "Defined in IDF")); + setPropertySettings("FilterWithDerivative", + Kernel::make_unique<Kernel::EnabledWhenProperty>( + "FilterBaseLog", + Kernel::ePropertyCriterion::IS_EQUAL_TO, + "Defined in IDF")); auto maxInRange = boost::make_shared<Kernel::BoundedValidator<double>>(); maxInRange->setLower(1.e-6); diff --git a/Framework/Algorithms/src/NormaliseToMonitor.cpp b/Framework/Algorithms/src/NormaliseToMonitor.cpp index 8e10220eb1f8bdc69474c69e8d899d9a1858f2a5..b26db9f934adcbc8c3665bf38e7b1275453ae910 100644 --- a/Framework/Algorithms/src/NormaliseToMonitor.cpp +++ b/Framework/Algorithms/src/NormaliseToMonitor.cpp @@ -211,9 +211,9 @@ void NormaliseToMonitor::init() { "to empty data and the field then can accepts any MonitorID " "within the InputWorkspace."); // set up the validator, which would verify if spectrum is correct - setPropertySettings("MonitorID", - new MonIDPropChanger("InputWorkspace", "MonitorSpectrum", - "MonitorWorkspace")); + setPropertySettings("MonitorID", Kernel::make_unique<MonIDPropChanger>( + "InputWorkspace", "MonitorSpectrum", + "MonitorWorkspace")); // ...or provide it in a separate workspace (note: optional WorkspaceProperty) declareProperty(make_unique<WorkspaceProperty<>>("MonitorWorkspace", "", @@ -221,8 +221,9 @@ void NormaliseToMonitor::init() { PropertyMode::Optional, val), "A workspace containing one or more spectra to normalize the " "InputWorkspace by."); - setPropertySettings("MonitorWorkspace", new Kernel::EnabledWhenProperty( - "MonitorSpectrum", IS_DEFAULT)); + setPropertySettings("MonitorWorkspace", + Kernel::make_unique<Kernel::EnabledWhenProperty>( + "MonitorSpectrum", IS_DEFAULT)); declareProperty("MonitorWorkspaceIndex", 0, "The index of the spectrum within the MonitorWorkspace(2 " @@ -233,9 +234,9 @@ void NormaliseToMonitor::init() { "If no value is provided in this field, '''InputWorkspace''' " "will be normalized by first spectra (with index 0)", Direction::InOut); - setPropertySettings( - "MonitorWorkspaceIndex", - new Kernel::EnabledWhenProperty("MonitorSpectrum", IS_DEFAULT)); + setPropertySettings("MonitorWorkspaceIndex", + Kernel::make_unique<Kernel::EnabledWhenProperty>( + "MonitorSpectrum", IS_DEFAULT)); // If users set either of these optional properties two things happen // 1) normalization is by an integrated count instead of bin-by-bin diff --git a/Framework/Algorithms/src/RadiusSum.cpp b/Framework/Algorithms/src/RadiusSum.cpp index c573bc8ef30b8b322f2fc37df294d198c7c71d54..4eae9b9a88e8d738fa9493cf89dc6b0bb0db3225 100644 --- a/Framework/Algorithms/src/RadiusSum.cpp +++ b/Framework/Algorithms/src/RadiusSum.cpp @@ -88,8 +88,8 @@ void RadiusSum::init() { declareProperty(normOrder, 1.0, "If 2, the normalization will be divided by " "the quadratic value of the ring for each " "radius."); - setPropertySettings(normOrder, - new VisibleWhenProperty(normBy, IS_EQUAL_TO, "1")); + setPropertySettings(normOrder, Kernel::make_unique<VisibleWhenProperty>( + normBy, IS_EQUAL_TO, "1")); const char *groupNorm = "Normalization"; setPropertyGroup(normBy, groupNorm); diff --git a/Framework/Algorithms/src/ReflectometryReductionOne.cpp b/Framework/Algorithms/src/ReflectometryReductionOne.cpp index 51d01af7691427fc953b373fc309fa66ee6b8f25..b7af528a7979b38df19830aa2a1f25af9a4ffc6b 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOne.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOne.cpp @@ -217,15 +217,16 @@ void ReflectometryReductionOne::init() { setPropertyGroup("C0", "Polynomial Corrections"); setPropertyGroup("C1", "Polynomial Corrections"); - setPropertySettings("Polynomial", new Kernel::EnabledWhenProperty( - "CorrectionAlgorithm", IS_EQUAL_TO, - "PolynomialCorrection")); setPropertySettings( - "C0", new Kernel::EnabledWhenProperty("CorrectionAlgorithm", IS_EQUAL_TO, - "ExponentialCorrection")); + "Polynomial", + Kernel::make_unique<Kernel::EnabledWhenProperty>( + "CorrectionAlgorithm", IS_EQUAL_TO, "PolynomialCorrection")); setPropertySettings( - "C1", new Kernel::EnabledWhenProperty("CorrectionAlgorithm", IS_EQUAL_TO, - "ExponentialCorrection")); + "C0", Kernel::make_unique<Kernel::EnabledWhenProperty>( + "CorrectionAlgorithm", IS_EQUAL_TO, "ExponentialCorrection")); + setPropertySettings( + "C1", Kernel::make_unique<Kernel::EnabledWhenProperty>( + "CorrectionAlgorithm", IS_EQUAL_TO, "ExponentialCorrection")); setPropertyGroup("FirstTransmissionRun", "Transmission"); setPropertyGroup("SecondTransmissionRun", "Transmission"); @@ -234,26 +235,30 @@ void ReflectometryReductionOne::init() { setPropertyGroup("EndOverlap", "Transmission"); // Only do transmission corrections when point detector. - setPropertySettings("FirstTransmissionRun", new Kernel::EnabledWhenProperty( - "AnalysisMode", IS_EQUAL_TO, - "PointDetectorAnalysis")); - setPropertySettings("SecondTransmissionRun", new Kernel::EnabledWhenProperty( - "AnalysisMode", IS_EQUAL_TO, - "PointDetectorAnalysis")); setPropertySettings( - "Params", new Kernel::EnabledWhenProperty("AnalysisMode", IS_EQUAL_TO, - "PointDetectorAnalysis")); - setPropertySettings("StartOverlap", new Kernel::EnabledWhenProperty( - "AnalysisMode", IS_EQUAL_TO, - "PointDetectorAnalysis")); + "FirstTransmissionRun", + Kernel::make_unique<Kernel::EnabledWhenProperty>( + "AnalysisMode", IS_EQUAL_TO, "PointDetectorAnalysis")); + setPropertySettings( + "SecondTransmissionRun", + Kernel::make_unique<Kernel::EnabledWhenProperty>( + "AnalysisMode", IS_EQUAL_TO, "PointDetectorAnalysis")); + setPropertySettings( + "Params", Kernel::make_unique<Kernel::EnabledWhenProperty>( + "AnalysisMode", IS_EQUAL_TO, "PointDetectorAnalysis")); setPropertySettings( - "EndOverlap", new Kernel::EnabledWhenProperty("AnalysisMode", IS_EQUAL_TO, - "PointDetectorAnalysis")); + "StartOverlap", + Kernel::make_unique<Kernel::EnabledWhenProperty>( + "AnalysisMode", IS_EQUAL_TO, "PointDetectorAnalysis")); + setPropertySettings( + "EndOverlap", Kernel::make_unique<Kernel::EnabledWhenProperty>( + "AnalysisMode", IS_EQUAL_TO, "PointDetectorAnalysis")); // Only use region of direct beam when in multi-detector analysis mode. - setPropertySettings("RegionOfDirectBeam", new Kernel::EnabledWhenProperty( - "AnalysisMode", IS_EQUAL_TO, - "MultiDetectorAnalysis")); + setPropertySettings( + "RegionOfDirectBeam", + Kernel::make_unique<Kernel::EnabledWhenProperty>( + "AnalysisMode", IS_EQUAL_TO, "MultiDetectorAnalysis")); } /** diff --git a/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp b/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp index 2d5c2b0558b953cd0e489a9f34f2ab6bc254663c..fd381c3bc25c532b6161940088b0157b2bc2df58 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOneAuto.cpp @@ -175,15 +175,16 @@ void ReflectometryReductionOneAuto::init() { setPropertyGroup("C0", "Polynomial Corrections"); setPropertyGroup("C1", "Polynomial Corrections"); - setPropertySettings("Polynomial", new Kernel::EnabledWhenProperty( - "CorrectionAlgorithm", IS_EQUAL_TO, - "PolynomialCorrection")); setPropertySettings( - "C0", new Kernel::EnabledWhenProperty("CorrectionAlgorithm", IS_EQUAL_TO, - "ExponentialCorrection")); + "Polynomial", + Kernel::make_unique<Kernel::EnabledWhenProperty>( + "CorrectionAlgorithm", IS_EQUAL_TO, "PolynomialCorrection")); setPropertySettings( - "C1", new Kernel::EnabledWhenProperty("CorrectionAlgorithm", IS_EQUAL_TO, - "ExponentialCorrection")); + "C0", Kernel::make_unique<Kernel::EnabledWhenProperty>( + "CorrectionAlgorithm", IS_EQUAL_TO, "ExponentialCorrection")); + setPropertySettings( + "C1", Kernel::make_unique<Kernel::EnabledWhenProperty>( + "CorrectionAlgorithm", IS_EQUAL_TO, "ExponentialCorrection")); // Polarization correction inputs -------------- std::vector<std::string> propOptions; @@ -222,19 +223,22 @@ void ReflectometryReductionOneAuto::init() { setPropertyGroup(cApLabel(), "Polarization Corrections"); setPropertyGroup(crhoLabel(), "Polarization Corrections"); setPropertyGroup(cAlphaLabel(), "Polarization Corrections"); - setPropertySettings(cppLabel(), new Kernel::EnabledWhenProperty( - "PolarizationAnalysis", IS_NOT_EQUAL_TO, - noPolarizationCorrectionMode())); - setPropertySettings(cApLabel(), new Kernel::EnabledWhenProperty( - "PolarizationAnalysis", IS_NOT_EQUAL_TO, - noPolarizationCorrectionMode())); - setPropertySettings(crhoLabel(), new Kernel::EnabledWhenProperty( - "PolarizationAnalysis", IS_NOT_EQUAL_TO, - noPolarizationCorrectionMode())); - setPropertySettings( - cAlphaLabel(), - new Kernel::EnabledWhenProperty("PolarizationAnalysis", IS_NOT_EQUAL_TO, - noPolarizationCorrectionMode())); + setPropertySettings(cppLabel(), + Kernel::make_unique<Kernel::EnabledWhenProperty>( + "PolarizationAnalysis", IS_NOT_EQUAL_TO, + noPolarizationCorrectionMode())); + setPropertySettings(cApLabel(), + Kernel::make_unique<Kernel::EnabledWhenProperty>( + "PolarizationAnalysis", IS_NOT_EQUAL_TO, + noPolarizationCorrectionMode())); + setPropertySettings(crhoLabel(), + Kernel::make_unique<Kernel::EnabledWhenProperty>( + "PolarizationAnalysis", IS_NOT_EQUAL_TO, + noPolarizationCorrectionMode())); + setPropertySettings(cAlphaLabel(), + Kernel::make_unique<Kernel::EnabledWhenProperty>( + "PolarizationAnalysis", IS_NOT_EQUAL_TO, + noPolarizationCorrectionMode())); } //---------------------------------------------------------------------------------------------- diff --git a/Framework/Algorithms/src/RemoveLowResTOF.cpp b/Framework/Algorithms/src/RemoveLowResTOF.cpp index 8a476e356e09d6eb95a90f665fd8277ca325ee24..228e415513831db52cd8557e70e186906bed4b21 100644 --- a/Framework/Algorithms/src/RemoveLowResTOF.cpp +++ b/Framework/Algorithms/src/RemoveLowResTOF.cpp @@ -86,12 +86,12 @@ void RemoveLowResTOF::init() { "other parameters if specified."); // hide things when people cjoose the minimum wavelength - setPropertySettings("ReferenceDIFC", - new EnabledWhenProperty("MinWavelength", IS_DEFAULT)); - setPropertySettings("K", - new EnabledWhenProperty("MinWavelength", IS_DEFAULT)); - setPropertySettings("Tmin", - new EnabledWhenProperty("MinWavelength", IS_DEFAULT)); + setPropertySettings("ReferenceDIFC", make_unique<EnabledWhenProperty>( + "MinWavelength", IS_DEFAULT)); + setPropertySettings( + "K", make_unique<EnabledWhenProperty>("MinWavelength", IS_DEFAULT)); + setPropertySettings( + "Tmin", make_unique<EnabledWhenProperty>("MinWavelength", IS_DEFAULT)); } void RemoveLowResTOF::exec() { diff --git a/Framework/Algorithms/src/ResetNegatives.cpp b/Framework/Algorithms/src/ResetNegatives.cpp index 32b0299db8709c4ab409f24a9c4d9bd0bc658b52..fabb31f97fa2a359b14315dc643c80668d235e2f 100644 --- a/Framework/Algorithms/src/ResetNegatives.cpp +++ b/Framework/Algorithms/src/ResetNegatives.cpp @@ -48,8 +48,8 @@ void ResetNegatives::init() { "Add the minumum value of the spectrum to bring it up to zero."); declareProperty("ResetValue", 0., "Reset negative values to this number (default=0)"); - setPropertySettings("ResetValue", - new EnabledWhenProperty("AddMinimum", IS_NOT_DEFAULT)); + setPropertySettings("ResetValue", make_unique<EnabledWhenProperty>( + "AddMinimum", IS_NOT_DEFAULT)); } //---------------------------------------------------------------------------------------------- diff --git a/Framework/Algorithms/src/SassenaFFT.cpp b/Framework/Algorithms/src/SassenaFFT.cpp index b6a9c0fc72890bef8ae1993c196fd9c8e09b4f52..9806204d20b136db015ee6062c2bad255c8e803e 100644 --- a/Framework/Algorithms/src/SassenaFFT.cpp +++ b/Framework/Algorithms/src/SassenaFFT.cpp @@ -51,9 +51,9 @@ void SassenaFFT::init() { "Do we apply detailed balance condition? (optional, default is False)"); this->declareProperty("Temp", 300.0, "Multiply structure factor by exp(E/(2*kT)"); - this->setPropertySettings( - "Temp", new Kernel::EnabledWhenProperty("DetailedBalance", - Kernel::IS_EQUAL_TO, "1")); + this->setPropertySettings("Temp", + Kernel::make_unique<Kernel::EnabledWhenProperty>( + "DetailedBalance", Kernel::IS_EQUAL_TO, "1")); } /// Execute the algorithm diff --git a/Framework/Algorithms/src/SmoothNeighbours.cpp b/Framework/Algorithms/src/SmoothNeighbours.cpp index 9d120d7ee5853f4830bfa08d5488ca3013eb18c7..da0ac86139e45728ca6e4751782fbb316c4a48ab 100644 --- a/Framework/Algorithms/src/SmoothNeighbours.cpp +++ b/Framework/Algorithms/src/SmoothNeighbours.cpp @@ -78,8 +78,8 @@ void SmoothNeighbours::init() { declareProperty( "Sigma", 0.5, mustBePositiveDouble, "Sigma value for gaussian weighting schemes. Defaults to 0.5. "); - setPropertySettings( - "Sigma", new EnabledWhenProperty("WeightedSum", IS_EQUAL_TO, "Gaussian")); + setPropertySettings("Sigma", make_unique<EnabledWhenProperty>( + "WeightedSum", IS_EQUAL_TO, "Gaussian")); declareProperty( "IgnoreMaskedDetectors", true, diff --git a/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp b/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp index c0ee2ee28689aeffce997ef6fe91b17c087f97d9..372e9a36987d21bdaa147b9abbf7c5b2c718cf6f 100644 --- a/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp +++ b/Framework/Algorithms/src/SpecularReflectionAlgorithm.cpp @@ -112,11 +112,11 @@ void SpecularReflectionAlgorithm::initCommonProperties() { "spectrum numbers are not in {min, min+1, ..., max}"); setPropertySettings("SampleComponentName", - new Kernel::EnabledWhenProperty( + make_unique<Kernel::EnabledWhenProperty>( "SpectrumNumbersOfGrouped", IS_NOT_DEFAULT)); - setPropertySettings( - "SpectrumNumbersOfDetectors", - new Kernel::EnabledWhenProperty("SampleComponentName", IS_NOT_DEFAULT)); + setPropertySettings("SpectrumNumbersOfDetectors", + make_unique<Kernel::EnabledWhenProperty>( + "SampleComponentName", IS_NOT_DEFAULT)); } /** diff --git a/Framework/Crystal/src/CombinePeaksWorkspaces.cpp b/Framework/Crystal/src/CombinePeaksWorkspaces.cpp index 621b4b9db428ccf6bf4209494037fd00fff81059..43fc7faeeb156363f786d728573dad9135bc4402 100644 --- a/Framework/Crystal/src/CombinePeaksWorkspaces.cpp +++ b/Framework/Crystal/src/CombinePeaksWorkspaces.cpp @@ -56,9 +56,9 @@ void CombinePeaksWorkspaces::init() { declareProperty("Tolerance", EMPTY_DBL(), mustBePositive, "Maximum difference in each component of Q for which peaks " "are considered identical"); - setPropertySettings( - "Tolerance", - new EnabledWhenProperty("CombineMatchingPeaks", IS_EQUAL_TO, "1")); + setPropertySettings("Tolerance", + make_unique<EnabledWhenProperty>("CombineMatchingPeaks", + IS_EQUAL_TO, "1")); } /** Executes the algorithm. diff --git a/Framework/Crystal/src/FindClusterFaces.cpp b/Framework/Crystal/src/FindClusterFaces.cpp index 1700bb5221184a69e80b200a334a1302b59b5491..bfdad87ee39680708b34d4bb88f12acc0d7debac 100644 --- a/Framework/Crystal/src/FindClusterFaces.cpp +++ b/Framework/Crystal/src/FindClusterFaces.cpp @@ -293,8 +293,8 @@ void FindClusterFaces::init() { boost::make_shared<BoundedValidator<int>>(), Direction::Input), "The number of neighbours to utilise. Defaults to 100000."); - setPropertySettings("MaximumRows", - new EnabledWhenProperty("LimitRows", IS_DEFAULT)); + setPropertySettings( + "MaximumRows", make_unique<EnabledWhenProperty>("LimitRows", IS_DEFAULT)); declareProperty( make_unique<WorkspaceProperty<ITableWorkspace>>("OutputWorkspace", "", diff --git a/Framework/Crystal/src/OptimizeCrystalPlacement.cpp b/Framework/Crystal/src/OptimizeCrystalPlacement.cpp index 7c8a6db2c24ba19e0c3c6f59a2a0975b3f2f4a0c..635d479c37db66b90017b4f0d459ad38c7daf9ce 100644 --- a/Framework/Crystal/src/OptimizeCrystalPlacement.cpp +++ b/Framework/Crystal/src/OptimizeCrystalPlacement.cpp @@ -126,12 +126,12 @@ void OptimizeCrystalPlacement::init() { setPropertyGroup("MaxHKLPeaks2Use", "Tolerance settings"); setPropertyGroup("MaxIndexingError", "Tolerance settings"); - setPropertySettings( - "MaxSamplePositionChangeMeters", - new EnabledWhenProperty("AdjustSampleOffsets", Kernel::IS_EQUAL_TO, "1")); + setPropertySettings("MaxSamplePositionChangeMeters", + make_unique<EnabledWhenProperty>( + "AdjustSampleOffsets", Kernel::IS_EQUAL_TO, "1")); setPropertySettings("KeepGoniometerFixedfor", - new OrEnabledWhenProperties( + make_unique<OrEnabledWhenProperties>( "AdjustSampleOffsets", Kernel::IS_EQUAL_TO, "0", "OptimizeGoniometerTilt", Kernel::IS_EQUAL_TO, "0")); } diff --git a/Framework/Crystal/src/PeaksInRegion.cpp b/Framework/Crystal/src/PeaksInRegion.cpp index f524513d8b509ddbaaf16b5a34a790ce94421e3d..28002eecb13d46acef1b45b3386239cb45bcf023 100644 --- a/Framework/Crystal/src/PeaksInRegion.cpp +++ b/Framework/Crystal/src/PeaksInRegion.cpp @@ -58,8 +58,8 @@ void PeaksInRegion::init() { "specifying the extents of each dimension. Optional, default +-50 in " "each dimension."); - setPropertySettings("PeakRadius", new EnabledWhenProperty("CheckPeakExtents", - IS_NOT_DEFAULT)); + setPropertySettings("PeakRadius", make_unique<EnabledWhenProperty>( + "CheckPeakExtents", IS_NOT_DEFAULT)); } void PeaksInRegion::validateExtentsInput() const { diff --git a/Framework/Crystal/src/PredictFractionalPeaks.cpp b/Framework/Crystal/src/PredictFractionalPeaks.cpp index eb2557ff1235693c89c6eead677f68dee5e6e327..aefcb4b89691fe792829e11ed012b613a9ee501e 100644 --- a/Framework/Crystal/src/PredictFractionalPeaks.cpp +++ b/Framework/Crystal/src/PredictFractionalPeaks.cpp @@ -72,26 +72,26 @@ void PredictFractionalPeaks::init() { "Maximum L value to use"); setPropertySettings( - "Hmin", new Kernel::EnabledWhenProperty(string("IncludeAllPeaksInRange"), - Kernel::IS_EQUAL_TO, "1")); + "Hmin", Kernel::make_unique<Kernel::EnabledWhenProperty>( + string("IncludeAllPeaksInRange"), Kernel::IS_EQUAL_TO, "1")); setPropertySettings( - "Hmax", new Kernel::EnabledWhenProperty(string("IncludeAllPeaksInRange"), - Kernel::IS_EQUAL_TO, "1")); + "Hmax", Kernel::make_unique<Kernel::EnabledWhenProperty>( + string("IncludeAllPeaksInRange"), Kernel::IS_EQUAL_TO, "1")); setPropertySettings( - "Kmin", new Kernel::EnabledWhenProperty(string("IncludeAllPeaksInRange"), - Kernel::IS_EQUAL_TO, "1")); + "Kmin", Kernel::make_unique<Kernel::EnabledWhenProperty>( + string("IncludeAllPeaksInRange"), Kernel::IS_EQUAL_TO, "1")); setPropertySettings( - "Kmax", new Kernel::EnabledWhenProperty(string("IncludeAllPeaksInRange"), - Kernel::IS_EQUAL_TO, "1")); + "Kmax", Kernel::make_unique<Kernel::EnabledWhenProperty>( + string("IncludeAllPeaksInRange"), Kernel::IS_EQUAL_TO, "1")); setPropertySettings( - "Lmin", new Kernel::EnabledWhenProperty(string("IncludeAllPeaksInRange"), - Kernel::IS_EQUAL_TO, "1")); + "Lmin", Kernel::make_unique<Kernel::EnabledWhenProperty>( + string("IncludeAllPeaksInRange"), Kernel::IS_EQUAL_TO, "1")); setPropertySettings( - "Lmax", new Kernel::EnabledWhenProperty(string("IncludeAllPeaksInRange"), - Kernel::IS_EQUAL_TO, "1")); + "Lmax", Kernel::make_unique<Kernel::EnabledWhenProperty>( + string("IncludeAllPeaksInRange"), Kernel::IS_EQUAL_TO, "1")); } /// Run the algorithm diff --git a/Framework/Crystal/src/PredictPeaks.cpp b/Framework/Crystal/src/PredictPeaks.cpp index 39542c06e6b50e57a73a47e13e0583322accd10f..fad7bee37dd2c9dc13a8004cd321311fb241fe54 100644 --- a/Framework/Crystal/src/PredictPeaks.cpp +++ b/Framework/Crystal/src/PredictPeaks.cpp @@ -94,17 +94,20 @@ void PredictPeaks::init() { "values in the HKLPeaksWorkspace to the nearest integers if " "checked.\n" "Keep unchecked to use the original values"); - setPropertySettings( - "RoundHKL", new EnabledWhenProperty("HKLPeaksWorkspace", IS_NOT_DEFAULT)); + setPropertySettings("RoundHKL", make_unique<EnabledWhenProperty>( + "HKLPeaksWorkspace", IS_NOT_DEFAULT)); // Disable some props when using HKLPeaksWorkspace - IPropertySettings *set = - new EnabledWhenProperty("HKLPeaksWorkspace", IS_DEFAULT); - setPropertySettings("WavelengthMin", set); - setPropertySettings("WavelengthMax", set->clone()); - setPropertySettings("MinDSpacing", set->clone()); - setPropertySettings("MaxDSpacing", set->clone()); - setPropertySettings("ReflectionCondition", set->clone()); + auto makeSet = [] { + std::unique_ptr<IPropertySettings> set = + make_unique<EnabledWhenProperty>("HKLPeaksWorkspace", IS_DEFAULT); + return set; + }; + setPropertySettings("WavelengthMin", makeSet()); + setPropertySettings("WavelengthMax", makeSet()); + setPropertySettings("MinDSpacing", makeSet()); + setPropertySettings("MaxDSpacing", makeSet()); + setPropertySettings("ReflectionCondition", makeSet()); declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>( "OutputWorkspace", "", Direction::Output), diff --git a/Framework/Crystal/src/SCDCalibratePanels.cpp b/Framework/Crystal/src/SCDCalibratePanels.cpp index adbc7f71aec030f115ab3f8cb7d66cc229667de1..a4bf9a523ee85daec08265d86fe152e4b569d8e2 100644 --- a/Framework/Crystal/src/SCDCalibratePanels.cpp +++ b/Framework/Crystal/src/SCDCalibratePanels.cpp @@ -1447,30 +1447,30 @@ void SCDCalibratePanels::init() { Kernel::Direction::Output); declareProperty("DOF", -1, "Degrees of Freedom", Kernel::Direction::Output); setPropertySettings("PanelNamePrefix", - new EnabledWhenProperty( + Kernel::make_unique<EnabledWhenProperty>( "PanelGroups", Kernel::IS_EQUAL_TO, "SpecifyGroups")); - setPropertySettings("Grouping", new EnabledWhenProperty("PanelGroups", - Kernel::IS_EQUAL_TO, - "SpecifyGroups")); + setPropertySettings("Grouping", + Kernel::make_unique<EnabledWhenProperty>( + "PanelGroups", Kernel::IS_EQUAL_TO, "SpecifyGroups")); setPropertySettings("PreProcFilename", - new EnabledWhenProperty("PreProcessInstrument", - Kernel::IS_NOT_EQUAL_TO, - "A)No PreProcessing")); - - setPropertySettings( - "InitialTimeOffset", - new EnabledWhenProperty("PreProcessInstrument", Kernel::IS_EQUAL_TO, - "C)Apply a LoadParameter.xml type file")); - - setPropertySettings( - "MaxSamplePositionChangeMeters", - new EnabledWhenProperty("AllowSampleShift", Kernel::IS_EQUAL_TO, "1")); - - setPropertySettings( - "MaxRotationChangeDegrees", - new EnabledWhenProperty("usePanelOrientation", Kernel::IS_EQUAL_TO, "1")); + Kernel::make_unique<EnabledWhenProperty>( + "PreProcessInstrument", Kernel::IS_NOT_EQUAL_TO, + "A)No PreProcessing")); + + setPropertySettings("InitialTimeOffset", + Kernel::make_unique<EnabledWhenProperty>( + "PreProcessInstrument", Kernel::IS_EQUAL_TO, + "C)Apply a LoadParameter.xml type file")); + + setPropertySettings("MaxSamplePositionChangeMeters", + Kernel::make_unique<EnabledWhenProperty>( + "AllowSampleShift", Kernel::IS_EQUAL_TO, "1")); + + setPropertySettings("MaxRotationChangeDegrees", + Kernel::make_unique<EnabledWhenProperty>( + "usePanelOrientation", Kernel::IS_EQUAL_TO, "1")); } /** diff --git a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp index c392da23ea3abb04aa47cb403609362fd5895cab..2ae0bd25f7775b11ec4bc5e7c46e97965062643e 100644 --- a/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/LeBailFit.cpp @@ -178,26 +178,26 @@ void LeBailFit::init() { // Output option to plot each individual peak declareProperty("PlotIndividualPeaks", false, "Option to output each individual peak in mode Calculation."); - setPropertySettings( - "PlotIndividualPeaks", - new VisibleWhenProperty("Function", IS_EQUAL_TO, "Calculation")); + setPropertySettings("PlotIndividualPeaks", + Kernel::make_unique<VisibleWhenProperty>( + "Function", IS_EQUAL_TO, "Calculation")); // Make each reflection visible declareProperty("IndicationPeakHeight", 0.0, "Heigh of peaks (reflections) if its calculated height is " "smaller than user-defined minimum."); - setPropertySettings( - "IndicationPeakHeight", - new VisibleWhenProperty("Function", IS_EQUAL_TO, "Calculation")); + setPropertySettings("IndicationPeakHeight", + Kernel::make_unique<VisibleWhenProperty>( + "Function", IS_EQUAL_TO, "Calculation")); // UseInputPeakHeights declareProperty("UseInputPeakHeights", true, "For 'Calculation' mode only, use peak heights specified in " "ReflectionWorkspace. " "Otherwise, calcualte peaks' heights. "); - setPropertySettings( - "UseInputPeakHeights", - new VisibleWhenProperty("Function", IS_EQUAL_TO, "Calculation")); + setPropertySettings("UseInputPeakHeights", + Kernel::make_unique<VisibleWhenProperty>( + "Function", IS_EQUAL_TO, "Calculation")); /*--------------------------- Properties for Fitting Mode * ---------------------------------*/ @@ -210,26 +210,26 @@ void LeBailFit::init() { "The minimizer method applied to do the fit, default is " "Levenberg-Marquardt", Kernel::Direction::InOut); - setPropertySettings("Minimizer", new VisibleWhenProperty( + setPropertySettings("Minimizer", Kernel::make_unique<VisibleWhenProperty>( "Function", IS_EQUAL_TO, "LeBailFit")); declareProperty("Damping", 1.0, "Damping factor if minizer is 'Damping'"); - setPropertySettings( - "Damping", new VisibleWhenProperty("Function", IS_EQUAL_TO, "LeBailFit")); - setPropertySettings("Damping", new VisibleWhenProperty( + setPropertySettings("Damping", Kernel::make_unique<VisibleWhenProperty>( + "Function", IS_EQUAL_TO, "LeBailFit")); + setPropertySettings("Damping", Kernel::make_unique<VisibleWhenProperty>( "Function", IS_EQUAL_TO, "MonteCarlo")); declareProperty("NumberMinimizeSteps", 100, "Number of Monte Carlo random walk steps."); - setPropertySettings( - "NumberMinimizeSteps", - new VisibleWhenProperty("Function", IS_EQUAL_TO, "LeBailFit")); - setPropertySettings( - "NumberMinimizeSteps", - new VisibleWhenProperty("Function", IS_EQUAL_TO, "MonteCarlo")); - setPropertySettings( - "NumberMinimizeSteps", - new VisibleWhenProperty("Function", IS_EQUAL_TO, "RefineBackground")); + setPropertySettings("NumberMinimizeSteps", + Kernel::make_unique<VisibleWhenProperty>( + "Function", IS_EQUAL_TO, "LeBailFit")); + setPropertySettings("NumberMinimizeSteps", + Kernel::make_unique<VisibleWhenProperty>( + "Function", IS_EQUAL_TO, "MonteCarlo")); + setPropertySettings("NumberMinimizeSteps", + Kernel::make_unique<VisibleWhenProperty>( + "Function", IS_EQUAL_TO, "RefineBackground")); //----------------- Parameters for Monte Carlo Simulated Annealing //-------------------------- @@ -238,33 +238,33 @@ void LeBailFit::init() { declareProperty(std::move(mcwsprop), "Name of table workspace containing parameters' " "setup for Monte Carlo simualted annearling. "); - setPropertySettings( - "MCSetupWorkspace", - new VisibleWhenProperty("Function", IS_EQUAL_TO, "MonteCarlo")); + setPropertySettings("MCSetupWorkspace", + Kernel::make_unique<VisibleWhenProperty>( + "Function", IS_EQUAL_TO, "MonteCarlo")); - declareProperty("RandomSeed", 1, "Randum number seed."); - setPropertySettings("RandomSeed", new VisibleWhenProperty( + declareProperty("RandomSeed", 1, "Random number seed."); + setPropertySettings("RandomSeed", Kernel::make_unique<VisibleWhenProperty>( "Function", IS_EQUAL_TO, "MonteCarlo")); declareProperty("AnnealingTemperature", 1.0, "Temperature used Monte Carlo. " "Negative temperature is for simulated annealing. "); - setPropertySettings( - "AnnealingTemperature", - new VisibleWhenProperty("Function", IS_EQUAL_TO, "MonteCarlo")); + setPropertySettings("AnnealingTemperature", + Kernel::make_unique<VisibleWhenProperty>( + "Function", IS_EQUAL_TO, "MonteCarlo")); declareProperty("UseAnnealing", true, "Allow annealing temperature adjusted automatically."); - setPropertySettings( - "UseAnnealing", - new VisibleWhenProperty("Function", IS_EQUAL_TO, "MonteCarlo")); + setPropertySettings("UseAnnealing", + Kernel::make_unique<VisibleWhenProperty>( + "Function", IS_EQUAL_TO, "MonteCarlo")); declareProperty("DrunkenWalk", false, "Flag to use drunken walk algorithm. " "Otherwise, random walk algorithm is used. "); - setPropertySettings( - "DrunkenWalk", - new VisibleWhenProperty("Function", IS_EQUAL_TO, "MonteCarlo")); + setPropertySettings("DrunkenWalk", + Kernel::make_unique<VisibleWhenProperty>( + "Function", IS_EQUAL_TO, "MonteCarlo")); declareProperty( "MinimumPeakHeight", 0.01, diff --git a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp index 8ac8bc1034c409fc2cdc57026d3514c7f5e89805..eb00fefa1a46df91adb40dccc71b4bddf587532c 100644 --- a/Framework/CurveFitting/src/Functions/ProcessBackground.cpp +++ b/Framework/CurveFitting/src/Functions/ProcessBackground.cpp @@ -87,9 +87,9 @@ void ProcessBackground::init() { declareProperty(std::move(refwsprop), "Name of the workspace containing the data " "required by function AddRegion."); - setPropertySettings( - "ReferenceWorkspace", - new VisibleWhenProperty("Options", IS_EQUAL_TO, "AddRegion")); + setPropertySettings("ReferenceWorkspace", + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "AddRegion")); // Optional Function Type std::vector<std::string> bkgdtype{"Polynomial", "Chebyshev"}; @@ -99,8 +99,8 @@ void ProcessBackground::init() { "BackgroundType", "Polynomial", bkgdvalidator, "Type of the background. Options include Polynomial and Chebyshev."); setPropertySettings("BackgroundType", - new VisibleWhenProperty("Options", IS_EQUAL_TO, - "SelectBackgroundPoints")); + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "SelectBackgroundPoints")); vector<string> funcoptions{"N/A", "FitGivenDataPoints", "UserFunction"}; auto fovalidator = boost::make_shared<StringListValidator>(funcoptions); @@ -110,17 +110,17 @@ void ProcessBackground::init() { "function. Otherwise, background function will be fitted " "from user's input data points."); setPropertySettings("SelectionMode", - new VisibleWhenProperty("Options", IS_EQUAL_TO, - "SelectBackgroundPoints")); + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "SelectBackgroundPoints")); declareProperty("BackgroundOrder", 0, "Order of polynomial or chebyshev background. "); setPropertySettings("BackgroundOrder", - new VisibleWhenProperty("Options", IS_EQUAL_TO, - "SelectBackgroundPoints")); + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "SelectBackgroundPoints")); setPropertySettings("BackgroundOrder", - new VisibleWhenProperty("SelectionMode", IS_EQUAL_TO, - "FitGivenDataPoints")); + Kernel::make_unique<VisibleWhenProperty>( + "SelectionMode", IS_EQUAL_TO, "FitGivenDataPoints")); // User input background points for "SelectBackground" auto arrayproperty = @@ -130,11 +130,11 @@ void ProcessBackground::init() { "X-axis value of the background point " "selected by user."); setPropertySettings("BackgroundPoints", - new VisibleWhenProperty("Options", IS_EQUAL_TO, - "SelectBackgroundPoints")); + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "SelectBackgroundPoints")); setPropertySettings("BackgroundPoints", - new VisibleWhenProperty("SelectionMode", IS_EQUAL_TO, - "FitGivenDataPoints")); + Kernel::make_unique<VisibleWhenProperty>( + "SelectionMode", IS_EQUAL_TO, "FitGivenDataPoints")); declareProperty(Kernel::make_unique<WorkspaceProperty<TableWorkspace>>( "BackgroundTableWorkspace", "", Direction::Input, @@ -142,11 +142,11 @@ void ProcessBackground::init() { "Name of the table workspace containing background " "parameters for mode SelectBackgroundPoints."); setPropertySettings("BackgroundTableWorkspace", - new VisibleWhenProperty("Options", IS_EQUAL_TO, - "SelectBackgroundPoints")); - setPropertySettings( - "BackgroundTableWorkspace", - new VisibleWhenProperty("SelectionMode", IS_EQUAL_TO, "UserFunction")); + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "SelectBackgroundPoints")); + setPropertySettings("BackgroundTableWorkspace", + Kernel::make_unique<VisibleWhenProperty>( + "SelectionMode", IS_EQUAL_TO, "UserFunction")); // Mode to select background vector<string> pointsselectmode{"All Background Points", @@ -156,24 +156,24 @@ void ProcessBackground::init() { declareProperty("BackgroundPointSelectMode", "All Background Points", modevalidator, "Mode to select background points. "); setPropertySettings("BackgroundPointSelectMode", - new VisibleWhenProperty("Options", IS_EQUAL_TO, - "SelectBackgroundPoints")); + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "SelectBackgroundPoints")); setPropertySettings("BackgroundPointSelectMode", - new VisibleWhenProperty("SelectionMode", IS_EQUAL_TO, - "FitGivenDataPoints")); + Kernel::make_unique<VisibleWhenProperty>( + "SelectionMode", IS_EQUAL_TO, "FitGivenDataPoints")); // Background tolerance declareProperty("NoiseTolerance", 1.0, "Tolerance of noise range. "); setPropertySettings("NoiseTolerance", - new VisibleWhenProperty("Options", IS_EQUAL_TO, - "SelectBackgroundPoints")); + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "SelectBackgroundPoints")); // Background tolerance declareProperty("NegativeNoiseTolerance", EMPTY_DBL(), "Tolerance of noise range for negative number. "); setPropertySettings("NegativeNoiseTolerance", - new VisibleWhenProperty("Options", IS_EQUAL_TO, - "SelectBackgroundPoints")); + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "SelectBackgroundPoints")); // Optional output workspace declareProperty(Kernel::make_unique<WorkspaceProperty<Workspace2D>>( @@ -181,8 +181,8 @@ void ProcessBackground::init() { "Output workspace containing fitted background from points " "specified by users."); setPropertySettings("UserBackgroundWorkspace", - new VisibleWhenProperty("Options", IS_EQUAL_TO, - "SelectBackgroundPoints")); + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "SelectBackgroundPoints")); // Optional output workspace declareProperty( @@ -191,8 +191,8 @@ void ProcessBackground::init() { "Output parameter table workspace containing the background fitting " "result. "); setPropertySettings("OutputBackgroundParameterWorkspace", - new VisibleWhenProperty("Options", IS_EQUAL_TO, - "SelectBackgroundPoints")); + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "SelectBackgroundPoints")); // Output background type. std::vector<std::string> outbkgdtype{"Polynomial", "Chebyshev"}; @@ -201,33 +201,33 @@ void ProcessBackground::init() { declareProperty("OutputBackgroundType", "Polynomial", outbkgdvalidator, "Type of background to fit with selected background points."); setPropertySettings("OutputBackgroundType", - new VisibleWhenProperty("Options", IS_EQUAL_TO, - "SelectBackgroundPoints")); + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "SelectBackgroundPoints")); // Output background type. declareProperty( "OutputBackgroundOrder", 6, "Order of background to fit with selected background points."); setPropertySettings("OutputBackgroundOrder", - new VisibleWhenProperty("Options", IS_EQUAL_TO, - "SelectBackgroundPoints")); + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "SelectBackgroundPoints")); // Peak table workspac for "RemovePeaks" declareProperty(Kernel::make_unique<WorkspaceProperty<TableWorkspace>>( "BraggPeakTableWorkspace", "", Direction::Input, PropertyMode::Optional), "Name of table workspace containing peaks' parameters. "); - setPropertySettings( - "BraggPeakTableWorkspace", - new VisibleWhenProperty("Options", IS_EQUAL_TO, "RemovePeaks")); + setPropertySettings("BraggPeakTableWorkspace", + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "RemovePeaks")); // Number of FWHM to have peak removed declareProperty( "NumberOfFWHM", 1.0, "Number of FWHM to as the peak region to have peak removed. "); - setPropertySettings( - "NumberOfFWHM", - new VisibleWhenProperty("Options", IS_EQUAL_TO, "RemovePeaks")); + setPropertySettings("NumberOfFWHM", + Kernel::make_unique<VisibleWhenProperty>( + "Options", IS_EQUAL_TO, "RemovePeaks")); return; } diff --git a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp index 1185888bb42b5784a16ac6688fc6b83c379b4aff..32f4ffd0ff58cde3db2ad845f4dc99a29479a89f 100644 --- a/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp +++ b/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp @@ -288,8 +288,8 @@ void FilterEventsByLogValuePreNexus::init() { // TotalChunks is only meaningful if ChunkNumber is set // Would be nice to be able to restrict ChunkNumber to be <= TotalChunks at // validation - setPropertySettings("TotalChunks", - new VisibleWhenProperty("ChunkNumber", IS_NOT_DEFAULT)); + setPropertySettings("TotalChunks", make_unique<VisibleWhenProperty>( + "ChunkNumber", IS_NOT_DEFAULT)); // Loading option std::vector<std::string> propOptions{"Auto", "Serial", "Parallel"}; diff --git a/Framework/DataHandling/src/Load.cpp b/Framework/DataHandling/src/Load.cpp index 075cfb5410d6cde2941d422462523585a0fe0af2..1308a0ef46321decf8d669e99511b459d866649a 100644 --- a/Framework/DataHandling/src/Load.cpp +++ b/Framework/DataHandling/src/Load.cpp @@ -260,7 +260,7 @@ void Load::declareLoaderProperties(const API::IAlgorithm_sptr &loader) { continue; try { auto propClone = std::unique_ptr<Property>(loadProp->clone()); - propClone->deleteSettings(); // Get rid of special settings because it + propClone->clearSettings(); // Get rid of special settings because it // does not work in custom GUI. declareProperty(std::move(propClone), loadProp->documentation()); } catch (Exception::ExistsError &) { diff --git a/Framework/DataHandling/src/LoadAscii2.cpp b/Framework/DataHandling/src/LoadAscii2.cpp index 689a1c09de97f8db44c351e658cc8031fbfcbc90..e57436fe86180354ada4a30729128e48449cccbc 100644 --- a/Framework/DataHandling/src/LoadAscii2.cpp +++ b/Framework/DataHandling/src/LoadAscii2.cpp @@ -619,9 +619,9 @@ void LoadAscii2::init() { Direction::Input), "If present, will override any specified choice given to Separator."); - setPropertySettings( - "CustomSeparator", - new VisibleWhenProperty("Separator", IS_EQUAL_TO, "UserDefined")); + setPropertySettings("CustomSeparator", + make_unique<VisibleWhenProperty>("Separator", IS_EQUAL_TO, + "UserDefined")); declareProperty("CommentIndicator", "#", "Character(s) found front of " "comment lines. Cannot contain " diff --git a/Framework/DataHandling/src/LoadEventNexus.cpp b/Framework/DataHandling/src/LoadEventNexus.cpp index 77637588a8ecc93378ecb6be92d387d36a0220bc..a81ed630afaad2ddb924983f59ff8ae2d14a0671 100644 --- a/Framework/DataHandling/src/LoadEventNexus.cpp +++ b/Framework/DataHandling/src/LoadEventNexus.cpp @@ -1120,8 +1120,8 @@ void LoadEventNexus::init() { "load with BankName. " "Only pixels in the specified bank will be created if true; " "all of the instrument's pixels will be created otherwise."); - setPropertySettings("SingleBankPixelsOnly", - new VisibleWhenProperty("BankName", IS_NOT_DEFAULT)); + setPropertySettings("SingleBankPixelsOnly", make_unique<VisibleWhenProperty>( + "BankName", IS_NOT_DEFAULT)); std::string grp2 = "Loading a Single Bank"; setPropertyGroup("BankName", grp2); @@ -1152,8 +1152,8 @@ void LoadEventNexus::init() { // TotalChunks is only meaningful if ChunkNumber is set // Would be nice to be able to restrict ChunkNumber to be <= TotalChunks at // validation - setPropertySettings("TotalChunks", - new VisibleWhenProperty("ChunkNumber", IS_NOT_DEFAULT)); + setPropertySettings("TotalChunks", make_unique<VisibleWhenProperty>( + "ChunkNumber", IS_NOT_DEFAULT)); std::string grp3 = "Reduce Memory Use"; setPropertyGroup("Precount", grp3); @@ -1197,13 +1197,16 @@ void LoadEventNexus::init() { setPropertySettings( "MonitorsAsEvents", - new VisibleWhenProperty("LoadMonitors", IS_EQUAL_TO, "1")); - IPropertySettings *asEventsIsOn = - new VisibleWhenProperty("MonitorsAsEvents", IS_EQUAL_TO, "1"); - setPropertySettings("FilterMonByTofMin", asEventsIsOn); - setPropertySettings("FilterMonByTofMax", asEventsIsOn->clone()); - setPropertySettings("FilterMonByTimeStart", asEventsIsOn->clone()); - setPropertySettings("FilterMonByTimeStop", asEventsIsOn->clone()); + make_unique<VisibleWhenProperty>("LoadMonitors", IS_EQUAL_TO, "1")); + auto asEventsIsOn = [] { + std::unique_ptr<IPropertySettings> prop = + make_unique<VisibleWhenProperty>("MonitorsAsEvents", IS_EQUAL_TO, "1"); + return prop; + }; + setPropertySettings("FilterMonByTofMin", asEventsIsOn()); + setPropertySettings("FilterMonByTofMax", asEventsIsOn()); + setPropertySettings("FilterMonByTimeStart", asEventsIsOn()); + setPropertySettings("FilterMonByTimeStop", asEventsIsOn()); std::string grp4 = "Monitors"; setPropertyGroup("LoadMonitors", grp4); diff --git a/Framework/DataHandling/src/LoadEventPreNexus.cpp b/Framework/DataHandling/src/LoadEventPreNexus.cpp index 95d9ce35fcebf541042b40db9f54fc7a7b865fc7..3c2c329fd7f9b82720891f465a8b5810c84016b0 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus.cpp @@ -158,8 +158,8 @@ void LoadEventPreNexus::init() { // TotalChunks is only meaningful if ChunkNumber is set // Would be nice to be able to restrict ChunkNumber to be <= TotalChunks at // validation - setPropertySettings("TotalChunks", - new VisibleWhenProperty("ChunkNumber", IS_NOT_DEFAULT)); + setPropertySettings("TotalChunks", make_unique<VisibleWhenProperty>( + "ChunkNumber", IS_NOT_DEFAULT)); std::vector<std::string> propOptions{"Auto", "Serial", "Parallel"}; declareProperty("UseParallelProcessing", "Auto", diff --git a/Framework/DataHandling/src/LoadEventPreNexus2.cpp b/Framework/DataHandling/src/LoadEventPreNexus2.cpp index 3843a4dc9ac298c026a22dd4b10a7a0d02c92d2b..654281ac52fe440438a047bfe3ed5167cd059eaf 100644 --- a/Framework/DataHandling/src/LoadEventPreNexus2.cpp +++ b/Framework/DataHandling/src/LoadEventPreNexus2.cpp @@ -279,8 +279,8 @@ void LoadEventPreNexus2::init() { // TotalChunks is only meaningful if ChunkNumber is set // Would be nice to be able to restrict ChunkNumber to be <= TotalChunks at // validation - setPropertySettings("TotalChunks", - new VisibleWhenProperty("ChunkNumber", IS_NOT_DEFAULT)); + setPropertySettings("TotalChunks", make_unique<VisibleWhenProperty>( + "ChunkNumber", IS_NOT_DEFAULT)); std::vector<std::string> propOptions{"Auto", "Serial", "Parallel"}; declareProperty("UseParallelProcessing", "Auto", diff --git a/Framework/DataHandling/src/LoadPreNexus.cpp b/Framework/DataHandling/src/LoadPreNexus.cpp index e7f6611b2cc3fe32c506796b4962027f14456848..625fe27cc6fddacdac80187491449700d5604d32 100644 --- a/Framework/DataHandling/src/LoadPreNexus.cpp +++ b/Framework/DataHandling/src/LoadPreNexus.cpp @@ -98,8 +98,8 @@ void LoadPreNexus::init() { // TotalChunks is only meaningful if ChunkNumber is set // Would be nice to be able to restrict ChunkNumber to be <= TotalChunks at // validation - setPropertySettings("TotalChunks", - new VisibleWhenProperty("ChunkNumber", IS_NOT_DEFAULT)); + setPropertySettings("TotalChunks", make_unique<VisibleWhenProperty>( + "ChunkNumber", IS_NOT_DEFAULT)); std::vector<std::string> propOptions{"Auto", "Serial", "Parallel"}; declareProperty("UseParallelProcessing", "Auto", boost::make_shared<StringListValidator>(propOptions), diff --git a/Framework/DataHandling/src/SaveAscii.cpp b/Framework/DataHandling/src/SaveAscii.cpp index 1a0cda497abb64abb306bede24f7afeea051b418..da6e03f2dad741e59bcd3060c67026d97592db42 100644 --- a/Framework/DataHandling/src/SaveAscii.cpp +++ b/Framework/DataHandling/src/SaveAscii.cpp @@ -77,9 +77,9 @@ void SaveAscii::init() { Direction::Input), "If present, will override any specified choice given to Separator."); - setPropertySettings( - "CustomSeparator", - new VisibleWhenProperty("Separator", IS_EQUAL_TO, "UserDefined")); + setPropertySettings("CustomSeparator", + make_unique<VisibleWhenProperty>("Separator", IS_EQUAL_TO, + "UserDefined")); declareProperty("ColumnHeader", true, "If true, put column headers into file. "); diff --git a/Framework/DataHandling/src/SaveAscii2.cpp b/Framework/DataHandling/src/SaveAscii2.cpp index 386989b4d415ef523ca427c3c939f136619ccfc9..ee465beae823f89d7623fc3e7de637668d0285ac 100644 --- a/Framework/DataHandling/src/SaveAscii2.cpp +++ b/Framework/DataHandling/src/SaveAscii2.cpp @@ -93,9 +93,9 @@ void SaveAscii2::init() { Direction::Input), "If present, will override any specified choice given to Separator."); - setPropertySettings( - "CustomSeparator", - new VisibleWhenProperty("Separator", IS_EQUAL_TO, "UserDefined")); + setPropertySettings("CustomSeparator", + make_unique<VisibleWhenProperty>("Separator", IS_EQUAL_TO, + "UserDefined")); declareProperty("ColumnHeader", true, "If true, put column headers into file. "); diff --git a/Framework/DataHandling/src/SaveNexusProcessed.cpp b/Framework/DataHandling/src/SaveNexusProcessed.cpp index 5528d75c5fee76b503300e2748402a7499764a7f..20a1f05842c36607b2ccfe1f441d4eda9af4db72 100644 --- a/Framework/DataHandling/src/SaveNexusProcessed.cpp +++ b/Framework/DataHandling/src/SaveNexusProcessed.cpp @@ -75,17 +75,17 @@ void SaveNexusProcessed::init() { "For EventWorkspaces, preserve the events when saving (default).\n" "If false, will save the 2D histogram version of the workspace with the " "current binning parameters."); - setPropertySettings( - "PreserveEvents", - new EnabledWhenWorkspaceIsType<EventWorkspace>("InputWorkspace", true)); + setPropertySettings("PreserveEvents", + make_unique<EnabledWhenWorkspaceIsType<EventWorkspace>>( + "InputWorkspace", true)); declareProperty( "CompressNexus", false, "For EventWorkspaces, compress the Nexus data field (default False).\n" "This will make smaller files but takes much longer."); - setPropertySettings( - "CompressNexus", - new EnabledWhenWorkspaceIsType<EventWorkspace>("InputWorkspace", true)); + setPropertySettings("CompressNexus", + make_unique<EnabledWhenWorkspaceIsType<EventWorkspace>>( + "InputWorkspace", true)); } /** Get the list of workspace indices to use diff --git a/Framework/DataHandling/src/SaveOpenGenieAscii.cpp b/Framework/DataHandling/src/SaveOpenGenieAscii.cpp index 72f85fd5dafafbbea8887f885f5079855b260d26..4dfe0316a8ae32e84b87953484c31d0705fe1a1e 100644 --- a/Framework/DataHandling/src/SaveOpenGenieAscii.cpp +++ b/Framework/DataHandling/src/SaveOpenGenieAscii.cpp @@ -61,8 +61,8 @@ void SaveOpenGenieAscii::init() { "Spec number is a required field for ENGIN-X format of OpenGenie," "an example of spec number would be: 1201 - 1400"); setPropertySettings("SpecNumberField", - new VisibleWhenProperty("OpenGenieFormat", IS_EQUAL_TO, - "ENGIN-X Format")); + make_unique<VisibleWhenProperty>( + "OpenGenieFormat", IS_EQUAL_TO, "ENGIN-X Format")); } void SaveOpenGenieAscii::exec() { diff --git a/Framework/DataHandling/src/SetSampleMaterial.cpp b/Framework/DataHandling/src/SetSampleMaterial.cpp index 9f413bab15ba90c1dbc24a286bca40b0bad42878..886a82a8e7c9867dddd9e0d671911885d3f5091f 100644 --- a/Framework/DataHandling/src/SetSampleMaterial.cpp +++ b/Framework/DataHandling/src/SetSampleMaterial.cpp @@ -94,18 +94,18 @@ void SetSampleMaterial::init() { setPropertyGroup("ScatteringXSection", specificValuesGrp); // Extra property settings - setPropertySettings( - "AtomicNumber", - new Kernel::EnabledWhenProperty("ChemicalFormula", Kernel::IS_DEFAULT)); - setPropertySettings("MassNumber", new Kernel::EnabledWhenProperty( + setPropertySettings("AtomicNumber", + make_unique<Kernel::EnabledWhenProperty>( + "ChemicalFormula", Kernel::IS_DEFAULT)); + setPropertySettings("MassNumber", make_unique<Kernel::EnabledWhenProperty>( "ChemicalFormula", Kernel::IS_DEFAULT)); setPropertySettings("UnitCellVolume", - new Kernel::EnabledWhenProperty("SampleNumberDensity", - Kernel::IS_DEFAULT)); + make_unique<Kernel::EnabledWhenProperty>( + "SampleNumberDensity", Kernel::IS_DEFAULT)); setPropertySettings("ZParameter", - new Kernel::EnabledWhenProperty("SampleNumberDensity", - Kernel::IS_DEFAULT)); + make_unique<Kernel::EnabledWhenProperty>( + "SampleNumberDensity", Kernel::IS_DEFAULT)); // output properties declareProperty( diff --git a/Framework/Kernel/inc/MantidKernel/EnabledWhenProperty.h b/Framework/Kernel/inc/MantidKernel/EnabledWhenProperty.h index b607ebaa2add5ea8ebc6a6cee94860e4e9faf60b..08dfa67e106949344ea6b946757eb1f5c4263e2d 100644 --- a/Framework/Kernel/inc/MantidKernel/EnabledWhenProperty.h +++ b/Framework/Kernel/inc/MantidKernel/EnabledWhenProperty.h @@ -30,13 +30,15 @@ enum ePropertyCriterion { - Add a call like this: - setPropertySettings("PropA", new EnabledWhenProperty("OtherProperty", + setPropertySettings("PropA", + make_unique<EnabledWhenProperty>("OtherProperty", IS_EQUAL_TO, "2000"); - This will make the property "PropA" show as enabled when "OtherProperty"'s value is equal to "2000". Similarly, you can use: - setPropertySettings("PropA", new VisibleWhenProperty("OtherProperty", + setPropertySettings("PropA", + make_unique<VisibleWhenProperty>("OtherProperty", IS_NOT_DEFAULT); - This will make the property "PropA" show as visible when "OtherProperty" diff --git a/Framework/Kernel/inc/MantidKernel/IPropertyManager.h b/Framework/Kernel/inc/MantidKernel/IPropertyManager.h index 9ff28ed0d17f7efbcc05120a92f44f92fe98c683..f734f8333168f4e065e45c26223e96318e5cab8a 100644 --- a/Framework/Kernel/inc/MantidKernel/IPropertyManager.h +++ b/Framework/Kernel/inc/MantidKernel/IPropertyManager.h @@ -185,10 +185,10 @@ public: * @param name :: property name * @param settings :: IPropertySettings */ void setPropertySettings(const std::string &name, - IPropertySettings *settings) { + std::unique_ptr<IPropertySettings> settings) { Property *prop = getPointerToProperty(name); if (prop) - prop->setSettings(settings); + prop->setSettings(std::move(settings)); } /** Set the group for a given property * @param name :: property name diff --git a/Framework/Kernel/inc/MantidKernel/Property.h b/Framework/Kernel/inc/MantidKernel/Property.h index e020c17649121b15365749b7f28d85d39c4c75c9..bcc43c92a5e132949a506822bf3b722283036eb6 100644 --- a/Framework/Kernel/inc/MantidKernel/Property.h +++ b/Framework/Kernel/inc/MantidKernel/Property.h @@ -113,11 +113,11 @@ public: virtual std::string isValid() const; /// Set the PropertySettings object - void setSettings(IPropertySettings *settings); + void setSettings(std::unique_ptr<IPropertySettings> settings); /** @return the PropertySettings for this property */ IPropertySettings *getSettings(); /** Deletes the PropertySettings object contained */ - void deleteSettings(); + void clearSettings(); /// Overriden function that returns if property has the same value that it was /// initialised with, if applicable @@ -207,7 +207,7 @@ private: std::string m_units; /// Property settings (enabled/visible) - IPropertySettings *m_settings; + std::unique_ptr<IPropertySettings> m_settings; /// Name of the "group" of this property, for grouping in the GUI. Default "" std::string m_group; diff --git a/Framework/Kernel/src/Property.cpp b/Framework/Kernel/src/Property.cpp index 935bc7d178a17c447a8bf8b505cec7c23f788172..1697752fc4ddf34eeccd64834160310fd60cdc1a 100644 --- a/Framework/Kernel/src/Property.cpp +++ b/Framework/Kernel/src/Property.cpp @@ -18,8 +18,7 @@ namespace Kernel { Property::Property(const std::string &name, const std::type_info &type, const unsigned int direction) : m_name(name), m_documentation(""), m_typeinfo(&type), - m_direction(direction), m_units(""), m_settings(nullptr), m_group(""), - m_remember(true) { + m_direction(direction), m_units(""), m_group(""), m_remember(true) { // Make sure a random int hasn't been passed in for the direction // Property & PropertyWithValue destructors will be called in this case if (m_direction > 2) @@ -31,17 +30,14 @@ Property::Property(const std::string &name, const std::type_info &type, Property::Property(const Property &right) : m_name(right.m_name), m_documentation(right.m_documentation), m_typeinfo(right.m_typeinfo), m_direction(right.m_direction), - m_units(right.m_units), m_settings(nullptr), m_group(right.m_group), + m_units(right.m_units), m_group(right.m_group), m_remember(right.m_remember) { if (right.m_settings) - m_settings = right.m_settings->clone(); + m_settings.reset(right.m_settings->clone()); } /// Virtual destructor -Property::~Property() { - if (m_settings) - delete m_settings; -} +Property::~Property() {} /** Get the property's name * @return The name of the property @@ -85,25 +81,20 @@ std::string Property::isValid() const { * Takes ownership of the given object * @param settings A pointer to an object specifying the settings type */ -void Property::setSettings(IPropertySettings *settings) { - if (m_settings) - delete m_settings; - m_settings = settings; +void Property::setSettings(std::unique_ptr<IPropertySettings> settings) { + m_settings = std::move(settings); } /** * * @return the PropertySettings for this property */ -IPropertySettings *Property::getSettings() { return m_settings; } +IPropertySettings *Property::getSettings() { return m_settings.get(); } /** * Deletes the PropertySettings object contained */ -void Property::deleteSettings() { - delete m_settings; - m_settings = nullptr; -} +void Property::clearSettings() { m_settings.reset(nullptr); } /** * Whether to remember this property input diff --git a/Framework/Kernel/test/EnabledWhenPropertyTest.h b/Framework/Kernel/test/EnabledWhenPropertyTest.h index 20caf9b265779c621e59133c88cc061453eb00b4..2f33c74c4c3f6bd4b0ff21624072fac7a1366bd7 100644 --- a/Framework/Kernel/test/EnabledWhenPropertyTest.h +++ b/Framework/Kernel/test/EnabledWhenPropertyTest.h @@ -22,10 +22,11 @@ public: // Make a property with its validator. Will be enabled when that other one // is NOT the default - EnabledWhenProperty *val = - new EnabledWhenProperty("MyIntProp", IS_NOT_DEFAULT); + auto val = [] { + return make_unique<EnabledWhenProperty>("MyIntProp", IS_NOT_DEFAULT); + }; alg.declareProperty("MyValidatorProp", 456); - alg.setPropertySettings("MyValidatorProp", val); + alg.setPropertySettings("MyValidatorProp", val()); Property *prop = alg.getPointerToProperty("MyValidatorProp"); TS_ASSERT(prop); @@ -40,9 +41,8 @@ public: TSM_ASSERT("Becomes enabled when another property has been changed", prop->getSettings()->isEnabled(&alg)); - IPropertySettings *val2 = val->clone(); alg.declareProperty("MySecondValidatorProp", 456); - alg.setPropertySettings("MySecondValidatorProp", val2); + alg.setPropertySettings("MySecondValidatorProp", val()); prop = alg.getPointerToProperty("MySecondValidatorProp"); TSM_ASSERT("Starts off enabled", prop->getSettings()->isEnabled(&alg)); alg.setProperty("MyIntProp", 123); @@ -54,9 +54,9 @@ public: alg.declareProperty("MyIntProp", 123); // Make a property with its validator. Will be enabled when that other one // is the default - EnabledWhenProperty *val = new EnabledWhenProperty("MyIntProp", IS_DEFAULT); alg.declareProperty("MyValidatorProp", 456); - alg.setPropertySettings("MyValidatorProp", val); + alg.setPropertySettings("MyValidatorProp", make_unique<EnabledWhenProperty>( + "MyIntProp", IS_DEFAULT)); Property *prop = alg.getPointerToProperty("MyValidatorProp"); TS_ASSERT(prop); if (!prop) @@ -70,10 +70,10 @@ public: void test_when_IS_EQUAL_TO() { PropertyManagerOwner alg; alg.declareProperty("MyIntProp", 123); - EnabledWhenProperty *val = - new EnabledWhenProperty("MyIntProp", IS_EQUAL_TO, "234"); alg.declareProperty("MyValidatorProp", 456); - alg.setPropertySettings("MyValidatorProp", val); + alg.setPropertySettings( + "MyValidatorProp", + make_unique<EnabledWhenProperty>("MyIntProp", IS_EQUAL_TO, "234")); Property *prop = alg.getPointerToProperty("MyValidatorProp"); TS_ASSERT(prop); if (!prop) @@ -88,10 +88,10 @@ public: void test_when_IS_NOT_EQUAL_TO() { PropertyManagerOwner alg; alg.declareProperty("MyIntProp", 123); - EnabledWhenProperty *val = - new EnabledWhenProperty("MyIntProp", IS_NOT_EQUAL_TO, "234"); alg.declareProperty("MyValidatorProp", 456); - alg.setPropertySettings("MyValidatorProp", val); + alg.setPropertySettings( + "MyValidatorProp", + make_unique<EnabledWhenProperty>("MyIntProp", IS_NOT_EQUAL_TO, "234")); Property *prop = alg.getPointerToProperty("MyValidatorProp"); TS_ASSERT(prop); if (!prop) diff --git a/Framework/Kernel/test/VisibleWhenPropertyTest.h b/Framework/Kernel/test/VisibleWhenPropertyTest.h index 197009c33bdc9c841ba2cd705ee024caed7ea845..9e25467a253a56007a1692c780c9e0b19ef55d72 100644 --- a/Framework/Kernel/test/VisibleWhenPropertyTest.h +++ b/Framework/Kernel/test/VisibleWhenPropertyTest.h @@ -20,10 +20,10 @@ public: // Make a property with its validator. Will be Visible when that other one // is NOT the default - VisibleWhenProperty *val = - new VisibleWhenProperty("MyIntProp", IS_NOT_DEFAULT); alg.declareProperty("MyValidatorProp", 456); - alg.setPropertySettings("MyValidatorProp", val); + alg.setPropertySettings( + "MyValidatorProp", + make_unique<VisibleWhenProperty>("MyIntProp", IS_NOT_DEFAULT)); Property *prop = alg.getPointerToProperty("MyValidatorProp"); TS_ASSERT(prop); @@ -38,9 +38,10 @@ public: TSM_ASSERT("Becomes visible when another property has been changed", prop->getSettings()->isVisible(&alg)); - IPropertySettings *val2 = val->clone(); alg.declareProperty("MySecondValidatorProp", 456); - alg.setPropertySettings("MySecondValidatorProp", val2); + alg.setPropertySettings( + "MySecondValidatorProp", + make_unique<VisibleWhenProperty>("MyIntProp", IS_NOT_DEFAULT)); prop = alg.getPointerToProperty("MySecondValidatorProp"); TSM_ASSERT("Starts off visible", prop->getSettings()->isVisible(&alg)); alg.setProperty("MyIntProp", 123); @@ -53,9 +54,9 @@ public: alg.declareProperty("MyIntProp", 123); // Make a property with its validator. Will be Visible when that other one // is the default - VisibleWhenProperty *val = new VisibleWhenProperty("MyIntProp", IS_DEFAULT); alg.declareProperty("MyValidatorProp", 456); - alg.setPropertySettings("MyValidatorProp", val); + alg.setPropertySettings("MyValidatorProp", make_unique<VisibleWhenProperty>( + "MyIntProp", IS_DEFAULT)); Property *prop = alg.getPointerToProperty("MyValidatorProp"); TS_ASSERT(prop); if (!prop) @@ -69,10 +70,10 @@ public: void test_when_IS_EQUAL_TO() { PropertyManagerOwner alg; alg.declareProperty("MyIntProp", 123); - VisibleWhenProperty *val = - new VisibleWhenProperty("MyIntProp", IS_EQUAL_TO, "234"); alg.declareProperty("MyValidatorProp", 456); - alg.setPropertySettings("MyValidatorProp", val); + alg.setPropertySettings( + "MyValidatorProp", + make_unique<VisibleWhenProperty>("MyIntProp", IS_EQUAL_TO, "234")); Property *prop = alg.getPointerToProperty("MyValidatorProp"); TS_ASSERT(prop); if (!prop) @@ -87,10 +88,10 @@ public: void test_when_IS_NOT_EQUAL_TO() { PropertyManagerOwner alg; alg.declareProperty("MyIntProp", 123); - VisibleWhenProperty *val = - new VisibleWhenProperty("MyIntProp", IS_NOT_EQUAL_TO, "234"); alg.declareProperty("MyValidatorProp", 456); - alg.setPropertySettings("MyValidatorProp", val); + alg.setPropertySettings( + "MyValidatorProp", + make_unique<VisibleWhenProperty>("MyIntProp", IS_NOT_EQUAL_TO, "234")); Property *prop = alg.getPointerToProperty("MyValidatorProp"); TS_ASSERT(prop); if (!prop) diff --git a/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace2.cpp b/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace2.cpp index e98d514c79c12615d0f181518d885a4fab106490..82b312955a3f09216f9d46232786eb6b708f494b 100644 --- a/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace2.cpp +++ b/Framework/MDAlgorithms/src/ConvertToDiffractionMDWorkspace2.cpp @@ -58,7 +58,8 @@ void ConvertToDiffractionMDWorkspace2::init() { "conversion (to save memory) is not supported by algorithm " "v2"); // disable property on interface - this->setPropertySettings("ClearInputWorkspace", new DisabledProperty()); + this->setPropertySettings("ClearInputWorkspace", + make_unique<DisabledProperty>()); declareProperty( make_unique<PropertyWithValue<bool>>("OneEventPerBin", true, diff --git a/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp b/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp index 5df7c5f54db20e15b25166da4992e5255bb16673..3197de28632d0798a40788312a281b8302f3871a 100644 --- a/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp +++ b/Framework/MDAlgorithms/src/ConvertToMDMinMaxGlobal.cpp @@ -95,9 +95,9 @@ void ConvertToMDMinMaxGlobal::init() { "*MD Transformation factory* for further details.", Direction::InOut); - setPropertySettings( - "dEAnalysisMode", - new VisibleWhenProperty("QDimensions", IS_NOT_EQUAL_TO, "CopyToMD")); + setPropertySettings("dEAnalysisMode", + make_unique<VisibleWhenProperty>( + "QDimensions", IS_NOT_EQUAL_TO, "CopyToMD")); std::vector<std::string> TargFrames{"AutoSelect", "Q", "HKL"}; declareProperty( @@ -109,8 +109,8 @@ void ConvertToMDMinMaxGlobal::init() { "laboratory or sample frame." " **HKL** - reciprocal lattice units"); - setPropertySettings( - "Q3DFrames", new VisibleWhenProperty("QDimensions", IS_EQUAL_TO, "Q3D")); + setPropertySettings("Q3DFrames", make_unique<VisibleWhenProperty>( + "QDimensions", IS_EQUAL_TO, "Q3D")); declareProperty( make_unique<ArrayProperty<std::string>>("OtherDimensions", diff --git a/Framework/MDAlgorithms/src/ConvertToMDParent.cpp b/Framework/MDAlgorithms/src/ConvertToMDParent.cpp index 06f970e0b4f18c2e1dfa1f14af74a7ab3ab7897f..ee652c35c33affeb8a1555e272c4cec50b18fdaf 100644 --- a/Framework/MDAlgorithms/src/ConvertToMDParent.cpp +++ b/Framework/MDAlgorithms/src/ConvertToMDParent.cpp @@ -91,11 +91,11 @@ void ConvertToMDParent::init() { "depending on the target coordinate " "system, defined by the property **OutputDimensions**. "); - setPropertySettings("Q3DFrames", new Kernel::VisibleWhenProperty( + setPropertySettings("Q3DFrames", make_unique<Kernel::VisibleWhenProperty>( "QDimensions", IS_EQUAL_TO, "Q3D")); - setPropertySettings( - "QconversionScales", - new Kernel::VisibleWhenProperty("QDimensions", IS_EQUAL_TO, "Q3D")); + setPropertySettings("QconversionScales", + make_unique<Kernel::VisibleWhenProperty>( + "QDimensions", IS_EQUAL_TO, "Q3D")); declareProperty( make_unique<ArrayProperty<std::string>>("OtherDimensions", diff --git a/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp b/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp index fc12ba9e8718583ceafcd66a246753e17739e5f6..9ebc7545a702a3c915747d0e3c5eccb747af3a88 100644 --- a/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp +++ b/Framework/MDAlgorithms/src/ConvertToReflectometryQ.cpp @@ -225,8 +225,8 @@ void ConvertToReflectometryQ::init() { "+-50 in each dimension."); setPropertySettings("IncidentTheta", - new Kernel::EnabledWhenProperty("OverrideIncidentTheta", - IS_EQUAL_TO, "1")); + make_unique<Kernel::EnabledWhenProperty>( + "OverrideIncidentTheta", IS_EQUAL_TO, "1")); declareProperty( make_unique<Kernel::PropertyWithValue<bool>>("OutputAsMDWorkspace", true), @@ -259,22 +259,22 @@ void ConvertToReflectometryQ::init() { setPropertySettings( "NumberBinsQx", - new EnabledWhenProperty("OutputAsMDWorkspace", IS_NOT_DEFAULT)); + make_unique<EnabledWhenProperty>("OutputAsMDWorkspace", IS_NOT_DEFAULT)); setPropertySettings( "NumberBinsQz", - new EnabledWhenProperty("OutputAsMDWorkspace", IS_NOT_DEFAULT)); + make_unique<EnabledWhenProperty>("OutputAsMDWorkspace", IS_NOT_DEFAULT)); // Create box controller properties. this->initBoxControllerProps("2,2", 50, 10); // Only show box controller properties when a md workspace is returned. - setPropertySettings( - "SplitInto", new EnabledWhenProperty("OutputAsMDWorkspace", IS_DEFAULT)); - setPropertySettings("SplitThreshold", new EnabledWhenProperty( + setPropertySettings("SplitInto", make_unique<EnabledWhenProperty>( + "OutputAsMDWorkspace", IS_DEFAULT)); + setPropertySettings("SplitThreshold", make_unique<EnabledWhenProperty>( "OutputAsMDWorkspace", IS_DEFAULT)); setPropertySettings( "MaxRecursionDepth", - new EnabledWhenProperty("OutputAsMDWorkspace", IS_DEFAULT)); + make_unique<EnabledWhenProperty>("OutputAsMDWorkspace", IS_DEFAULT)); } //---------------------------------------------------------------------------------------------- diff --git a/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp b/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp index f8c43dbae490578f12542178c25e65e2ba7b70c8..b974f302eb4d02899a8ff350b7dd6653be79b1a2 100644 --- a/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp +++ b/Framework/MDAlgorithms/src/CreateMDWorkspace.cpp @@ -95,8 +95,8 @@ void CreateMDWorkspace::init() { "If Filename is specified to use a file back end:\n" " The amount of memory (in MB) to allocate to the in-memory cache.\n" " If not specified, a default of 40% of free physical memory is used."); - setPropertySettings("Memory", - new EnabledWhenProperty("Filename", IS_NOT_DEFAULT)); + setPropertySettings( + "Memory", make_unique<EnabledWhenProperty>("Filename", IS_NOT_DEFAULT)); } /** Finish initialisation diff --git a/Framework/MDAlgorithms/src/LoadMD.cpp b/Framework/MDAlgorithms/src/LoadMD.cpp index 5cd8c69214525ef22314f500bd74caf5a0a4bc05..27fd31d7df81745f1dd9d6ae1318ae472d2b92c0 100644 --- a/Framework/MDAlgorithms/src/LoadMD.cpp +++ b/Framework/MDAlgorithms/src/LoadMD.cpp @@ -95,16 +95,16 @@ void LoadMD::init() { declareProperty(make_unique<PropertyWithValue<bool>>("FileBackEnd", false), "Set to true to load the data only on demand."); - setPropertySettings( - "FileBackEnd", new EnabledWhenProperty("MetadataOnly", IS_EQUAL_TO, "0")); + setPropertySettings("FileBackEnd", make_unique<EnabledWhenProperty>( + "MetadataOnly", IS_EQUAL_TO, "0")); declareProperty( make_unique<PropertyWithValue<double>>("Memory", -1), "For FileBackEnd only: the amount of memory (in MB) to allocate to the " "in-memory cache.\n" "If not specified, a default of 40% of free physical memory is used."); - setPropertySettings("Memory", - new EnabledWhenProperty("FileBackEnd", IS_EQUAL_TO, "1")); + setPropertySettings("Memory", make_unique<EnabledWhenProperty>( + "FileBackEnd", IS_EQUAL_TO, "1")); declareProperty(make_unique<WorkspaceProperty<IMDWorkspace>>( "OutputWorkspace", "", Direction::Output), diff --git a/Framework/MDAlgorithms/src/QueryMDWorkspace.cpp b/Framework/MDAlgorithms/src/QueryMDWorkspace.cpp index 54547222061e15c6a2200ac0923590d53f945a13..6bec5ed699dc5bfc998e4c42e1e0e63f47df8d75 100644 --- a/Framework/MDAlgorithms/src/QueryMDWorkspace.cpp +++ b/Framework/MDAlgorithms/src/QueryMDWorkspace.cpp @@ -88,8 +88,8 @@ void QueryMDWorkspace::init() { boost::make_shared<BoundedValidator<int>>(), Direction::Input), "The number of neighbours to utilise. Defaults to 100000."); - setPropertySettings("MaximumRows", - new EnabledWhenProperty("LimitRows", IS_DEFAULT)); + setPropertySettings( + "MaximumRows", make_unique<EnabledWhenProperty>("LimitRows", IS_DEFAULT)); std::vector<std::string> propOptions; propOptions.push_back(noNormalisationOption()); diff --git a/Framework/MDAlgorithms/src/SaveMD.cpp b/Framework/MDAlgorithms/src/SaveMD.cpp index 49654607e555efcccd2eb56bb385f304a60dc422..2ed42138605b9cd2a497438803b5377b02931aa5 100644 --- a/Framework/MDAlgorithms/src/SaveMD.cpp +++ b/Framework/MDAlgorithms/src/SaveMD.cpp @@ -53,8 +53,8 @@ void SaveMD::init() { "The name of the Nexus file to write, as a full or relative path.\n" "Optional if UpdateFileBackEnd is checked."); // Filename is NOT used if UpdateFileBackEnd - setPropertySettings("Filename", new EnabledWhenProperty("UpdateFileBackEnd", - IS_EQUAL_TO, "0")); + setPropertySettings("Filename", make_unique<EnabledWhenProperty>( + "UpdateFileBackEnd", IS_EQUAL_TO, "0")); declareProperty( "UpdateFileBackEnd", false, @@ -63,7 +63,7 @@ void SaveMD::init() { "to reflect the current data structure. Filename parameter is ignored."); setPropertySettings( "UpdateFileBackEnd", - new EnabledWhenProperty("MakeFileBacked", IS_EQUAL_TO, "0")); + make_unique<EnabledWhenProperty>("MakeFileBacked", IS_EQUAL_TO, "0")); declareProperty("MakeFileBacked", false, "For an MDEventWorkspace that was created in memory:\n" @@ -71,7 +71,7 @@ void SaveMD::init() { "file-backed one."); setPropertySettings( "MakeFileBacked", - new EnabledWhenProperty("UpdateFileBackEnd", IS_EQUAL_TO, "0")); + make_unique<EnabledWhenProperty>("UpdateFileBackEnd", IS_EQUAL_TO, "0")); } //---------------------------------------------------------------------------------------------- diff --git a/Framework/MDAlgorithms/src/SaveMD2.cpp b/Framework/MDAlgorithms/src/SaveMD2.cpp index acd94d7c8a310ce832f1ff9a3571af699bacedb8..0e9bbb28e2fde6b61067ebf0a0f554ee3e07c435 100644 --- a/Framework/MDAlgorithms/src/SaveMD2.cpp +++ b/Framework/MDAlgorithms/src/SaveMD2.cpp @@ -55,8 +55,8 @@ void SaveMD2::init() { "The name of the Nexus file to write, as a full or relative path.\n" "Optional if UpdateFileBackEnd is checked."); // Filename is NOT used if UpdateFileBackEnd - setPropertySettings("Filename", new EnabledWhenProperty("UpdateFileBackEnd", - IS_EQUAL_TO, "0")); + setPropertySettings("Filename", make_unique<EnabledWhenProperty>( + "UpdateFileBackEnd", IS_EQUAL_TO, "0")); declareProperty( "UpdateFileBackEnd", false, @@ -65,7 +65,7 @@ void SaveMD2::init() { "to reflect the current data structure. Filename parameter is ignored."); setPropertySettings( "UpdateFileBackEnd", - new EnabledWhenProperty("MakeFileBacked", IS_EQUAL_TO, "0")); + make_unique<EnabledWhenProperty>("MakeFileBacked", IS_EQUAL_TO, "0")); declareProperty("MakeFileBacked", false, "For an MDEventWorkspace that was created in memory:\n" @@ -73,7 +73,7 @@ void SaveMD2::init() { "file-backed one."); setPropertySettings( "MakeFileBacked", - new EnabledWhenProperty("UpdateFileBackEnd", IS_EQUAL_TO, "0")); + make_unique<EnabledWhenProperty>("UpdateFileBackEnd", IS_EQUAL_TO, "0")); } //---------------------------------------------------------------------------------------------- diff --git a/Framework/MDAlgorithms/src/SliceMD.cpp b/Framework/MDAlgorithms/src/SliceMD.cpp index 0d8c18685bcd1beb17d5d9e5234e35706708cb72..fca1d6ad154b8251363e5e1dcfce2236a9f07a49 100644 --- a/Framework/MDAlgorithms/src/SliceMD.cpp +++ b/Framework/MDAlgorithms/src/SliceMD.cpp @@ -59,8 +59,6 @@ void SliceMD::init() { "If OutputFilename is specified to use a file back end:\n" " The amount of memory (in MB) to allocate to the in-memory cache.\n" " If not specified, a default of 40% of free physical memory is used."); - // setPropertySettings("Memory", new EnabledWhenProperty("OutputFilename", - // IS_NOT_DEFAULT)); declareProperty("TakeMaxRecursionDepthFromInput", true, "Copy the maximum recursion depth from the input workspace."); @@ -72,8 +70,8 @@ void SliceMD::init() { "Sets the maximum recursion depth to use. Can be used to " "constrain the workspaces internal structure"); setPropertySettings("MaxRecursionDepth", - new EnabledWhenProperty("TakeMaxRecursionDepthFromInput", - IS_EQUAL_TO, "0")); + make_unique<EnabledWhenProperty>( + "TakeMaxRecursionDepthFromInput", IS_EQUAL_TO, "0")); setPropertyGroup("OutputFilename", "File Back-End"); setPropertyGroup("Memory", "File Back-End"); diff --git a/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp b/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp index 4796a76b2695f67e6d19315e3fe3e402417e86e6..83206d6ee44470f749877cdb03934dbad84b8252 100644 --- a/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp +++ b/Framework/MDAlgorithms/src/SlicingAlgorithm.cpp @@ -56,8 +56,8 @@ void SlicingAlgorithm::initSlicingProps() { "th dimension.\n" "Enter it as a comma-separated list of values with the format: " "'name,minimum,maximum,number_of_bins'. Leave blank for NONE."); - setPropertySettings( - propName, new VisibleWhenProperty("AxisAligned", IS_EQUAL_TO, "1")); + setPropertySettings(propName, make_unique<VisibleWhenProperty>( + "AxisAligned", IS_EQUAL_TO, "1")); setPropertyGroup(propName, "Axis-Aligned Binning"); } @@ -65,8 +65,11 @@ void SlicingAlgorithm::initSlicingProps() { // --------------------------------------- std::string grpName = "Non-Aligned Binning"; - IPropertySettings *ps = - new VisibleWhenProperty("AxisAligned", IS_EQUAL_TO, "0"); + auto ps = [] { + std::unique_ptr<IPropertySettings> settings = + make_unique<VisibleWhenProperty>("AxisAligned", IS_EQUAL_TO, "0"); + return settings; + }; for (size_t i = 0; i < dimChars.size(); i++) { std::string dim(" "); dim[0] = dimChars[i]; @@ -82,7 +85,7 @@ void SlicingAlgorithm::initSlicingProps() { " x,y,z,...: vector definining the basis in the input dimensions " "space.\n" "Leave blank for NONE."); - setPropertySettings(propName, ps->clone()); + setPropertySettings(propName, ps()); setPropertyGroup(propName, grpName); } declareProperty( @@ -121,11 +124,11 @@ void SlicingAlgorithm::initSlicingProps() { setPropertyGroup("OutputBins", grpName); setPropertyGroup("NormalizeBasisVectors", grpName); setPropertyGroup("ForceOrthogonal", grpName); - setPropertySettings("Translation", ps->clone()); - setPropertySettings("OutputExtents", ps->clone()); - setPropertySettings("OutputBins", ps->clone()); - setPropertySettings("NormalizeBasisVectors", ps->clone()); - setPropertySettings("ForceOrthogonal", ps); + setPropertySettings("Translation", ps()); + setPropertySettings("OutputExtents", ps()); + setPropertySettings("OutputBins", ps()); + setPropertySettings("NormalizeBasisVectors", ps()); + setPropertySettings("ForceOrthogonal", ps()); } //---------------------------------------------------------------------------------------------- diff --git a/Framework/MDAlgorithms/src/ThresholdMD.cpp b/Framework/MDAlgorithms/src/ThresholdMD.cpp index 1bc7b6aa8b7691b0dc7a36425fa8dcdcb704519a..2ae0057b0b993cbae88a8d1c79a3d9537c56c321 100644 --- a/Framework/MDAlgorithms/src/ThresholdMD.cpp +++ b/Framework/MDAlgorithms/src/ThresholdMD.cpp @@ -75,7 +75,7 @@ void ThresholdMD::init() { "Custom overwrite value for the signal. Defaults to zero."); setPropertySettings( "CustomOverwriteValue", - new EnabledWhenProperty("OverwriteWithZero", IS_NOT_DEFAULT)); + make_unique<EnabledWhenProperty>("OverwriteWithZero", IS_NOT_DEFAULT)); declareProperty(make_unique<WorkspaceProperty<IMDHistoWorkspace>>( "OutputWorkspace", "", Direction::Output), diff --git a/Framework/PythonInterface/mantid/kernel/src/Exports/IPropertyManager.cpp b/Framework/PythonInterface/mantid/kernel/src/Exports/IPropertyManager.cpp index 25657daee4f5753669642db07347fa99d75ec812..b65006cefb5bb3a702a7687de5ad0e1a0a464c1c 100644 --- a/Framework/PythonInterface/mantid/kernel/src/Exports/IPropertyManager.cpp +++ b/Framework/PythonInterface/mantid/kernel/src/Exports/IPropertyManager.cpp @@ -82,7 +82,8 @@ void declareOrSetProperty(IPropertyManager &self, const std::string &name, */ void setPropertySettings(IPropertyManager &self, const std::string &propName, IPropertySettings *settingsManager) { - self.setPropertySettings(propName, settingsManager->clone()); + self.setPropertySettings( + propName, std::unique_ptr<IPropertySettings>(settingsManager->clone())); } void deleteProperty(IPropertyManager &self, const std::string &propName) { diff --git a/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp b/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp index b6e177a50f691e895233280f54095ef50bf35e26..d7d21f1068303ec86a46a78322789a9e90700406 100644 --- a/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp +++ b/Framework/RemoteAlgorithms/src/SCARFTomoReconstruction.cpp @@ -70,8 +70,8 @@ void SCARFTomoReconstruction::init() { declareProperty(make_unique<MaskedProperty<std::string>>("Password", "", Direction::Input), "The password for the user"); - setPropertySettings("Password", - new VisibleWhenProperty("Action", IS_EQUAL_TO, "LogIn")); + setPropertySettings("Password", make_unique<VisibleWhenProperty>( + "Action", IS_EQUAL_TO, "LogIn")); // - Action: submit declareProperty(make_unique<PropertyWithValue<std::string>>( @@ -80,7 +80,7 @@ void SCARFTomoReconstruction::init() { Direction::Input), "The path (on the remote compute resource) of a file to run " "(example: shell or python script)"); - setPropertySettings("RunnablePath", new VisibleWhenProperty( + setPropertySettings("RunnablePath", make_unique<VisibleWhenProperty>( "Action", IS_EQUAL_TO, "SubmitJob")); declareProperty( @@ -90,7 +90,7 @@ void SCARFTomoReconstruction::init() { "Options for the job command line, application dependent. It " "can include for example the NXTomo input file when using savu " "for tomographic reconstruction."); - setPropertySettings("JobOptions", new VisibleWhenProperty( + setPropertySettings("JobOptions", make_unique<VisibleWhenProperty>( "Action", IS_EQUAL_TO, "SubmitJob")); declareProperty( @@ -98,8 +98,8 @@ void SCARFTomoReconstruction::init() { "Optional name for the job, if not given then a " "name will be generated internally or at the compute resource", Direction::Input); - setPropertySettings( - "JobName", new VisibleWhenProperty("Action", IS_EQUAL_TO, "SubmitJob")); + setPropertySettings("JobName", make_unique<VisibleWhenProperty>( + "Action", IS_EQUAL_TO, "SubmitJob")); // - Action: upload file declareProperty( @@ -108,15 +108,16 @@ void SCARFTomoReconstruction::init() { Direction::Input), "Name of the file (local, full path) to upload to the compute " "resource/server "); - setPropertySettings("FileToUpload", - new VisibleWhenProperty("Action", IS_EQUAL_TO, "Upload")); + setPropertySettings("FileToUpload", make_unique<VisibleWhenProperty>( + "Action", IS_EQUAL_TO, "Upload")); declareProperty( make_unique<PropertyWithValue<std::string>>( "DestinationDirectory", "/work/imat", Direction::Input), "Path where to upload the file on the compute resource/server"); - setPropertySettings("DestinationDirectory", - new VisibleWhenProperty("Action", IS_EQUAL_TO, "Upload")); + setPropertySettings( + "DestinationDirectory", + make_unique<VisibleWhenProperty>("Action", IS_EQUAL_TO, "Upload")); // - Action: query status and info (of implicitly all jobs) declareProperty(make_unique<ArrayProperty<std::string>>("RemoteJobsID", @@ -137,8 +138,8 @@ void SCARFTomoReconstruction::init() { make_unique<PropertyWithValue<int>>("JobID", 0, Direction::Input), "The ID of a job currently running or recently run on the " "compute resource"); - setPropertySettings( - "JobID", new VisibleWhenProperty("Action", IS_EQUAL_TO, "JobStatusByID")); + setPropertySettings("JobID", make_unique<VisibleWhenProperty>( + "Action", IS_EQUAL_TO, "JobStatusByID")); declareProperty("RemoteJobName", "", nullV, "Name of the remote job", Direction::Output); @@ -154,10 +155,10 @@ void SCARFTomoReconstruction::init() { make_unique<PropertyWithValue<std::string>>("RemoteJobFilename", "", Direction::Input), "Name of the job file to download - you can give an empty name " - "to download all the files of this job."); + "to download all the files of this job."); setPropertySettings( "RemoteJobFilename", - new VisibleWhenProperty("Action", IS_EQUAL_TO, "Download")); + make_unique<VisibleWhenProperty>("Action", IS_EQUAL_TO, "Download")); declareProperty( make_unique<API::FileProperty>("LocalDirectory", "", @@ -165,21 +166,21 @@ void SCARFTomoReconstruction::init() { Direction::Input), "Path to a local directory/folder where to download files from " "the compute resource/server"); - setPropertySettings("LocalDirectory", new VisibleWhenProperty( + setPropertySettings("LocalDirectory", make_unique<VisibleWhenProperty>( "Action", IS_EQUAL_TO, "Download")); declareProperty( make_unique<PropertyWithValue<int>>("DownloadJobID", 0, Direction::Input), "ID of the job for which to download files. A job with this ID " "must be running or have been run on the compute resource."); - setPropertySettings("DownloadJobID", new VisibleWhenProperty( + setPropertySettings("DownloadJobID", make_unique<VisibleWhenProperty>( "Action", IS_EQUAL_TO, "Download")); // - Action: cancel job by ID declareProperty( make_unique<PropertyWithValue<int>>("CancelJobID", 0, Direction::Input), "The ID for a currently running job on " + m_SCARFComputeResource); - setPropertySettings("CancelJobID", new VisibleWhenProperty( + setPropertySettings("CancelJobID", make_unique<VisibleWhenProperty>( "Action", IS_EQUAL_TO, "CancelJob")); } diff --git a/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp b/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp index 520c4ceb83a3a5ef604a5a3ee7e70d2c49a8070d..8db2264b0013250a59c14613e8658efcaf140962 100644 --- a/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp +++ b/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp @@ -109,9 +109,9 @@ void AlignAndFocusPowder::init() { "Negative width values indicate logarithmic binning."); declareProperty("ResampleX", 0, "Number of bins in x-axis. Non-zero value " "overrides \"Params\" property. Negative " - "value means logorithmic binning."); - setPropertySettings("Params", - new EnabledWhenProperty("ResampleX", IS_DEFAULT)); + "value means logarithmic binning."); + setPropertySettings( + "Params", make_unique<EnabledWhenProperty>("ResampleX", IS_DEFAULT)); declareProperty("Dspacing", true, "Bin in Dspace. (True is Dspace; False is TOF)"); declareProperty(make_unique<ArrayProperty<double>>("DMin"), diff --git a/Framework/WorkflowAlgorithms/src/DgsReduction.cpp b/Framework/WorkflowAlgorithms/src/DgsReduction.cpp index 9c52623889e83b68536dadf683a682453cf74990..aa81b2291a7cb486c312c6621f0de6910108ddae 100644 --- a/Framework/WorkflowAlgorithms/src/DgsReduction.cpp +++ b/Framework/WorkflowAlgorithms/src/DgsReduction.cpp @@ -86,9 +86,9 @@ void DgsReduction::init() { "(will not be calculated)."); this->declareProperty("TimeZeroGuess", EMPTY_DBL(), "Set the value of time zero offset in microseconds."); - this->setPropertySettings( - "TimeZeroGuess", - new VisibleWhenProperty("UseIncidentEnergyGuess", IS_EQUAL_TO, "1")); + this->setPropertySettings("TimeZeroGuess", + make_unique<VisibleWhenProperty>( + "UseIncidentEnergyGuess", IS_EQUAL_TO, "1")); auto mustBePositiveInt = boost::make_shared<BoundedValidator<int>>(); mustBePositiveInt->setLower(0); this->declareProperty( @@ -150,29 +150,31 @@ void DgsReduction::init() { "Options for incident beam normalisation on data."); this->declareProperty("MonitorIntRangeLow", EMPTY_DBL(), "Set the lower bound for monitor integration."); - this->setPropertySettings("MonitorIntRangeLow", - new VisibleWhenProperty("IncidentBeamNormalisation", - IS_EQUAL_TO, "ToMonitor")); + this->setPropertySettings( + "MonitorIntRangeLow", + make_unique<VisibleWhenProperty>("IncidentBeamNormalisation", IS_EQUAL_TO, + "ToMonitor")); this->declareProperty("MonitorIntRangeHigh", EMPTY_DBL(), "Set the upper bound for monitor integration."); - this->setPropertySettings("MonitorIntRangeHigh", - new VisibleWhenProperty("IncidentBeamNormalisation", - IS_EQUAL_TO, "ToMonitor")); + this->setPropertySettings( + "MonitorIntRangeHigh", + make_unique<VisibleWhenProperty>("IncidentBeamNormalisation", IS_EQUAL_TO, + "ToMonitor")); this->declareProperty( "TimeIndepBackgroundSub", false, "If true, time-independent background will be calculated and removed."); this->declareProperty( "TibTofRangeStart", EMPTY_DBL(), "Set the lower TOF bound for time-independent background subtraction."); - this->setPropertySettings( - "TibTofRangeStart", - new VisibleWhenProperty("TimeIndepBackgroundSub", IS_EQUAL_TO, "1")); + this->setPropertySettings("TibTofRangeStart", + make_unique<VisibleWhenProperty>( + "TimeIndepBackgroundSub", IS_EQUAL_TO, "1")); this->declareProperty( "TibTofRangeEnd", EMPTY_DBL(), "Set the upper TOF bound for time-independent background subtraction."); - this->setPropertySettings( - "TibTofRangeEnd", - new VisibleWhenProperty("TimeIndepBackgroundSub", IS_EQUAL_TO, "1")); + this->setPropertySettings("TibTofRangeEnd", + make_unique<VisibleWhenProperty>( + "TimeIndepBackgroundSub", IS_EQUAL_TO, "1")); this->declareProperty("CorrectKiKf", true, "Apply the ki/kf correction."); this->declareProperty( make_unique<FileProperty>("DetectorVanadiumInputFile", "", @@ -190,9 +192,10 @@ void DgsReduction::init() { "workspace."); this->declareProperty("SaveProcessedDetVan", false, "Save the processed detector vanadium workspace"); - this->setPropertySettings("SaveProcessedDetVan", - new VisibleWhenProperty("DetectorVanadiumInputFile", - IS_NOT_EQUAL_TO, "")); + this->setPropertySettings( + "SaveProcessedDetVan", + make_unique<VisibleWhenProperty>("DetectorVanadiumInputFile", + IS_NOT_EQUAL_TO, "")); this->declareProperty( make_unique<FileProperty>("SaveProcDetVanFilename", "", FileProperty::OptionalSave, ".nxs"), @@ -209,13 +212,13 @@ void DgsReduction::init() { "Set the lower bound for integrating the detector vanadium."); this->setPropertySettings( "DetVanIntRangeLow", - new VisibleWhenProperty("UseBoundsForDetVan", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("UseBoundsForDetVan", IS_EQUAL_TO, "1")); this->declareProperty( "DetVanIntRangeHigh", EMPTY_DBL(), "Set the upper bound for integrating the detector vanadium."); this->setPropertySettings( "DetVanIntRangeHigh", - new VisibleWhenProperty("UseBoundsForDetVan", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("UseBoundsForDetVan", IS_EQUAL_TO, "1")); std::vector<std::string> detvanIntRangeUnits; detvanIntRangeUnits.emplace_back("Energy"); detvanIntRangeUnits.emplace_back("Wavelength"); @@ -226,7 +229,7 @@ void DgsReduction::init() { "Options for the units on the detector vanadium integration."); this->setPropertySettings( "DetVanIntRangeUnits", - new VisibleWhenProperty("UseBoundsForDetVan", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("UseBoundsForDetVan", IS_EQUAL_TO, "1")); // this->setPropertyGroup("FilterBadPulses", dataCorr); this->setPropertyGroup("IncidentBeamNormalisation", dataCorr); @@ -251,51 +254,54 @@ void DgsReduction::init() { std::string findBadDets = "Finding Bad Detectors"; this->declareProperty("HighCounts", EMPTY_DBL(), mustBePositive, "Mask detectors above this threshold."); - this->setPropertySettings("HighCounts", - new VisibleWhenProperty("DetectorVanadiumInputFile", - IS_NOT_EQUAL_TO, "")); + this->setPropertySettings( + "HighCounts", make_unique<VisibleWhenProperty>( + "DetectorVanadiumInputFile", IS_NOT_EQUAL_TO, "")); this->declareProperty("LowCounts", EMPTY_DBL(), mustBePositive, "Mask detectors below this threshold."); - this->setPropertySettings("LowCounts", - new VisibleWhenProperty("DetectorVanadiumInputFile", + this->setPropertySettings( + "LowCounts", make_unique<VisibleWhenProperty>("DetectorVanadiumInputFile", IS_NOT_EQUAL_TO, "")); this->declareProperty( "LowOutlier", EMPTY_DBL(), "Lower bound defining outliers as fraction of median value"); - this->setPropertySettings("LowOutlier", - new VisibleWhenProperty("DetectorVanadiumInputFile", - IS_NOT_EQUAL_TO, "")); + this->setPropertySettings( + "LowOutlier", make_unique<VisibleWhenProperty>( + "DetectorVanadiumInputFile", IS_NOT_EQUAL_TO, "")); this->declareProperty( "HighOutlier", EMPTY_DBL(), "Upper bound defining outliers as fraction of median value"); - this->setPropertySettings("HighOutlier", - new VisibleWhenProperty("DetectorVanadiumInputFile", - IS_NOT_EQUAL_TO, "")); + this->setPropertySettings( + "HighOutlier", make_unique<VisibleWhenProperty>( + "DetectorVanadiumInputFile", IS_NOT_EQUAL_TO, "")); this->declareProperty("MedianTestHigh", EMPTY_DBL(), mustBePositive, "Mask detectors above this threshold."); - this->setPropertySettings("MedianTestHigh", - new VisibleWhenProperty("DetectorVanadiumInputFile", - IS_NOT_EQUAL_TO, "")); + this->setPropertySettings( + "MedianTestHigh", make_unique<VisibleWhenProperty>( + "DetectorVanadiumInputFile", IS_NOT_EQUAL_TO, "")); this->declareProperty("MedianTestLow", EMPTY_DBL(), mustBePositive, "Mask detectors below this threshold."); - this->setPropertySettings("MedianTestLow", - new VisibleWhenProperty("DetectorVanadiumInputFile", - IS_NOT_EQUAL_TO, "")); + this->setPropertySettings( + "MedianTestLow", make_unique<VisibleWhenProperty>( + "DetectorVanadiumInputFile", IS_NOT_EQUAL_TO, "")); this->declareProperty("MedianTestLevelsUp", 0., mustBePositive, "Mask detectors below this threshold."); - this->setPropertySettings("MedianTestLevelsUp", - new VisibleWhenProperty("DetectorVanadiumInputFile", - IS_NOT_EQUAL_TO, "")); + this->setPropertySettings( + "MedianTestLevelsUp", + make_unique<VisibleWhenProperty>("DetectorVanadiumInputFile", + IS_NOT_EQUAL_TO, "")); this->declareProperty("MedianTestCorrectForSolidAngle", false, "Flag to correct for solid angle efficiency."); - this->setPropertySettings("MedianTestCorrectForSolidAngle", - new VisibleWhenProperty("DetectorVanadiumInputFile", - IS_NOT_EQUAL_TO, "")); + this->setPropertySettings( + "MedianTestCorrectForSolidAngle", + make_unique<VisibleWhenProperty>("DetectorVanadiumInputFile", + IS_NOT_EQUAL_TO, "")); this->declareProperty("ErrorBarCriterion", EMPTY_DBL(), mustBePositive, "Some selection criteria for the detector tests."); - this->setPropertySettings("ErrorBarCriterion", - new VisibleWhenProperty("DetectorVanadiumInputFile", - IS_NOT_EQUAL_TO, "")); + this->setPropertySettings( + "ErrorBarCriterion", + make_unique<VisibleWhenProperty>("DetectorVanadiumInputFile", + IS_NOT_EQUAL_TO, "")); this->declareProperty( make_unique<FileProperty>("DetectorVanadium2InputFile", "", FileProperty::OptionalLoad, "_event.nxs"), @@ -316,8 +322,8 @@ void DgsReduction::init() { "Mask detectors if the time variation is above this threshold."); this->setPropertySettings( "DetVanRatioVariation", - new VisibleWhenProperty("DetectorVanadium2InputFile", IS_NOT_EQUAL_TO, - "")); + make_unique<VisibleWhenProperty>("DetectorVanadium2InputFile", + IS_NOT_EQUAL_TO, "")); this->declareProperty( "BackgroundCheck", false, @@ -326,39 +332,39 @@ void DgsReduction::init() { "Mask detectors above this threshold."); this->setPropertySettings( "SamBkgMedianTestHigh", - new VisibleWhenProperty("BackgroundCheck", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("BackgroundCheck", IS_EQUAL_TO, "1")); this->declareProperty("SamBkgMedianTestLow", EMPTY_DBL(), mustBePositive, "Mask detectors below this threshold."); this->setPropertySettings( "SamBkgMedianTestLow", - new VisibleWhenProperty("BackgroundCheck", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("BackgroundCheck", IS_EQUAL_TO, "1")); this->declareProperty("SamBkgErrorBarCriterion", EMPTY_DBL(), mustBePositive, "Some selection criteria for the detector tests."); this->setPropertySettings( "SamBkgErrorBarCriterion", - new VisibleWhenProperty("BackgroundCheck", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("BackgroundCheck", IS_EQUAL_TO, "1")); this->declareProperty("BackgroundTofStart", EMPTY_DBL(), mustBePositive, "Start TOF for the background check."); this->setPropertySettings( "BackgroundTofStart", - new VisibleWhenProperty("BackgroundCheck", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("BackgroundCheck", IS_EQUAL_TO, "1")); this->declareProperty("BackgroundTofEnd", EMPTY_DBL(), mustBePositive, "End TOF for the background check."); this->setPropertySettings( "BackgroundTofEnd", - new VisibleWhenProperty("BackgroundCheck", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("BackgroundCheck", IS_EQUAL_TO, "1")); this->declareProperty("RejectZeroBackground", false, "If true, check the background region for anomolies."); this->declareProperty("PsdBleed", false, "If true, perform a PSD bleed test."); this->declareProperty("MaxFramerate", EMPTY_DBL(), "The maximum framerate to check."); - this->setPropertySettings( - "MaxFramerate", new VisibleWhenProperty("PsdBleed", IS_EQUAL_TO, "1")); + this->setPropertySettings("MaxFramerate", make_unique<VisibleWhenProperty>( + "PsdBleed", IS_EQUAL_TO, "1")); this->declareProperty("IgnoredPixels", EMPTY_DBL(), "A list of pixels to ignore in the calculations."); - this->setPropertySettings( - "IgnoredPixels", new VisibleWhenProperty("PsdBleed", IS_EQUAL_TO, "1")); + this->setPropertySettings("IgnoredPixels", make_unique<VisibleWhenProperty>( + "PsdBleed", IS_EQUAL_TO, "1")); this->setPropertyGroup("HighCounts", findBadDets); this->setPropertyGroup("LowCounts", findBadDets); @@ -394,7 +400,7 @@ void DgsReduction::init() { "The sample (vanadium) file used in the absolute units normalisation."); this->setPropertySettings( "AbsUnitsSampleInputFile", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty( make_unique<WorkspaceProperty<>>("AbsUnitsSampleInputWorkspace", "", Direction::Input, @@ -402,7 +408,7 @@ void DgsReduction::init() { "The sample (vanadium) workspace for absolute units normalisation."); this->setPropertySettings( "AbsUnitsSampleInputWorkspace", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty( make_unique<WorkspaceProperty<>>("AbsUnitsSampleInputMonitorWorkspace", "", Direction::Input, @@ -411,19 +417,19 @@ void DgsReduction::init() { "workspace."); this->setPropertySettings( "AbsUnitsSampleInputMonitorWorkspace", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty("AbsUnitsGroupingFile", "", "Grouping file for absolute units normalisation."); this->setPropertySettings( "AbsUnitsGroupingFile", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty( make_unique<FileProperty>("AbsUnitsDetectorVanadiumInputFile", "", FileProperty::OptionalLoad), "The detector vanadium file used in the absolute units normalisation."); this->setPropertySettings( "AbsUnitsDetectorVanadiumInputFile", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty( make_unique<WorkspaceProperty<>>("AbsUnitsDetectorVanadiumInputWorkspace", "", Direction::Input, @@ -431,7 +437,7 @@ void DgsReduction::init() { "The detector vanadium workspace for absolute units normalisation."); this->setPropertySettings( "AbsUnitsDetectorVanadiumInputWorkspace", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty( make_unique<WorkspaceProperty<>>( "AbsUnitsDetectorVanadiumInputMonitorWorkspace", "", Direction::Input, @@ -440,62 +446,62 @@ void DgsReduction::init() { "detector vanadium workspace."); this->setPropertySettings( "AbsUnitsDetectorVanadiumInputMonitorWorkspace", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty("AbsUnitsIncidentEnergy", EMPTY_DBL(), mustBePositive, "The incident energy for the vanadium sample."); this->setPropertySettings( "AbsUnitsIncidentEnergy", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty("AbsUnitsMinimumEnergy", EMPTY_DBL(), "The minimum energy for the integration range."); this->setPropertySettings( "AbsUnitsMinimumEnergy", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty("AbsUnitsMaximumEnergy", EMPTY_DBL(), "The maximum energy for the integration range."); this->setPropertySettings( "AbsUnitsMaximumEnergy", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty("VanadiumMass", EMPTY_DBL(), "The mass of vanadium."); this->setPropertySettings( "VanadiumMass", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty("SampleMass", 1.0, "The mass of sample."); this->setPropertySettings( "SampleMass", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty("SampleRmm", 1.0, "The rmm of sample."); this->setPropertySettings( "SampleRmm", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty( "AbsUnitsLowOutlier", EMPTY_DBL(), "Lower bound defining outliers as fraction of median value"); this->setPropertySettings( "AbsUnitsLowOutlier", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty( "AbsUnitsHighOutlier", EMPTY_DBL(), "Upper bound defining outliers as fraction of median value"); this->setPropertySettings( "AbsUnitsHighOutlier", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty("AbsUnitsMedianTestHigh", EMPTY_DBL(), mustBePositive, "Mask detectors above this threshold."); this->setPropertySettings( "AbsUnitsMedianTestHigh", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty("AbsUnitsMedianTestLow", EMPTY_DBL(), mustBePositive, "Mask detectors below this threshold."); this->setPropertySettings( "AbsUnitsMedianTestLow", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->declareProperty("AbsUnitsErrorBarCriterion", EMPTY_DBL(), mustBePositive, "Some selection criteria for the detector tests."); this->setPropertySettings( "AbsUnitsErrorBarCriterion", - new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); + make_unique<VisibleWhenProperty>("DoAbsoluteUnits", IS_EQUAL_TO, "1")); this->setPropertyGroup("DoAbsoluteUnits", absUnitsCorr); this->setPropertyGroup("AbsUnitsSampleInputFile", absUnitsCorr); @@ -530,22 +536,22 @@ void DgsReduction::init() { "A comma separated list of first bin boundary, width, last bin " "boundary.\n" "Negative width value indicates logarithmic binning."); - this->setPropertySettings( - "PowderMomTransferRange", - new VisibleWhenProperty("DoPowderDataConversion", IS_EQUAL_TO, "1")); + this->setPropertySettings("PowderMomTransferRange", + make_unique<VisibleWhenProperty>( + "DoPowderDataConversion", IS_EQUAL_TO, "1")); this->declareProperty( "SavePowderNexusFile", true, "Flag to use to save a processed NeXus file for powder data."); - this->setPropertySettings( - "SavePowderNexusFile", - new VisibleWhenProperty("DoPowderDataConversion", IS_EQUAL_TO, "1")); + this->setPropertySettings("SavePowderNexusFile", + make_unique<VisibleWhenProperty>( + "DoPowderDataConversion", IS_EQUAL_TO, "1")); this->declareProperty( make_unique<FileProperty>("SavePowderNexusFilename", "", FileProperty::OptionalSave, ".nxs"), "Provide a filename for saving the processed powder data."); - this->setPropertySettings( - "SavePowderNexusFilename", - new VisibleWhenProperty("DoPowderDataConversion", IS_EQUAL_TO, "1")); + this->setPropertySettings("SavePowderNexusFilename", + make_unique<VisibleWhenProperty>( + "DoPowderDataConversion", IS_EQUAL_TO, "1")); this->setPropertyGroup("DoPowderDataConversion", powder); this->setPropertyGroup("PowderMomTransferRange", powder); diff --git a/Framework/WorkflowAlgorithms/src/LoadEventAndCompress.cpp b/Framework/WorkflowAlgorithms/src/LoadEventAndCompress.cpp index 9bd28166b8eb7aa8dcceeb5f31db0d588054438c..7d2562ec561e7b8bc3c940317672eac18a9372b8 100644 --- a/Framework/WorkflowAlgorithms/src/LoadEventAndCompress.cpp +++ b/Framework/WorkflowAlgorithms/src/LoadEventAndCompress.cpp @@ -89,13 +89,16 @@ void LoadEventAndCompress::init() { setPropertySettings( "MonitorsAsEvents", - new VisibleWhenProperty("LoadMonitors", IS_EQUAL_TO, "1")); - IPropertySettings *asEventsIsOn = - new VisibleWhenProperty("MonitorsAsEvents", IS_EQUAL_TO, "1"); - setPropertySettings("FilterMonByTofMin", asEventsIsOn); - setPropertySettings("FilterMonByTofMax", asEventsIsOn->clone()); - setPropertySettings("FilterMonByTimeStart", asEventsIsOn->clone()); - setPropertySettings("FilterMonByTimeStop", asEventsIsOn->clone()); + make_unique<VisibleWhenProperty>("LoadMonitors", IS_EQUAL_TO, "1")); + auto asEventsIsOn = [] { + std::unique_ptr<IPropertySettings> settings = + make_unique<VisibleWhenProperty>("MonitorsAsEvents", IS_EQUAL_TO, "1"); + return settings; + }; + setPropertySettings("FilterMonByTofMin", asEventsIsOn()); + setPropertySettings("FilterMonByTofMax", asEventsIsOn()); + setPropertySettings("FilterMonByTimeStart", asEventsIsOn()); + setPropertySettings("FilterMonByTimeStop", asEventsIsOn()); std::string grp4 = "Monitors"; setPropertyGroup("LoadMonitors", grp4); diff --git a/Framework/WorkflowAlgorithms/src/RefReduction.cpp b/Framework/WorkflowAlgorithms/src/RefReduction.cpp index ae8e369c3e95e2c564105dffb9946ea388e61c1c..b744d5639d7b7c229c52133eea34b226e2d37c92 100644 --- a/Framework/WorkflowAlgorithms/src/RefReduction.cpp +++ b/Framework/WorkflowAlgorithms/src/RefReduction.cpp @@ -95,18 +95,18 @@ void RefReduction::init() { "polarization states in the data set"); setPropertySettings( "ReflectivityPixel", - new VisibleWhenProperty("Instrument", IS_EQUAL_TO, "REF_M")); - setPropertySettings("DetectorAngle", new VisibleWhenProperty( + make_unique<VisibleWhenProperty>("Instrument", IS_EQUAL_TO, "REF_M")); + setPropertySettings("DetectorAngle", make_unique<VisibleWhenProperty>( "Instrument", IS_EQUAL_TO, "REF_M")); setPropertySettings( "DetectorAngle0", - new VisibleWhenProperty("Instrument", IS_EQUAL_TO, "REF_M")); - setPropertySettings("DirectPixel", new VisibleWhenProperty( + make_unique<VisibleWhenProperty>("Instrument", IS_EQUAL_TO, "REF_M")); + setPropertySettings("DirectPixel", make_unique<VisibleWhenProperty>( "Instrument", IS_EQUAL_TO, "REF_M")); declareProperty("AngleOffset", EMPTY_DBL(), "Scattering angle offset in degrees"); - setPropertySettings("AngleOffset", new VisibleWhenProperty( + setPropertySettings("AngleOffset", make_unique<VisibleWhenProperty>( "Instrument", IS_EQUAL_TO, "REF_L")); std::vector<std::string> instrOptions{"REF_L", "REF_M"}; diff --git a/Framework/WorkflowAlgorithms/src/SetupEQSANSReduction.cpp b/Framework/WorkflowAlgorithms/src/SetupEQSANSReduction.cpp index 6f723ff8d56eb579dc752369b725ff9b77f5fb7f..ba1bddb8b29610df5f0661911d6df19239698594 100644 --- a/Framework/WorkflowAlgorithms/src/SetupEQSANSReduction.cpp +++ b/Framework/WorkflowAlgorithms/src/SetupEQSANSReduction.cpp @@ -104,21 +104,21 @@ void SetupEQSANSReduction::init() { "Position of the beam center, in pixel"); declareProperty("BeamCenterY", EMPTY_DBL(), "Position of the beam center, in pixel"); - setPropertySettings( - "BeamCenterX", - new VisibleWhenProperty("BeamCenterMethod", IS_EQUAL_TO, "Value")); - setPropertySettings( - "BeamCenterY", - new VisibleWhenProperty("BeamCenterMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("BeamCenterX", + make_unique<VisibleWhenProperty>("BeamCenterMethod", + IS_EQUAL_TO, "Value")); + setPropertySettings("BeamCenterY", + make_unique<VisibleWhenProperty>("BeamCenterMethod", + IS_EQUAL_TO, "Value")); // Option 2: Find it (expose properties from FindCenterOfMass) declareProperty( make_unique<API::FileProperty>( "BeamCenterFile", "", API::FileProperty::OptionalLoad, "_event.nxs"), "The name of the input event Nexus file to load"); - setPropertySettings( - "BeamCenterFile", - new VisibleWhenProperty("BeamCenterMethod", IS_NOT_EQUAL_TO, "None")); + setPropertySettings("BeamCenterFile", + make_unique<VisibleWhenProperty>( + "BeamCenterMethod", IS_NOT_EQUAL_TO, "None")); // declareProperty("Tolerance", EMPTY_DBL(), "Tolerance on the center of mass // position between each iteration [m]. Default: 0.00125"); @@ -130,9 +130,9 @@ void SetupEQSANSReduction::init() { "BeamRadius", EMPTY_DBL(), "Radius of the beam area used the exclude the beam when calculating " "the center of mass of the scattering pattern [pixels]. Default=3.0"); - setPropertySettings( - "BeamRadius", - new VisibleWhenProperty("BeamCenterMethod", IS_EQUAL_TO, "Scattering")); + setPropertySettings("BeamRadius", + make_unique<VisibleWhenProperty>( + "BeamCenterMethod", IS_EQUAL_TO, "Scattering")); // -- Define group -- setPropertyGroup("BeamCenterMethod", center_grp); @@ -210,31 +210,32 @@ void SetupEQSANSReduction::init() { declareProperty("SensitivityBeamCenterX", EMPTY_DBL(), "Sensitivity beam center location in X [pixels]"); setPropertySettings("SensitivityBeamCenterX", - new VisibleWhenProperty("SensitivityBeamCenterMethod", - IS_EQUAL_TO, "Value")); + make_unique<VisibleWhenProperty>( + "SensitivityBeamCenterMethod", IS_EQUAL_TO, "Value")); declareProperty("SensitivityBeamCenterY", EMPTY_DBL(), "Sensitivity beam center location in Y [pixels]"); setPropertySettings("SensitivityBeamCenterY", - new VisibleWhenProperty("SensitivityBeamCenterMethod", - IS_EQUAL_TO, "Value")); + make_unique<VisibleWhenProperty>( + "SensitivityBeamCenterMethod", IS_EQUAL_TO, "Value")); // Option 2: Find it (expose properties from FindCenterOfMass) declareProperty( make_unique<API::FileProperty>("SensitivityBeamCenterFile", "", API::FileProperty::OptionalLoad, ".xml"), "The name of the input data file to load"); - setPropertySettings("SensitivityBeamCenterFile", - new VisibleWhenProperty("SensitivityBeamCenterMethod", - IS_NOT_EQUAL_TO, "None")); + setPropertySettings( + "SensitivityBeamCenterFile", + make_unique<VisibleWhenProperty>("SensitivityBeamCenterMethod", + IS_NOT_EQUAL_TO, "None")); declareProperty( "SensitivityBeamCenterRadius", EMPTY_DBL(), "Radius of the beam area used the exclude the beam when calculating " "the center of mass of the scattering pattern [pixels]. Default=3.0"); - setPropertySettings( - "SensitivityBeamCenterRadius", - new VisibleWhenProperty("BeamCenterMethod", IS_EQUAL_TO, "Scattering")); + setPropertySettings("SensitivityBeamCenterRadius", + make_unique<VisibleWhenProperty>( + "BeamCenterMethod", IS_EQUAL_TO, "Scattering")); declareProperty("OutputSensitivityWorkspace", "", "Name to give the sensitivity workspace"); @@ -262,86 +263,86 @@ void SetupEQSANSReduction::init() { // - Transmission value entered by hand declareProperty("TransmissionValue", EMPTY_DBL(), positiveDouble, "Transmission value."); - setPropertySettings( - "TransmissionValue", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("TransmissionValue", + make_unique<VisibleWhenProperty>("TransmissionMethod", + IS_EQUAL_TO, "Value")); declareProperty("TransmissionError", EMPTY_DBL(), positiveDouble, "Transmission error."); - setPropertySettings( - "TransmissionError", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("TransmissionError", + make_unique<VisibleWhenProperty>("TransmissionMethod", + IS_EQUAL_TO, "Value")); // - Direct beam method transmission calculation declareProperty( "TransmissionBeamRadius", 3.0, "Radius of the beam area used to compute the transmission [pixels]"); - setPropertySettings( - "TransmissionBeamRadius", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamRadius", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("TransmissionSampleDataFile", "", API::FileProperty::OptionalLoad, ".xml"), "Sample data file for transmission calculation"); - setPropertySettings( - "TransmissionSampleDataFile", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionSampleDataFile", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("TransmissionEmptyDataFile", "", API::FileProperty::OptionalLoad, ".xml"), "Empty data file for transmission calculation"); - setPropertySettings( - "TransmissionEmptyDataFile", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionEmptyDataFile", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty("FitFramesTogether", false, "If true, the two frames will be fit together"); - setPropertySettings( - "FitFramesTogether", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("FitFramesTogether", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // - transmission beam center declareProperty("TransmissionBeamCenterMethod", "None", boost::make_shared<StringListValidator>(centerOptions), "Method for determining the transmission data beam center"); - setPropertySettings( - "TransmissionBeamCenterMethod", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamCenterMethod", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // Option 1: Set beam center by hand declareProperty("TransmissionBeamCenterX", EMPTY_DBL(), "Transmission beam center location in X [pixels]"); - setPropertySettings( - "TransmissionBeamCenterX", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamCenterX", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty("TransmissionBeamCenterY", EMPTY_DBL(), "Transmission beam center location in Y [pixels]"); - setPropertySettings( - "TransmissionBeamCenterY", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamCenterY", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // Option 2: Find it (expose properties from FindCenterOfMass) declareProperty( make_unique<API::FileProperty>("TransmissionBeamCenterFile", "", API::FileProperty::OptionalLoad, ".xml"), "The name of the input data file to load"); - setPropertySettings( - "TransmissionBeamCenterFile", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamCenterFile", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("TransmissionDarkCurrentFile", "", API::FileProperty::OptionalLoad, ".xml"), "The name of the input data file to load as transmission dark current."); - setPropertySettings( - "TransmissionDarkCurrentFile", - new VisibleWhenProperty("TransmissionMethod", IS_NOT_EQUAL_TO, "Value")); + setPropertySettings("TransmissionDarkCurrentFile", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_NOT_EQUAL_TO, "Value")); declareProperty( "TransmissionUseSampleDC", true, "If true, the sample dark current will be used IF a dark current file is" "not set."); - setPropertySettings( - "TransmissionUseSampleDC", - new VisibleWhenProperty("TransmissionMethod", IS_NOT_EQUAL_TO, "Value")); + setPropertySettings("TransmissionUseSampleDC", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_NOT_EQUAL_TO, "Value")); declareProperty( "ThetaDependentTransmission", true, @@ -374,69 +375,69 @@ void SetupEQSANSReduction::init() { // - Transmission value entered by hand declareProperty("BckTransmissionValue", EMPTY_DBL(), positiveDouble, "Transmission value."); - setPropertySettings( - "BckTransmissionValue", - new VisibleWhenProperty("BckTransmissionMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("BckTransmissionValue", + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, "Value")); declareProperty("BckTransmissionError", EMPTY_DBL(), positiveDouble, "Transmission error."); - setPropertySettings( - "BckTransmissionError", - new VisibleWhenProperty("BckTransmissionMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("BckTransmissionError", + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, "Value")); // - Direct beam method transmission calculation declareProperty( "BckTransmissionBeamRadius", 3.0, "Radius of the beam area used to compute the transmission [pixels]"); setPropertySettings("BckTransmissionBeamRadius", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("BckTransmissionSampleDataFile", "", API::FileProperty::OptionalLoad, ".xml"), "Sample data file for transmission calculation"); setPropertySettings("BckTransmissionSampleDataFile", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("BckTransmissionEmptyDataFile", "", API::FileProperty::OptionalLoad, ".xml"), "Empty data file for transmission calculation"); setPropertySettings("BckTransmissionEmptyDataFile", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty("BckFitFramesTogether", false, "If true, the two frames will be fit together"); setPropertySettings("BckFitFramesTogether", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // - transmission beam center declareProperty("BckTransmissionBeamCenterMethod", "None", boost::make_shared<StringListValidator>(centerOptions), "Method for determining the transmission data beam center"); setPropertySettings("BckTransmissionBeamCenterMethod", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // Option 1: Set beam center by hand declareProperty("BckTransmissionBeamCenterX", EMPTY_DBL(), "Transmission beam center location in X [pixels]"); setPropertySettings("BckTransmissionBeamCenterX", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty("BckTransmissionBeamCenterY", EMPTY_DBL(), "Transmission beam center location in Y [pixels]"); // Option 2: Find it (expose properties from FindCenterOfMass) setPropertySettings("BckTransmissionBeamCenterY", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("BckTransmissionBeamCenterFile", "", API::FileProperty::OptionalLoad, ".xml"), "The name of the input data file to load"); setPropertySettings("BckTransmissionBeamCenterFile", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("BckTransmissionDarkCurrentFile", "", @@ -444,8 +445,9 @@ void SetupEQSANSReduction::init() { "The name of the input data file to load as background " "transmission dark current."); setPropertySettings("BckTransmissionDarkCurrentFile", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "BeamSpreader")); + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, + "BeamSpreader")); declareProperty( "BckThetaDependentTransmission", true, @@ -494,35 +496,35 @@ void SetupEQSANSReduction::init() { boost::make_shared<StringListValidator>(scaleOptions), "Absolute scale correction method"); declareProperty("AbsoluteScalingFactor", 1.0, "Absolute scaling factor"); - setPropertySettings( - "AbsoluteScalingFactor", - new VisibleWhenProperty("AbsoluteScaleMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("AbsoluteScalingFactor", + make_unique<VisibleWhenProperty>("AbsoluteScaleMethod", + IS_EQUAL_TO, "Value")); declareProperty( make_unique<API::FileProperty>("AbsoluteScalingReferenceFilename", "", API::FileProperty::OptionalLoad, ".xml")); setPropertySettings("AbsoluteScalingReferenceFilename", - new VisibleWhenProperty("AbsoluteScaleMethod", - IS_EQUAL_TO, "ReferenceData")); + make_unique<VisibleWhenProperty>( + "AbsoluteScaleMethod", IS_EQUAL_TO, "ReferenceData")); declareProperty( "AbsoluteScalingBeamDiameter", 0.0, "Beamstop diameter for computing the absolute scale factor [mm]. " "Read from file if not supplied."); setPropertySettings("AbsoluteScalingBeamDiameter", - new VisibleWhenProperty("AbsoluteScaleMethod", - IS_EQUAL_TO, "ReferenceData")); + make_unique<VisibleWhenProperty>( + "AbsoluteScaleMethod", IS_EQUAL_TO, "ReferenceData")); declareProperty( "AbsoluteScalingAttenuatorTrans", 1.0, "Attenuator transmission value for computing the absolute scale factor"); setPropertySettings("AbsoluteScalingAttenuatorTrans", - new VisibleWhenProperty("AbsoluteScaleMethod", - IS_EQUAL_TO, "ReferenceData")); + make_unique<VisibleWhenProperty>( + "AbsoluteScaleMethod", IS_EQUAL_TO, "ReferenceData")); declareProperty("AbsoluteScalingApplySensitivity", false, "Apply sensitivity correction to the reference data " "when computing the absolute scale factor"); setPropertySettings("AbsoluteScalingApplySensitivity", - new VisibleWhenProperty("AbsoluteScaleMethod", - IS_EQUAL_TO, "ReferenceData")); + make_unique<VisibleWhenProperty>( + "AbsoluteScaleMethod", IS_EQUAL_TO, "ReferenceData")); setPropertyGroup("AbsoluteScaleMethod", abs_scale_grp); setPropertyGroup("AbsoluteScalingFactor", abs_scale_grp); diff --git a/Framework/WorkflowAlgorithms/src/SetupHFIRReduction.cpp b/Framework/WorkflowAlgorithms/src/SetupHFIRReduction.cpp index 81ebdb89951cd8f29fc131ccdd74fdebf8689c4f..6a1adc86d412ff96961b3a8196f51181f12324cf 100644 --- a/Framework/WorkflowAlgorithms/src/SetupHFIRReduction.cpp +++ b/Framework/WorkflowAlgorithms/src/SetupHFIRReduction.cpp @@ -73,21 +73,21 @@ void SetupHFIRReduction::init() { "Position of the beam center, in pixel"); declareProperty("BeamCenterY", EMPTY_DBL(), "Position of the beam center, in pixel"); - setPropertySettings( - "BeamCenterX", - new VisibleWhenProperty("BeamCenterMethod", IS_EQUAL_TO, "Value")); - setPropertySettings( - "BeamCenterY", - new VisibleWhenProperty("BeamCenterMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("BeamCenterX", + make_unique<VisibleWhenProperty>("BeamCenterMethod", + IS_EQUAL_TO, "Value")); + setPropertySettings("BeamCenterY", + make_unique<VisibleWhenProperty>("BeamCenterMethod", + IS_EQUAL_TO, "Value")); // Option 2: Find it (expose properties from FindCenterOfMass) declareProperty( make_unique<API::FileProperty>("BeamCenterFile", "", API::FileProperty::OptionalLoad, ".xml"), "The name of the input data file to load"); - setPropertySettings( - "BeamCenterFile", - new VisibleWhenProperty("BeamCenterMethod", IS_NOT_EQUAL_TO, "None")); + setPropertySettings("BeamCenterFile", + make_unique<VisibleWhenProperty>( + "BeamCenterMethod", IS_NOT_EQUAL_TO, "None")); // declareProperty("Tolerance", EMPTY_DBL(), "Tolerance on the center of mass // position between each iteration [m]. Default: 0.00125"); @@ -97,9 +97,9 @@ void SetupHFIRReduction::init() { "BeamRadius", EMPTY_DBL(), "Radius of the beam area used the exclude the beam when calculating " "the center of mass of the scattering pattern [pixels]. Default=3.0"); - setPropertySettings( - "BeamRadius", - new VisibleWhenProperty("BeamCenterMethod", IS_EQUAL_TO, "Scattering")); + setPropertySettings("BeamRadius", + make_unique<VisibleWhenProperty>( + "BeamCenterMethod", IS_EQUAL_TO, "Scattering")); setPropertyGroup("BeamCenterMethod", center_grp); setPropertyGroup("BeamCenterX", center_grp); @@ -145,7 +145,7 @@ void SetupHFIRReduction::init() { "The name of the input file to load as dark current."); setPropertySettings( "SensitivityDarkCurrentFile", - new VisibleWhenProperty("UseDefaultDC", IS_EQUAL_TO, "0")); + make_unique<VisibleWhenProperty>("UseDefaultDC", IS_EQUAL_TO, "0")); // - sensitivity beam center declareProperty("SensitivityBeamCenterMethod", "None", @@ -156,31 +156,32 @@ void SetupHFIRReduction::init() { declareProperty("SensitivityBeamCenterX", EMPTY_DBL(), "Sensitivity beam center location in X [pixels]"); setPropertySettings("SensitivityBeamCenterX", - new VisibleWhenProperty("SensitivityBeamCenterMethod", - IS_EQUAL_TO, "Value")); + make_unique<VisibleWhenProperty>( + "SensitivityBeamCenterMethod", IS_EQUAL_TO, "Value")); declareProperty("SensitivityBeamCenterY", EMPTY_DBL(), "Sensitivity beam center location in Y [pixels]"); setPropertySettings("SensitivityBeamCenterY", - new VisibleWhenProperty("SensitivityBeamCenterMethod", - IS_EQUAL_TO, "Value")); + make_unique<VisibleWhenProperty>( + "SensitivityBeamCenterMethod", IS_EQUAL_TO, "Value")); // Option 2: Find it (expose properties from FindCenterOfMass) declareProperty( make_unique<API::FileProperty>("SensitivityBeamCenterFile", "", API::FileProperty::OptionalLoad, ".xml"), "The name of the input data file to load"); - setPropertySettings("SensitivityBeamCenterFile", - new VisibleWhenProperty("SensitivityBeamCenterMethod", - IS_NOT_EQUAL_TO, "None")); + setPropertySettings( + "SensitivityBeamCenterFile", + make_unique<VisibleWhenProperty>("SensitivityBeamCenterMethod", + IS_NOT_EQUAL_TO, "None")); declareProperty( "SensitivityBeamCenterRadius", EMPTY_DBL(), "Radius of the beam area used the exclude the beam when calculating " "the center of mass of the scattering pattern [pixels]. Default=3.0"); - setPropertySettings( - "SensitivityBeamCenterRadius", - new VisibleWhenProperty("BeamCenterMethod", IS_EQUAL_TO, "Scattering")); + setPropertySettings("SensitivityBeamCenterRadius", + make_unique<VisibleWhenProperty>( + "BeamCenterMethod", IS_EQUAL_TO, "Scattering")); declareProperty(make_unique<WorkspaceProperty<MatrixWorkspace>>( "OutputSensitivityWorkspace", "", Direction::Output, @@ -211,117 +212,117 @@ void SetupHFIRReduction::init() { // - Transmission value entered by hand declareProperty("TransmissionValue", EMPTY_DBL(), positiveDouble, "Transmission value."); - setPropertySettings( - "TransmissionValue", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("TransmissionValue", + make_unique<VisibleWhenProperty>("TransmissionMethod", + IS_EQUAL_TO, "Value")); declareProperty("TransmissionError", EMPTY_DBL(), positiveDouble, "Transmission error."); - setPropertySettings( - "TransmissionError", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("TransmissionError", + make_unique<VisibleWhenProperty>("TransmissionMethod", + IS_EQUAL_TO, "Value")); // - Direct beam method transmission calculation declareProperty( "TransmissionBeamRadius", 3.0, "Radius of the beam area used to compute the transmission [pixels]"); - setPropertySettings( - "TransmissionBeamRadius", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamRadius", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("TransmissionSampleDataFile", "", API::FileProperty::OptionalLoad, ".xml"), "Sample data file for transmission calculation"); - setPropertySettings( - "TransmissionSampleDataFile", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionSampleDataFile", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("TransmissionEmptyDataFile", "", API::FileProperty::OptionalLoad, ".xml"), "Empty data file for transmission calculation"); - setPropertySettings( - "TransmissionEmptyDataFile", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionEmptyDataFile", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // - transmission beam center declareProperty("TransmissionBeamCenterMethod", "None", boost::make_shared<StringListValidator>(centerOptions), "Method for determining the transmission data beam center"); - setPropertySettings( - "TransmissionBeamCenterMethod", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamCenterMethod", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // Option 1: Set beam center by hand declareProperty("TransmissionBeamCenterX", EMPTY_DBL(), "Transmission beam center location in X [pixels]"); - setPropertySettings( - "TransmissionBeamCenterX", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamCenterX", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty("TransmissionBeamCenterY", EMPTY_DBL(), "Transmission beam center location in Y [pixels]"); - setPropertySettings( - "TransmissionBeamCenterY", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamCenterY", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // Option 2: Find it (expose properties from FindCenterOfMass) declareProperty( make_unique<API::FileProperty>("TransmissionBeamCenterFile", "", API::FileProperty::OptionalLoad, ".xml"), "The name of the input data file to load"); - setPropertySettings( - "TransmissionBeamCenterFile", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamCenterFile", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // - Beam spreader transmission method declareProperty( make_unique<API::FileProperty>("TransSampleSpreaderFilename", "", API::FileProperty::OptionalLoad, ".xml")); setPropertySettings("TransSampleSpreaderFilename", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, - "BeamSpreader")); + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "BeamSpreader")); declareProperty( make_unique<API::FileProperty>("TransDirectSpreaderFilename", "", API::FileProperty::OptionalLoad, ".xml")); setPropertySettings("TransDirectSpreaderFilename", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, - "BeamSpreader")); + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "BeamSpreader")); declareProperty( make_unique<API::FileProperty>("TransSampleScatteringFilename", "", API::FileProperty::OptionalLoad, ".xml")); setPropertySettings("TransSampleScatteringFilename", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, - "BeamSpreader")); + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "BeamSpreader")); declareProperty( make_unique<API::FileProperty>("TransDirectScatteringFilename", "", API::FileProperty::OptionalLoad, ".xml")); setPropertySettings("TransDirectScatteringFilename", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, - "BeamSpreader")); + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "BeamSpreader")); declareProperty("SpreaderTransmissionValue", 1.0, "Beam spreader transmission value"); setPropertySettings("SpreaderTransmissionValue", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, - "BeamSpreader")); + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "BeamSpreader")); declareProperty("SpreaderTransmissionError", 0.0, "Beam spreader transmission error"); setPropertySettings("SpreaderTransmissionError", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, - "BeamSpreader")); + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "BeamSpreader")); declareProperty( make_unique<API::FileProperty>("TransmissionDarkCurrentFile", "", API::FileProperty::OptionalLoad, ".xml"), "The name of the input data file to load as transmission dark current."); - setPropertySettings( - "TransmissionDarkCurrentFile", - new VisibleWhenProperty("TransmissionMethod", IS_NOT_EQUAL_TO, "Value")); + setPropertySettings("TransmissionDarkCurrentFile", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_NOT_EQUAL_TO, "Value")); declareProperty( "TransmissionUseSampleDC", true, "If true, the sample dark current will be used IF a dark current file is" "not set."); - setPropertySettings( - "TransmissionUseSampleDC", - new VisibleWhenProperty("TransmissionMethod", IS_NOT_EQUAL_TO, "Value")); + setPropertySettings("TransmissionUseSampleDC", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_NOT_EQUAL_TO, "Value")); declareProperty( "ThetaDependentTransmission", true, @@ -358,100 +359,106 @@ void SetupHFIRReduction::init() { // - Transmission value entered by hand declareProperty("BckTransmissionValue", EMPTY_DBL(), positiveDouble, "Transmission value."); - setPropertySettings( - "BckTransmissionValue", - new VisibleWhenProperty("BckTransmissionMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("BckTransmissionValue", + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, "Value")); declareProperty("BckTransmissionError", EMPTY_DBL(), positiveDouble, "Transmission error."); - setPropertySettings( - "BckTransmissionError", - new VisibleWhenProperty("BckTransmissionMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("BckTransmissionError", + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, "Value")); // - Direct beam method transmission calculation declareProperty( "BckTransmissionBeamRadius", 3.0, "Radius of the beam area used to compute the transmission [pixels]"); setPropertySettings("BckTransmissionBeamRadius", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("BckTransmissionSampleDataFile", "", API::FileProperty::OptionalLoad, ".xml"), "Sample data file for transmission calculation"); setPropertySettings("BckTransmissionSampleDataFile", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("BckTransmissionEmptyDataFile", "", API::FileProperty::OptionalLoad, ".xml"), "Empty data file for transmission calculation"); setPropertySettings("BckTransmissionEmptyDataFile", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // - transmission beam center declareProperty("BckTransmissionBeamCenterMethod", "None", boost::make_shared<StringListValidator>(centerOptions), "Method for determining the transmission data beam center"); setPropertySettings("BckTransmissionBeamCenterMethod", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // Option 1: Set beam center by hand declareProperty("BckTransmissionBeamCenterX", EMPTY_DBL(), "Transmission beam center location in X [pixels]"); setPropertySettings("BckTransmissionBeamCenterX", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty("BckTransmissionBeamCenterY", EMPTY_DBL(), "Transmission beam center location in Y [pixels]"); // Option 2: Find it (expose properties from FindCenterOfMass) setPropertySettings("BckTransmissionBeamCenterY", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("BckTransmissionBeamCenterFile", "", API::FileProperty::OptionalLoad, ".xml"), "The name of the input data file to load"); setPropertySettings("BckTransmissionBeamCenterFile", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // - Beam spreader transmission method declareProperty( make_unique<API::FileProperty>("BckTransSampleSpreaderFilename", "", API::FileProperty::OptionalLoad, ".xml")); setPropertySettings("BckTransSampleSpreaderFilename", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "BeamSpreader")); + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, + "BeamSpreader")); declareProperty( make_unique<API::FileProperty>("BckTransDirectSpreaderFilename", "", API::FileProperty::OptionalLoad, ".xml")); setPropertySettings("BckTransDirectSpreaderFilename", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "BeamSpreader")); + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, + "BeamSpreader")); declareProperty( make_unique<API::FileProperty>("BckTransSampleScatteringFilename", "", API::FileProperty::OptionalLoad, ".xml")); setPropertySettings("BckTransSampleScatteringFilename", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "BeamSpreader")); + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, + "BeamSpreader")); declareProperty( make_unique<API::FileProperty>("BckTransDirectScatteringFilename", "", API::FileProperty::OptionalLoad, ".xml")); setPropertySettings("BckTransDirectScatteringFilename", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "BeamSpreader")); + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, + "BeamSpreader")); declareProperty("BckSpreaderTransmissionValue", 1.0, "Beam spreader transmission value"); setPropertySettings("BckSpreaderTransmissionValue", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "BeamSpreader")); + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, + "BeamSpreader")); declareProperty("BckSpreaderTransmissionError", 0.0, "Beam spreader transmission error"); setPropertySettings("BckSpreaderTransmissionError", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "BeamSpreader")); + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, + "BeamSpreader")); declareProperty( make_unique<API::FileProperty>("BckTransmissionDarkCurrentFile", "", @@ -459,8 +466,9 @@ void SetupHFIRReduction::init() { "The name of the input data file to load as background " "transmission dark current."); setPropertySettings("BckTransmissionDarkCurrentFile", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "BeamSpreader")); + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, + "BeamSpreader")); declareProperty( "BckThetaDependentTransmission", true, @@ -518,35 +526,35 @@ void SetupHFIRReduction::init() { boost::make_shared<StringListValidator>(scaleOptions), "Absolute scale correction method"); declareProperty("AbsoluteScalingFactor", 1.0, "Absolute scaling factor"); - setPropertySettings( - "AbsoluteScalingFactor", - new VisibleWhenProperty("AbsoluteScaleMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("AbsoluteScalingFactor", + make_unique<VisibleWhenProperty>("AbsoluteScaleMethod", + IS_EQUAL_TO, "Value")); declareProperty( make_unique<API::FileProperty>("AbsoluteScalingReferenceFilename", "", API::FileProperty::OptionalLoad, ".xml")); setPropertySettings("AbsoluteScalingReferenceFilename", - new VisibleWhenProperty("AbsoluteScaleMethod", - IS_EQUAL_TO, "ReferenceData")); + make_unique<VisibleWhenProperty>( + "AbsoluteScaleMethod", IS_EQUAL_TO, "ReferenceData")); declareProperty( "AbsoluteScalingBeamDiameter", 0.0, "Beamstop diameter for computing the absolute scale factor [mm]. " "Read from file if not supplied."); setPropertySettings("AbsoluteScalingBeamDiameter", - new VisibleWhenProperty("AbsoluteScaleMethod", - IS_EQUAL_TO, "ReferenceData")); + make_unique<VisibleWhenProperty>( + "AbsoluteScaleMethod", IS_EQUAL_TO, "ReferenceData")); declareProperty( "AbsoluteScalingAttenuatorTrans", 1.0, "Attenuator transmission value for computing the absolute scale factor"); setPropertySettings("AbsoluteScalingAttenuatorTrans", - new VisibleWhenProperty("AbsoluteScaleMethod", - IS_EQUAL_TO, "ReferenceData")); + make_unique<VisibleWhenProperty>( + "AbsoluteScaleMethod", IS_EQUAL_TO, "ReferenceData")); declareProperty("AbsoluteScalingApplySensitivity", false, "Apply sensitivity correction to the reference data " "when computing the absolute scale factor"); setPropertySettings("AbsoluteScalingApplySensitivity", - new VisibleWhenProperty("AbsoluteScaleMethod", - IS_EQUAL_TO, "ReferenceData")); + make_unique<VisibleWhenProperty>( + "AbsoluteScaleMethod", IS_EQUAL_TO, "ReferenceData")); setPropertyGroup("AbsoluteScaleMethod", abs_scale_grp); setPropertyGroup("AbsoluteScalingFactor", abs_scale_grp); diff --git a/Framework/WorkflowAlgorithms/src/SetupILLD33Reduction.cpp b/Framework/WorkflowAlgorithms/src/SetupILLD33Reduction.cpp index a173777460df08a7eb47f8d53867ace235b0faf6..ff87da0fdf6227c61d95a133b5e81b97fac2e602 100644 --- a/Framework/WorkflowAlgorithms/src/SetupILLD33Reduction.cpp +++ b/Framework/WorkflowAlgorithms/src/SetupILLD33Reduction.cpp @@ -53,21 +53,21 @@ void SetupILLD33Reduction::init() { "Position of the beam center, in pixel"); declareProperty("BeamCenterY", EMPTY_DBL(), "Position of the beam center, in pixel"); - setPropertySettings( - "BeamCenterX", - new VisibleWhenProperty("BeamCenterMethod", IS_EQUAL_TO, "Value")); - setPropertySettings( - "BeamCenterY", - new VisibleWhenProperty("BeamCenterMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("BeamCenterX", + make_unique<VisibleWhenProperty>("BeamCenterMethod", + IS_EQUAL_TO, "Value")); + setPropertySettings("BeamCenterY", + make_unique<VisibleWhenProperty>("BeamCenterMethod", + IS_EQUAL_TO, "Value")); // Option 2: Find it (expose properties from FindCenterOfMass) declareProperty( make_unique<API::FileProperty>( "BeamCenterFile", "", API::FileProperty::OptionalLoad, "_event.nxs"), "The name of the input event Nexus file to load"); - setPropertySettings( - "BeamCenterFile", - new VisibleWhenProperty("BeamCenterMethod", IS_NOT_EQUAL_TO, "None")); + setPropertySettings("BeamCenterFile", + make_unique<VisibleWhenProperty>( + "BeamCenterMethod", IS_NOT_EQUAL_TO, "None")); auto positiveDouble = boost::make_shared<BoundedValidator<double>>(); positiveDouble->setLower(0); @@ -75,9 +75,9 @@ void SetupILLD33Reduction::init() { "BeamRadius", EMPTY_DBL(), "Radius of the beam area used the exclude the beam when calculating " "the center of mass of the scattering pattern [pixels]. Default=3.0"); - setPropertySettings( - "BeamRadius", - new VisibleWhenProperty("BeamCenterMethod", IS_EQUAL_TO, "Scattering")); + setPropertySettings("BeamRadius", + make_unique<VisibleWhenProperty>( + "BeamCenterMethod", IS_EQUAL_TO, "Scattering")); // -- Define group -- setPropertyGroup("BeamCenterMethod", center_grp); @@ -135,31 +135,32 @@ void SetupILLD33Reduction::init() { declareProperty("SensitivityBeamCenterX", EMPTY_DBL(), "Sensitivity beam center location in X [pixels]"); setPropertySettings("SensitivityBeamCenterX", - new VisibleWhenProperty("SensitivityBeamCenterMethod", - IS_EQUAL_TO, "Value")); + make_unique<VisibleWhenProperty>( + "SensitivityBeamCenterMethod", IS_EQUAL_TO, "Value")); declareProperty("SensitivityBeamCenterY", EMPTY_DBL(), "Sensitivity beam center location in Y [pixels]"); setPropertySettings("SensitivityBeamCenterY", - new VisibleWhenProperty("SensitivityBeamCenterMethod", - IS_EQUAL_TO, "Value")); + make_unique<VisibleWhenProperty>( + "SensitivityBeamCenterMethod", IS_EQUAL_TO, "Value")); // Option 2: Find it (expose properties from FindCenterOfMass) declareProperty( make_unique<API::FileProperty>("SensitivityBeamCenterFile", "", API::FileProperty::OptionalLoad, ".xml"), "The name of the input data file to load"); - setPropertySettings("SensitivityBeamCenterFile", - new VisibleWhenProperty("SensitivityBeamCenterMethod", - IS_NOT_EQUAL_TO, "None")); + setPropertySettings( + "SensitivityBeamCenterFile", + make_unique<VisibleWhenProperty>("SensitivityBeamCenterMethod", + IS_NOT_EQUAL_TO, "None")); declareProperty( "SensitivityBeamCenterRadius", EMPTY_DBL(), "Radius of the beam area used the exclude the beam when calculating " "the center of mass of the scattering pattern [pixels]. Default=3.0"); - setPropertySettings( - "SensitivityBeamCenterRadius", - new VisibleWhenProperty("BeamCenterMethod", IS_EQUAL_TO, "Scattering")); + setPropertySettings("SensitivityBeamCenterRadius", + make_unique<VisibleWhenProperty>( + "BeamCenterMethod", IS_EQUAL_TO, "Scattering")); declareProperty("OutputSensitivityWorkspace", "", "Name to give the sensitivity workspace"); @@ -187,81 +188,81 @@ void SetupILLD33Reduction::init() { // - Transmission value entered by hand declareProperty("TransmissionValue", EMPTY_DBL(), positiveDouble, "Transmission value."); - setPropertySettings( - "TransmissionValue", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("TransmissionValue", + make_unique<VisibleWhenProperty>("TransmissionMethod", + IS_EQUAL_TO, "Value")); declareProperty("TransmissionError", EMPTY_DBL(), positiveDouble, "Transmission error."); - setPropertySettings( - "TransmissionError", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("TransmissionError", + make_unique<VisibleWhenProperty>("TransmissionMethod", + IS_EQUAL_TO, "Value")); // - Direct beam method transmission calculation declareProperty( "TransmissionBeamRadius", 3.0, "Radius of the beam area used to compute the transmission [pixels]"); - setPropertySettings( - "TransmissionBeamRadius", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamRadius", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("TransmissionSampleDataFile", "", API::FileProperty::OptionalLoad, ".xml"), "Sample data file for transmission calculation"); - setPropertySettings( - "TransmissionSampleDataFile", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionSampleDataFile", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("TransmissionEmptyDataFile", "", API::FileProperty::OptionalLoad, ".xml"), "Empty data file for transmission calculation"); - setPropertySettings( - "TransmissionEmptyDataFile", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionEmptyDataFile", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // - transmission beam center declareProperty("TransmissionBeamCenterMethod", "None", boost::make_shared<StringListValidator>(centerOptions), "Method for determining the transmission data beam center"); - setPropertySettings( - "TransmissionBeamCenterMethod", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamCenterMethod", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // Option 1: Set beam center by hand declareProperty("TransmissionBeamCenterX", EMPTY_DBL(), "Transmission beam center location in X [pixels]"); - setPropertySettings( - "TransmissionBeamCenterX", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamCenterX", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty("TransmissionBeamCenterY", EMPTY_DBL(), "Transmission beam center location in Y [pixels]"); - setPropertySettings( - "TransmissionBeamCenterY", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamCenterY", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // Option 2: Find it (expose properties from FindCenterOfMass) declareProperty( make_unique<API::FileProperty>("TransmissionBeamCenterFile", "", API::FileProperty::OptionalLoad, ".xml"), "The name of the input data file to load"); - setPropertySettings( - "TransmissionBeamCenterFile", - new VisibleWhenProperty("TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); + setPropertySettings("TransmissionBeamCenterFile", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("TransmissionDarkCurrentFile", "", API::FileProperty::OptionalLoad, ".xml"), "The name of the input data file to load as transmission dark current."); - setPropertySettings( - "TransmissionDarkCurrentFile", - new VisibleWhenProperty("TransmissionMethod", IS_NOT_EQUAL_TO, "Value")); + setPropertySettings("TransmissionDarkCurrentFile", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_NOT_EQUAL_TO, "Value")); declareProperty( "TransmissionUseSampleDC", true, "If true, the sample dark current will be used IF a dark current file is" "not set."); - setPropertySettings( - "TransmissionUseSampleDC", - new VisibleWhenProperty("TransmissionMethod", IS_NOT_EQUAL_TO, "Value")); + setPropertySettings("TransmissionUseSampleDC", + make_unique<VisibleWhenProperty>( + "TransmissionMethod", IS_NOT_EQUAL_TO, "Value")); declareProperty( "ThetaDependentTransmission", true, @@ -293,64 +294,64 @@ void SetupILLD33Reduction::init() { // - Transmission value entered by hand declareProperty("BckTransmissionValue", EMPTY_DBL(), positiveDouble, "Transmission value."); - setPropertySettings( - "BckTransmissionValue", - new VisibleWhenProperty("BckTransmissionMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("BckTransmissionValue", + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, "Value")); declareProperty("BckTransmissionError", EMPTY_DBL(), positiveDouble, "Transmission error."); - setPropertySettings( - "BckTransmissionError", - new VisibleWhenProperty("BckTransmissionMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("BckTransmissionError", + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, "Value")); // - Direct beam method transmission calculation declareProperty( "BckTransmissionBeamRadius", 3.0, "Radius of the beam area used to compute the transmission [pixels]"); setPropertySettings("BckTransmissionBeamRadius", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("BckTransmissionSampleDataFile", "", API::FileProperty::OptionalLoad, ".xml"), "Sample data file for transmission calculation"); setPropertySettings("BckTransmissionSampleDataFile", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("BckTransmissionEmptyDataFile", "", API::FileProperty::OptionalLoad, ".xml"), "Empty data file for transmission calculation"); setPropertySettings("BckTransmissionEmptyDataFile", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // - transmission beam center declareProperty("BckTransmissionBeamCenterMethod", "None", boost::make_shared<StringListValidator>(centerOptions), "Method for determining the transmission data beam center"); setPropertySettings("BckTransmissionBeamCenterMethod", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); // Option 1: Set beam center by hand declareProperty("BckTransmissionBeamCenterX", EMPTY_DBL(), "Transmission beam center location in X [pixels]"); setPropertySettings("BckTransmissionBeamCenterX", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty("BckTransmissionBeamCenterY", EMPTY_DBL(), "Transmission beam center location in Y [pixels]"); // Option 2: Find it (expose properties from FindCenterOfMass) setPropertySettings("BckTransmissionBeamCenterY", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("BckTransmissionBeamCenterFile", "", API::FileProperty::OptionalLoad, ".xml"), "The name of the input data file to load"); setPropertySettings("BckTransmissionBeamCenterFile", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "DirectBeam")); + make_unique<VisibleWhenProperty>( + "BckTransmissionMethod", IS_EQUAL_TO, "DirectBeam")); declareProperty( make_unique<API::FileProperty>("BckTransmissionDarkCurrentFile", "", @@ -358,8 +359,9 @@ void SetupILLD33Reduction::init() { "The name of the input data file to load as background " "transmission dark current."); setPropertySettings("BckTransmissionDarkCurrentFile", - new VisibleWhenProperty("BckTransmissionMethod", - IS_EQUAL_TO, "BeamSpreader")); + make_unique<VisibleWhenProperty>("BckTransmissionMethod", + IS_EQUAL_TO, + "BeamSpreader")); declareProperty( "BckThetaDependentTransmission", true, @@ -408,35 +410,35 @@ void SetupILLD33Reduction::init() { boost::make_shared<StringListValidator>(scaleOptions), "Absolute scale correction method"); declareProperty("AbsoluteScalingFactor", 1.0, "Absolute scaling factor"); - setPropertySettings( - "AbsoluteScalingFactor", - new VisibleWhenProperty("AbsoluteScaleMethod", IS_EQUAL_TO, "Value")); + setPropertySettings("AbsoluteScalingFactor", + make_unique<VisibleWhenProperty>("AbsoluteScaleMethod", + IS_EQUAL_TO, "Value")); declareProperty( make_unique<API::FileProperty>("AbsoluteScalingReferenceFilename", "", API::FileProperty::OptionalLoad, ".xml")); setPropertySettings("AbsoluteScalingReferenceFilename", - new VisibleWhenProperty("AbsoluteScaleMethod", - IS_EQUAL_TO, "ReferenceData")); + make_unique<VisibleWhenProperty>( + "AbsoluteScaleMethod", IS_EQUAL_TO, "ReferenceData")); declareProperty( "AbsoluteScalingBeamDiameter", 0.0, "Beamstop diameter for computing the absolute scale factor [mm]. " "Read from file if not supplied."); setPropertySettings("AbsoluteScalingBeamDiameter", - new VisibleWhenProperty("AbsoluteScaleMethod", - IS_EQUAL_TO, "ReferenceData")); + make_unique<VisibleWhenProperty>( + "AbsoluteScaleMethod", IS_EQUAL_TO, "ReferenceData")); declareProperty( "AbsoluteScalingAttenuatorTrans", 1.0, "Attenuator transmission value for computing the absolute scale factor"); setPropertySettings("AbsoluteScalingAttenuatorTrans", - new VisibleWhenProperty("AbsoluteScaleMethod", - IS_EQUAL_TO, "ReferenceData")); + make_unique<VisibleWhenProperty>( + "AbsoluteScaleMethod", IS_EQUAL_TO, "ReferenceData")); declareProperty("AbsoluteScalingApplySensitivity", false, "Apply sensitivity correction to the reference data " "when computing the absolute scale factor"); setPropertySettings("AbsoluteScalingApplySensitivity", - new VisibleWhenProperty("AbsoluteScaleMethod", - IS_EQUAL_TO, "ReferenceData")); + make_unique<VisibleWhenProperty>( + "AbsoluteScaleMethod", IS_EQUAL_TO, "ReferenceData")); setPropertyGroup("AbsoluteScaleMethod", abs_scale_grp); setPropertyGroup("AbsoluteScalingFactor", abs_scale_grp); diff --git a/Vates/VatesAPI/src/LoadVTK.cpp b/Vates/VatesAPI/src/LoadVTK.cpp index 243aa3437e6f185addf3e2c94aba7daaf9c21b11..69be52cf9b8e933b51facb99337611e5d8d5ee94 100644 --- a/Vates/VatesAPI/src/LoadVTK.cpp +++ b/Vates/VatesAPI/src/LoadVTK.cpp @@ -132,8 +132,8 @@ namespace Mantid auto rangeValidator = boost::make_shared<BoundedValidator<double> >(0, 100); this->declareProperty("KeepTopPercent", 25.0, rangeValidator, "Only keep the top percentage of SignalArray values in the range min to max. Allow sparse regions to be ignored. Defaults to 25%."); - setPropertySettings("KeepTopPercent", - new EnabledWhenProperty("AdaptiveBinned", IS_DEFAULT)); + setPropertySettings("KeepTopPercent", make_unique<EnabledWhenProperty>( + "AdaptiveBinned", IS_DEFAULT)); declareProperty(Kernel::make_unique<WorkspaceProperty<IMDWorkspace>>( "OutputWorkspace", "", Direction::Output),