Commit bbe2339d authored by Tom Perkins's avatar Tom Perkins
Browse files

Change declareProperty calls in Algorithms to use unique_ptrs

re #15289
parent f0207027
......@@ -38,12 +38,12 @@ void AbsorptionCorrection::init() {
wsValidator->add<InstrumentValidator>();
declareProperty(
new WorkspaceProperty<>("InputWorkspace", "", Direction::Input,
wsValidator),
make_unique<WorkspaceProperty<>>("InputWorkspace", "", Direction::Input,
wsValidator),
"The X values for the input workspace must be in units of wavelength");
declareProperty(
new WorkspaceProperty<>("OutputWorkspace", "", Direction::Output),
"Output workspace name");
declareProperty(make_unique<WorkspaceProperty<>>("OutputWorkspace", "",
Direction::Output),
"Output workspace name");
auto mustBePositive = boost::make_shared<BoundedValidator<double>>();
mustBePositive->setLower(0.0);
......
......@@ -32,7 +32,7 @@ AddLogDerivative::~AddLogDerivative() {}
*/
void AddLogDerivative::init() {
declareProperty(
new WorkspaceProperty<>("InputWorkspace", "", Direction::InOut),
make_unique<WorkspaceProperty<>>("InputWorkspace", "", Direction::InOut),
"An input/output workspace. The new log will be added to it.");
declareProperty(
"LogName", "", boost::make_shared<MandatoryValidator<std::string>>(),
......
......@@ -66,9 +66,9 @@ const std::string AddNote::summary() const {
/** Initialize the algorithm's properties.
*/
void AddNote::init() {
declareProperty(
new WorkspaceProperty<MatrixWorkspace>("Workspace", "", Direction::InOut),
"An InOut workspace that will store the new log information");
declareProperty(make_unique<WorkspaceProperty<MatrixWorkspace>>(
"Workspace", "", Direction::InOut),
"An InOut workspace that will store the new log information");
declareProperty("Name", "",
boost::make_shared<MandatoryValidator<std::string>>(),
......
......@@ -34,11 +34,11 @@ AddPeak::~AddPeak() {}
/** Initialize the algorithm's properties.
*/
void AddPeak::init() {
declareProperty(new WorkspaceProperty<IPeaksWorkspace>("PeaksWorkspace", "",
Direction::InOut),
declareProperty(make_unique<WorkspaceProperty<IPeaksWorkspace>>(
"PeaksWorkspace", "", Direction::InOut),
"A peaks workspace.");
declareProperty(new WorkspaceProperty<MatrixWorkspace>("RunWorkspace", "",
Direction::Input),
declareProperty(make_unique<WorkspaceProperty<MatrixWorkspace>>(
"RunWorkspace", "", Direction::Input),
"An input workspace containing the run information.");
declareProperty("TOF", 0.0, "Peak position in time of flight.");
declareProperty("DetectorID", 0, "ID of a detector at the peak centre.");
......
......@@ -34,9 +34,9 @@ using namespace Kernel;
using namespace API;
void AddSampleLog::init() {
declareProperty(
new WorkspaceProperty<Workspace>("Workspace", "", Direction::InOut),
"Workspace to add the log entry to");
declareProperty(Kernel::make_unique<WorkspaceProperty<Workspace>>(
"Workspace", "", Direction::InOut),
"Workspace to add the log entry to");
declareProperty("LogName", "",
boost::make_shared<MandatoryValidator<std::string>>(),
"The name that will identify the log entry");
......
......@@ -62,9 +62,9 @@ const std::string AddTimeSeriesLog::category() const {
* Initialize the algorithm's properties.
*/
void AddTimeSeriesLog::init() {
declareProperty(
new WorkspaceProperty<MatrixWorkspace>("Workspace", "", Direction::InOut),
"In/out workspace that will store the new log information");
declareProperty(make_unique<WorkspaceProperty<MatrixWorkspace>>(
"Workspace", "", Direction::InOut),
"In/out workspace that will store the new log information");
declareProperty(
"Name", "", boost::make_shared<MandatoryValidator<std::string>>(),
......
......@@ -172,28 +172,29 @@ void AlignDetectors::init() {
wsValidator->add<WorkspaceUnitValidator>("TOF");
wsValidator->add<RawCountValidator>();
declareProperty(new WorkspaceProperty<API::MatrixWorkspace>(
declareProperty(make_unique<WorkspaceProperty<API::MatrixWorkspace>>(
"InputWorkspace", "", Direction::Input, wsValidator),
"A workspace with units of TOF");
declareProperty(new WorkspaceProperty<API::MatrixWorkspace>(
declareProperty(make_unique<WorkspaceProperty<API::MatrixWorkspace>>(
"OutputWorkspace", "", Direction::Output),
"The name to use for the output workspace");
const std::vector<std::string> exts{".h5", ".hd5", ".hdf", ".cal"};
declareProperty(
new FileProperty("CalibrationFile", "", FileProperty::OptionalLoad,
{".h5", ".hd5", ".hdf", ".cal"}),
Kernel::make_unique<FileProperty>("CalibrationFile", "",
FileProperty::OptionalLoad, exts),
"Optional: The .cal file containing the position correction factors. "
"Either this or OffsetsWorkspace needs to be specified.");
declareProperty(
new WorkspaceProperty<ITableWorkspace>(
make_unique<WorkspaceProperty<ITableWorkspace>>(
"CalibrationWorkspace", "", Direction::Input, PropertyMode::Optional),
"Optional: A Workspace containing the calibration information. Either "
"this or CalibrationFile needs to be specified.");
declareProperty(
new WorkspaceProperty<OffsetsWorkspace>(
make_unique<WorkspaceProperty<OffsetsWorkspace>>(
"OffsetsWorkspace", "", Direction::Input, PropertyMode::Optional),
"Optional: A OffsetsWorkspace containing the calibration offsets. Either "
"this or CalibrationFile needs to be specified.");
......
......@@ -22,18 +22,18 @@ DECLARE_ALGORITHM(AlphaCalc)
*/
void AlphaCalc::init() {
declareProperty(
new API::WorkspaceProperty<>("InputWorkspace", "", Direction::Input),
"Name of the input workspace");
declareProperty(Kernel::make_unique<API::WorkspaceProperty<>>(
"InputWorkspace", "", Direction::Input),
"Name of the input workspace");
std::vector<int> forwardDefault;
forwardDefault.push_back(1);
declareProperty(new ArrayProperty<int>("ForwardSpectra", forwardDefault),
"The spectra numbers of the forward group (default to 1)");
std::vector<int> forwardDefault{1};
declareProperty(
Kernel::make_unique<ArrayProperty<int>>("ForwardSpectra", forwardDefault),
"The spectra numbers of the forward group (default to 1)");
std::vector<int> backwardDefault;
backwardDefault.push_back(2);
declareProperty(new ArrayProperty<int>("BackwardSpectra", backwardDefault),
std::vector<int> backwardDefault{2};
declareProperty(Kernel::make_unique<ArrayProperty<int>>("BackwardSpectra",
backwardDefault),
"The spectra numbers of the backward group (default to 2)");
declareProperty("FirstGoodValue", EMPTY_DBL(),
......
......@@ -71,13 +71,13 @@ void AnnularRingAbsorption::init() {
auto wsValidator = boost::make_shared<CompositeValidator>();
wsValidator->add<WorkspaceUnitValidator>("Wavelength");
wsValidator->add<InstrumentValidator>();
declareProperty(new WorkspaceProperty<>("InputWorkspace", "",
Direction::Input, wsValidator),
declareProperty(make_unique<WorkspaceProperty<>>(
"InputWorkspace", "", Direction::Input, wsValidator),
"The input workspace in units of wavelength.");
declareProperty(
new WorkspaceProperty<>("OutputWorkspace", "", Direction::Output),
"The name to use for the output workspace.");
declareProperty(make_unique<WorkspaceProperty<>>("OutputWorkspace", "",
Direction::Output),
"The name to use for the output workspace.");
// -- can properties --
auto mustBePositive = boost::make_shared<BoundedValidator<double>>();
......
......@@ -31,14 +31,14 @@ int AppendSpectra::version() const { return 1; }
/** Initialize the algorithm's properties.
*/
void AppendSpectra::init() {
declareProperty(
new WorkspaceProperty<>("InputWorkspace1", "", Direction::Input,
boost::make_shared<CommonBinsValidator>()),
"The name of the first input workspace");
declareProperty(
new WorkspaceProperty<>("InputWorkspace2", "", Direction::Input,
boost::make_shared<CommonBinsValidator>()),
"The name of the second input workspace");
declareProperty(make_unique<WorkspaceProperty<>>(
"InputWorkspace1", "", Direction::Input,
boost::make_shared<CommonBinsValidator>()),
"The name of the first input workspace");
declareProperty(make_unique<WorkspaceProperty<>>(
"InputWorkspace2", "", Direction::Input,
boost::make_shared<CommonBinsValidator>()),
"The name of the second input workspace");
declareProperty(
"ValidateInputs", true,
......@@ -49,9 +49,9 @@ void AppendSpectra::init() {
"Append the spectra from InputWorkspace2 multiple times (for "
"MatrixWorkspaces only)");
declareProperty(
new WorkspaceProperty<>("OutputWorkspace", "", Direction::Output),
"The name of the output workspace");
declareProperty(make_unique<WorkspaceProperty<>>("OutputWorkspace", "",
Direction::Output),
"The name of the output workspace");
declareProperty("MergeLogs", false,
"Whether to combine the logs of the two input workspaces");
......
......@@ -29,11 +29,11 @@ ApplyCalibration::ApplyCalibration() : Algorithm(), m_pmap(nullptr) {}
void ApplyCalibration::init() {
declareProperty(
new API::WorkspaceProperty<API::MatrixWorkspace>("Workspace", "",
Direction::InOut),
make_unique<API::WorkspaceProperty<API::MatrixWorkspace>>(
"Workspace", "", Direction::InOut),
"The name of the input workspace to apply the calibration to");
declareProperty(new API::WorkspaceProperty<API::ITableWorkspace>(
declareProperty(make_unique<API::WorkspaceProperty<API::ITableWorkspace>>(
"PositionTable", "", Direction::Input),
"The name of the table workspace containing the new "
"positions of detectors");
......
......@@ -28,17 +28,17 @@ DECLARE_ALGORITHM(ApplyDeadTimeCorr)
*/
void ApplyDeadTimeCorr::init() {
declareProperty(new API::WorkspaceProperty<API::MatrixWorkspace>(
declareProperty(make_unique<API::WorkspaceProperty<API::MatrixWorkspace>>(
"InputWorkspace", "", Direction::Input),
"The name of the input workspace containing measured counts");
declareProperty(new API::WorkspaceProperty<API::ITableWorkspace>(
declareProperty(make_unique<API::WorkspaceProperty<API::ITableWorkspace>>(
"DeadTimeTable", "", Direction::Input),
"Name of the Dead Time Table");
declareProperty(
new API::WorkspaceProperty<API::MatrixWorkspace>("OutputWorkspace", "",
Direction::Output),
make_unique<API::WorkspaceProperty<API::MatrixWorkspace>>(
"OutputWorkspace", "", Direction::Output),
"The name of the output workspace containing corrected counts");
}
......
......@@ -37,14 +37,15 @@ ApplyDetailedBalance::~ApplyDetailedBalance() {}
void ApplyDetailedBalance::init() {
auto wsValidator = boost::make_shared<CompositeValidator>();
wsValidator->add<WorkspaceUnitValidator>("DeltaE");
declareProperty(new WorkspaceProperty<>("InputWorkspace", "",
Direction::Input, wsValidator),
declareProperty(make_unique<WorkspaceProperty<>>(
"InputWorkspace", "", Direction::Input, wsValidator),
"An input workspace.");
declareProperty(make_unique<WorkspaceProperty<>>("OutputWorkspace", "",
Direction::Output),
"An output workspace.");
declareProperty(
new WorkspaceProperty<>("OutputWorkspace", "", Direction::Output),
"An output workspace.");
declareProperty(
new PropertyWithValue<string>("Temperature", "", Direction::Input),
make_unique<PropertyWithValue<string>>("Temperature", "",
Direction::Input),
"SampleLog variable name that contains the temperature, or a number");
}
......
......@@ -24,16 +24,16 @@ void ApplyTransmissionCorrection::init() {
auto wsValidator = boost::make_shared<CompositeValidator>();
wsValidator->add<WorkspaceUnitValidator>("Wavelength");
wsValidator->add<HistogramValidator>();
declareProperty(new WorkspaceProperty<>("InputWorkspace", "",
Direction::Input, wsValidator),
declareProperty(make_unique<WorkspaceProperty<>>(
"InputWorkspace", "", Direction::Input, wsValidator),
"Workspace to apply the transmission correction to");
declareProperty(new WorkspaceProperty<>("TransmissionWorkspace", "",
Direction::Output,
PropertyMode::Optional),
declareProperty(make_unique<WorkspaceProperty<>>("TransmissionWorkspace", "",
Direction::Output,
PropertyMode::Optional),
"Workspace containing the transmission values [optional]");
declareProperty(
new WorkspaceProperty<>("OutputWorkspace", "", Direction::Output),
"Workspace to store the corrected data in");
declareProperty(make_unique<WorkspaceProperty<>>("OutputWorkspace", "",
Direction::Output),
"Workspace to store the corrected data in");
// Alternatively, the user can specify a transmission that will ba applied to
// all wavelength bins
......
......@@ -24,16 +24,17 @@ DECLARE_ALGORITHM(AsymmetryCalc)
*/
void AsymmetryCalc::init() {
declareProperty(make_unique<API::WorkspaceProperty<>>("InputWorkspace", "",
Direction::Input),
"Name of the input workspace");
declareProperty(
new API::WorkspaceProperty<>("InputWorkspace", "", Direction::Input),
"Name of the input workspace");
declareProperty(
new API::WorkspaceProperty<>("OutputWorkspace", "", Direction::Output),
make_unique<API::WorkspaceProperty<>>("OutputWorkspace", "",
Direction::Output),
"The name of the workspace to be created as the output of the algorithm");
declareProperty(new ArrayProperty<int>("ForwardSpectra"),
declareProperty(make_unique<ArrayProperty<int>>("ForwardSpectra"),
"The spectra numbers of the forward group");
declareProperty(new ArrayProperty<int>("BackwardSpectra"),
declareProperty(make_unique<ArrayProperty<int>>("BackwardSpectra"),
"The spectra numbers of the backward group");
declareProperty("Alpha", 1.0, "The balance parameter (default 1)",
Direction::Input);
......
......@@ -37,7 +37,7 @@ const std::string AverageLogData::category() const {
/** Initialize the algorithm's properties.
*/
void AverageLogData::init() {
declareProperty(new WorkspaceProperty<API::MatrixWorkspace>(
declareProperty(make_unique<WorkspaceProperty<API::MatrixWorkspace>>(
"InputWorkspace", "", Direction::Input),
"An input workspace that contains a Sample log property, and "
"a proton charge property.");
......
......@@ -30,17 +30,17 @@ void BinaryOperateMasks::init() {
std::vector<std::string> operators{"AND", "OR", "XOR", "NOT"};
declareProperty(new WorkspaceProperty<DataObjects::MaskWorkspace>(
declareProperty(make_unique<WorkspaceProperty<DataObjects::MaskWorkspace>>(
"InputWorkspace1", "", Direction::Input),
"MaskWorkspace 1 for binary operation");
declareProperty(
new WorkspaceProperty<DataObjects::MaskWorkspace>(
make_unique<WorkspaceProperty<DataObjects::MaskWorkspace>>(
"InputWorkspace2", "", Direction::Input, PropertyMode::Optional),
"Optional MaskWorkspace 2 for binary operation");
declareProperty("OperationType", "AND",
boost::make_shared<StringListValidator>(operators),
"Operator for Workspace1 and Workspace2");
declareProperty(new WorkspaceProperty<DataObjects::MaskWorkspace>(
declareProperty(make_unique<WorkspaceProperty<DataObjects::MaskWorkspace>>(
"OutputWorkspace", "", Direction::Output),
"Output MaskWorkspace as result of binary operation");
......
......@@ -44,19 +44,19 @@ BinaryOperation::~BinaryOperation() {
*/
void BinaryOperation::init() {
declareProperty(
new WorkspaceProperty<MatrixWorkspace>(inputPropName1(), "",
Direction::Input),
Kernel::make_unique<WorkspaceProperty<MatrixWorkspace>>(
inputPropName1(), "", Direction::Input),
"The name of the input workspace on the left hand side of the operation");
declareProperty(new WorkspaceProperty<MatrixWorkspace>(inputPropName2(), "",
Direction::Input),
declareProperty(Kernel::make_unique<WorkspaceProperty<MatrixWorkspace>>(
inputPropName2(), "", Direction::Input),
"The name of the input workspace on the right hand side of "
"the operation");
declareProperty(new WorkspaceProperty<MatrixWorkspace>(outputPropName(), "",
Direction::Output),
declareProperty(Kernel::make_unique<WorkspaceProperty<MatrixWorkspace>>(
outputPropName(), "", Direction::Output),
"The name to call the output workspace");
declareProperty(
new PropertyWithValue<bool>("AllowDifferentNumberSpectra", false,
Direction::Input),
make_unique<PropertyWithValue<bool>>("AllowDifferentNumberSpectra", false,
Direction::Input),
"Are workspaces with different number of spectra allowed? "
"For example, the LHSWorkspace might have one spectrum per detector, "
"but the RHSWorkspace could have its spectra averaged per bank. If true, "
......@@ -66,7 +66,8 @@ void BinaryOperation::init() {
"apply the RHS spectrum to the LHS.");
declareProperty(
new PropertyWithValue<bool>("ClearRHSWorkspace", false, Direction::Input),
make_unique<PropertyWithValue<bool>>("ClearRHSWorkspace", false,
Direction::Input),
"For EventWorkspaces only. This will clear out event lists "
"from the RHS workspace as the binary operation is applied. "
"This can prevent excessive memory use, e.g. when subtracting "
......
......@@ -26,11 +26,11 @@ DECLARE_ALGORITHM(CalMuonDeadTime)
*/
void CalMuonDeadTime::init() {
declareProperty(
new API::WorkspaceProperty<>("InputWorkspace", "", Direction::Input),
"Name of the input workspace");
declareProperty(make_unique<API::WorkspaceProperty<>>("InputWorkspace", "",
Direction::Input),
"Name of the input workspace");
declareProperty(new API::WorkspaceProperty<API::ITableWorkspace>(
declareProperty(make_unique<API::WorkspaceProperty<API::ITableWorkspace>>(
"DeadTimeTable", "", Direction::Output),
"The name of the TableWorkspace in which to store the list "
"of deadtimes for each spectrum");
......@@ -45,8 +45,8 @@ void CalMuonDeadTime::init() {
"zero (default to 5.0)",
Direction::Input);
declareProperty(new API::WorkspaceProperty<API::Workspace>("DataFitted", "",
Direction::Output),
declareProperty(make_unique<API::WorkspaceProperty<API::Workspace>>(
"DataFitted", "", Direction::Output),
"The data which the deadtime equation is fitted to");
}
......
......@@ -26,9 +26,9 @@ DECLARE_ALGORITHM(CalMuonDetectorPhases)
*/
void CalMuonDetectorPhases::init() {
declareProperty(
new API::WorkspaceProperty<>("InputWorkspace", "", Direction::Input),
"Name of the reference input workspace");
declareProperty(make_unique<API::WorkspaceProperty<>>("InputWorkspace", "",
Direction::Input),
"Name of the reference input workspace");
declareProperty("FirstGoodData", EMPTY_DBL(),
"First good data point in units of micro-seconds",
......@@ -41,22 +41,24 @@ void CalMuonDetectorPhases::init() {
declareProperty("Frequency", EMPTY_DBL(), "Starting hint for the frequency",
Direction::Input);
declareProperty(new API::WorkspaceProperty<API::ITableWorkspace>(
declareProperty(make_unique<API::WorkspaceProperty<API::ITableWorkspace>>(
"DetectorTable", "", Direction::Output),
"Name of the TableWorkspace in which to store the list "
"of phases and asymmetries");
declareProperty(new API::WorkspaceProperty<API::WorkspaceGroup>(
declareProperty(make_unique<API::WorkspaceProperty<API::WorkspaceGroup>>(
"DataFitted", "", Direction::Output),
"Name of the output workspace holding fitting results");
declareProperty(new ArrayProperty<int>("ForwardSpectra", Direction::Input),
"The spectra numbers of the forward group. If not specified "
"will read from file.");
declareProperty(
make_unique<ArrayProperty<int>>("ForwardSpectra", Direction::Input),
"The spectra numbers of the forward group. If not specified "
"will read from file.");
declareProperty(new ArrayProperty<int>("BackwardSpectra", Direction::Input),
"The spectra numbers of the backward group. If not specified "
"will read from file.");
declareProperty(
make_unique<ArrayProperty<int>>("BackwardSpectra", Direction::Input),
"The spectra numbers of the backward group. If not specified "
"will read from file.");
}
//----------------------------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment